p:calendar in version 10.0.0 and 10.0.2

UI Components for JSF
Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

11 Jun 2021, 15:16

If you need scripts for 10 that work for Calendar And DatePicker its these...

Code: Select all

if (PrimeFaces.widget.Calendar) {

    PrimeFaces.widget.Calendar.prototype.applyMask = function() {
        if (this.cfg.inline || this.input.is('[readonly]') || this.input.is(':disabled')) {
            return;
        }
        if (this.cfg.mask) {
            var maskCfg = {
                placeholder: this.cfg.maskSlotChar || '_',
                clearMaskOnLostFocus: this.cfg.maskAutoClear || true,
                clearIncomplete: this.cfg.maskAutoClear || true,
                autoUnmask: false
            };
            var pattern = new RegExp("m|d|y|h|s", 'i');
            var isAlias = pattern.test(this.cfg.mask);
            if (isAlias) {
                maskCfg.alias = 'datetime';
                maskCfg.inputFormat = this.cfg.mask;
            } else {
                maskCfg.mask = this.cfg.mask;
            }
            this.input.inputmask('remove').inputmask(maskCfg);
        }
    }
}

if (PrimeFaces.widget.DatePicker) {

    PrimeFaces.widget.DatePicker.prototype.applyMask = function() {
        if (this.cfg.inline || this.input.is('[readonly]') || this.input.is(':disabled')) {
            return;
        }
        if (this.cfg.mask) {
            var maskCfg = {
                placeholder: this.cfg.maskSlotChar || '_',
                clearMaskOnLostFocus: this.cfg.maskAutoClear || true,
                clearIncomplete: this.cfg.maskAutoClear || true,
                autoUnmask: false
            };
            var pattern = new RegExp("m|d|y|h|s", 'i');
            var isAlias = pattern.test(this.cfg.mask);
            if (isAlias) {
                maskCfg.alias = 'datetime';
                maskCfg.inputFormat = this.cfg.mask;
            } else {
                maskCfg.mask = this.cfg.mask;
            }
            this.input.inputmask('remove').inputmask(maskCfg);
        }
    }
}
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests