PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.3
JetFormBuilder — Dynamic Blocks Form Builder v3.1.3
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 / attrs / BaseHtmlAttr.js
jetformbuilder / assets / src / frontend / main / attrs Last commit date
BaseHtmlAttr.js 2 years ago FileExtensionHtmlAttr.js 2 years ago MaxFileSizeHtmlAttr.js 2 years ago MaxFilesHtmlAttr.js 2 years ago RemainingCalcAttr.js 2 years ago
BaseHtmlAttr.js
77 lines
1 import ReactiveVar from '../reactive/ReactiveVar';
2
3 function BaseHtmlAttr() {
4 this.attrName = '';
5 this.initial = null;
6 this.isFromData = false;
7 this.value = null;
8 }
9
10 BaseHtmlAttr.prototype = {
11 /**
12 * Name of data attribute
13 */
14 attrName: '',
15 /**
16 * @type {InputData}
17 */
18 input: null,
19 initial: null,
20 /**
21 * @type {ReactiveVar}
22 */
23 value: null,
24 observe() {
25 this.value = new ReactiveVar( this.initial );
26 this.value.make();
27
28 this.addWatcherAttr();
29 },
30 nodeSignal() {
31 const [ node ] = this.input.nodes;
32
33 node[ this.attrName ] = this.value.current;
34 },
35 addWatcherAttr() {
36 this.value.watch( () => this.nodeSignal() );
37 },
38 /**
39 * If you need specific check,
40 * you can rewrite this function
41 *
42 * @param input {InputData}
43 * @return {boolean}
44 */
45 isSupported( input ) {
46 const [ node ] = input.nodes;
47
48 const hasInRoot = -1 !== node[ this.attrName ] ?? -1;
49 const hasInDataSet = node.dataset.hasOwnProperty( this.attrName );
50
51 if ( !hasInDataSet && !hasInRoot ) {
52 return false;
53 }
54
55 this.initial = this.getInitial( input );
56
57 return Boolean( this.initial );
58 },
59 /**
60 * @param input {InputData}
61 * @return {*|boolean}
62 */
63 getInitial( input ) {
64 const [ node ] = input.nodes;
65
66 return node.dataset[ this.attrName ] || node[ this.attrName ] || false;
67 },
68
69 /**
70 * @param input {InputData}
71 */
72 setInput( input ) {
73 this.input = input;
74 },
75 };
76
77 export default BaseHtmlAttr;