PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.6
JetFormBuilder — Dynamic Blocks Form Builder v3.1.6
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / assets / src / frontend / main / inputs / InputMaskedData.js
jetformbuilder / assets / src / frontend / main / inputs Last commit date
ChangeData.js 2 years ago CheckboxData.js 2 years ago InputData.js 2 years ago InputMaskedData.js 2 years ago MultiSelectData.js 2 years ago NoListenData.js 2 years ago RadioData.js 2 years ago RangeData.js 2 years ago RenderStateData.js 2 years ago WysiwygData.js 2 years ago functions.js 2 years ago
InputMaskedData.js
70 lines
1 import InputData from './InputData';
2 import { isInputMask } from '../supports';
3 import ReactiveHook from '../reactive/ReactiveHook';
4
5 const { applyFilters } = JetPlugins.hooks;
6
7 function InputMaskedData() {
8 InputData.call( this );
9
10 this.maskOptions = {};
11 this.clearOnSubmit = false;
12
13 this.isSupported = function ( node ) {
14 return isInputMask( node );
15 };
16 this.addListeners = function () {
17 const [ node ] = this.nodes;
18
19 node.addEventListener( 'blur', () => {
20 this.value.current = node.inputmask.unmaskedvalue();
21 this.reporting.validateOnBlur();
22 } );
23
24 this.enterKey = new ReactiveHook();
25 node.addEventListener( 'keydown', this.handleEnterKey.bind( this ) );
26 };
27 this.setNode = function ( node ) {
28 InputData.prototype.setNode.call( this, node );
29
30 this.clearOnSubmit = node.dataset.clearMaskOnSubmit ?? false;
31
32 const options = applyFilters( 'jet.fb.inputmask.options', {}, this );
33 jQuery( node ).inputmask( options );
34
35 this.beforeSubmit( this.removeMask.bind( this ) );
36 this.getSubmit().onEndSubmit( this.revertMask.bind( this ) );
37 };
38 this.removeMask = function ( resolve ) {
39 const $maskedField = jQuery( this.nodes[ 0 ] );
40 this.maskOptions = $maskedField.inputmask.opts;
41
42 // Remove mask if empty value
43 if ( !this.value.current || this.clearOnSubmit ) {
44 $maskedField.inputmask( 'remove' );
45 this.value.notify();
46 }
47
48 resolve();
49 };
50 this.revertMask = function () {
51 const [ node ] = this.nodes;
52 const opts = this.maskOptions;
53 this.maskOptions = {};
54
55 if ( node.inputmask ) {
56 return;
57 }
58
59 jQuery( node ).inputmask( opts );
60 };
61
62 this.onClear = function () {
63 this.silenceSet( '' );
64 };
65
66 }
67
68 InputMaskedData.prototype = Object.create( InputData.prototype );
69
70 export default InputMaskedData;