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

META-INF.resources.primefaces.watermark.watermark.js Maven / Gradle / Ivy

There is a newer version: 14.0.0
Show newest version
/**
 * __PrimeFaces Watermark Widget__
 * 
 * Watermark displays a hint on an input field.
 * 
 * @prop {JQuery} target The DOM element for the target component of this watermark.
 * 
 * @interface {PrimeFaces.widget.WatermarkCfg} cfg The configuration for the {@link  Watermark| Watermark widget}.
 * You can access this configuration via {@link PrimeFaces.widget.BaseWidget.cfg|BaseWidget.cfg}. Please note that this
 * configuration is usually meant to be read-only and should not be modified.
 * @extends {PrimeFaces.widget.BaseWidgetCfg} cfg
 * 
 * @prop {string} cfg.target Search expression for the target component of the watermark.
 * @prop {string} cfg.value The text of the watermark.
 */
PrimeFaces.widget.Watermark = PrimeFaces.widget.BaseWidget.extend({

    /**
     * @override
     * @inheritdoc
     * @param {PrimeFaces.PartialWidgetCfg} cfg
     */
    init: function(cfg) {
        this._super(cfg);

        this.target = PrimeFaces.expressions.SearchExpressionFacade.resolveComponentsAsSelector(this.cfg.target);

        if(this.target.is(':not(:input)')) {
            this.target = this.target.find(':input');
        }

        this.target.attr('placeholder', this.cfg.value);
    }

});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy