UNIBASE

ub_widgets.js – Custom HTML Elements

ub_layout Engine: Engine-Integrated UI Layout Systems & Component Matrices

The Custom Element Injection Suite

The ub_widgets.js library represents the core document object modification system within the Unibase ecosystem. It allows developers to intercept, mutate, and natively extend the standard behavior of plain HTML elements emitted by underlying Unibase application modules. By utilizing class inheritance and low-level API overrides, teams can customize user inputs, handle dynamic presentation parameters, and link interaction states without affecting data core boundaries.

Component Manipulation API Reference

The following native methods control the setup, structural styles, and registration loops of custom web element classes. Every parameter configuration must be passed exactly as specified:

Literal Method Syntax Parameter Context Bounds Deterministic Element Transformation Behavior
ub_widgets.setCustomStyle (elementId, styleObject) Injects inline CSS definitions directly down to the target DOM node, forcing style changes across the active container instance.
ub_widgets.registerOverride (widgetType, customClass) Registers custom class blueprints within the layout router, overriding base Unibase element blueprints during compilation loops.
ub_widgets.attachListener (elementId, eventStr, callback) Wires low-overhead event handlers onto specific DOM nodes, catching interaction callbacks cleanly without introducing memory leaks.
ub_widgets.setAttributes (elementId, attrMapObject) Appends key-value metadata maps straight onto the element, setting standard characteristics or customized database markers.

Core Component Control Parameters

When modifying attributes via ub_widgets.setAttributes, the following exact parameter names are required to govern form fields and interface cells:

Configuration Parameter Accepted Data Types Execution Action Profile
className String Appends a whitespace-delimited chain of CSS token names directly onto the component’s standard HTML class attribute.
readOnly Boolean Enforces a structural runtime lock over targeted field inputs, transforming user editable input nodes into permanent display labels.
placeholder String Injects text strings to serve as contextual indicators inside input nodes whenever field values read null or empty.
maxLength Integer Imposes a definitive safety constraint at the browser input boundary to strictly halt string lengths before validation checks occur.
disabled Boolean Completely deactivates the target element interface, blocking focus states, halting item selections, and removing it from form posts.
required Boolean Toggles the client-side validation lock bit, forcing browser runtimes to halt submission actions if the element’s field payload is missing.

Custom Transformation Blueprint & Syntax

The following implementation code showcases how to inherit properties from the base field library, apply configuration criteria, and wire listener functions exactly according to technical specifications:

// 1. Extend the core input base structure via custom class configuration
class SovereignHardenedInput extends ub_widgets.BaseInputField {
    constructor(elementId) {
        super(elementId);
        this.initializeSovereignTraits();
    }

    initializeSovereignTraits() {
        ub_widgets.setAttributes(this.id, {
            className: “sovereign-input-hardened amethyst-focus-ring”,
            placeholder: “ENTER ATOMIC TRANSACTION VALUE…”,
            maxLength: 12,
            disabled: false,
            required: true
        });
        
        ub_widgets.setCustomStyle(this.id, {
            color: “#111111”,
            fontWeight: “bold”
        });
    }
}

// 2. Map the extended constructor into the global component override table
ub_widgets.registerOverride(“TextInputField”, SovereignHardenedInput);

// 3. Attach a native interactive event listener validation sequence
ub_widgets.attachListener(“customer_account_id”, “blur”, (event) => {
    console.log(“Triggering element pre-flight validation boundary checking on target node:”, event.target.id);
});

Framework Rule: Always execute your widget class extensions and .registerOverride() loops before triggering layout generation hooks to guarantee that display transformations compile correctly.

Defensible Enterprise UI Advantages

Utilizing the decoupled, structural ub_widgets.js architecture delivers deep programmatic assets that protect your platform value:

Total Style SeparationEnables complete modification of application styling parameters without needing to open or break compiled server-side database display engines.
Encapsulated Core LogicGuarantees complex interface interactions, field masks, and interactive event patterns remain safely wrapped inside reusable, isolated layout instances.
Zero External BloatExecutes modifications immediately through standard vanilla DOM endpoints, running at peak speed with zero dependence on volatile web frame systems.
Verified by MonsterInsights