Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
erp5
Commits
489d20bc
Commit
489d20bc
authored
Mar 02, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: reduce number of not needed dom modification in html5 input
parent
14a1904e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
73 deletions
+93
-73
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.js
...TemplateItem/web_page_module/rjs_gadget_html5_input_js.js
+91
-71
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
...emplateItem/web_page_module/rjs_gadget_html5_input_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.js
View file @
489d20bc
...
@@ -44,89 +44,110 @@
...
@@ -44,89 +44,110 @@
.
onStateChange
(
function
onStateChange
(
modification_dict
)
{
.
onStateChange
(
function
onStateChange
(
modification_dict
)
{
var
textarea
=
this
.
element
.
querySelector
(
'
input
'
),
var
textarea
=
this
.
element
.
querySelector
(
'
input
'
),
tmp
;
// general use short-scope variable
tmp
;
// general use short-scope variable
if
(
this
.
state
.
type
===
'
checkbox
'
)
{
textarea
.
checked
=
this
.
state
.
checked
;
}
if
(
modification_dict
.
hasOwnProperty
(
"
value
"
))
{
if
(
modification_dict
.
hasOwnProperty
(
'
value
'
)
||
textarea
.
setAttribute
(
'
value
'
,
this
.
state
.
value
);
modification_dict
.
hasOwnProperty
(
'
checked
'
)
||
textarea
.
value
=
this
.
state
.
value
;
modification_dict
.
hasOwnProperty
(
'
editable
'
)
||
}
modification_dict
.
hasOwnProperty
(
'
required
'
)
||
modification_dict
.
hasOwnProperty
(
'
id
'
)
||
modification_dict
.
hasOwnProperty
(
'
name
'
)
||
modification_dict
.
hasOwnProperty
(
'
type
'
)
||
modification_dict
.
hasOwnProperty
(
'
title
'
)
||
modification_dict
.
hasOwnProperty
(
'
focus
'
)
||
modification_dict
.
hasOwnProperty
(
'
step
'
)
||
modification_dict
.
hasOwnProperty
(
'
trim
'
)
||
modification_dict
.
hasOwnProperty
(
'
multiple
'
)
||
modification_dict
.
hasOwnProperty
(
'
accept
'
)
||
modification_dict
.
hasOwnProperty
(
'
capture
'
)
||
modification_dict
.
hasOwnProperty
(
'
append
'
)
||
modification_dict
.
hasOwnProperty
(
'
prepend
'
)
)
{
if
(
this
.
state
.
type
===
'
radio
'
)
{
if
(
this
.
state
.
type
===
'
checkbox
'
)
{
textarea
.
checked
=
this
.
state
.
checked
;
textarea
.
checked
=
this
.
state
.
checked
;
}
}
else
{
textarea
.
id
=
this
.
state
.
id
||
this
.
state
.
name
;
textarea
.
setAttribute
(
'
value
'
,
this
.
state
.
value
);
textarea
.
setAttribute
(
'
name
'
,
this
.
state
.
name
);
textarea
.
value
=
this
.
state
.
value
;
}
textarea
.
setAttribute
(
'
type
'
,
this
.
state
.
type
);
if
(
this
.
state
.
type
===
'
radio
'
)
{
if
(
this
.
state
.
title
)
{
textarea
.
checked
=
this
.
state
.
checked
;
textarea
.
setAttribute
(
'
title
'
,
this
.
state
.
title
);
}
}
textarea
.
id
=
this
.
state
.
id
||
this
.
state
.
name
;
if
(
this
.
state
.
step
)
{
textarea
.
setAttribute
(
'
name
'
,
this
.
state
.
name
);
textarea
.
setAttribute
(
'
step
'
,
this
.
state
.
step
);
}
if
(
this
.
state
.
capture
)
{
textarea
.
setAttribute
(
'
capture
'
,
this
.
state
.
capture
);
}
if
(
this
.
state
.
accept
)
{
textarea
.
setAttribute
(
'
accept
'
,
this
.
state
.
accept
);
}
if
(
this
.
state
.
multiple
)
{
textarea
.
setAttribute
(
'
type
'
,
this
.
state
.
type
);
textarea
.
multiple
=
true
;
if
(
this
.
state
.
title
)
{
}
textarea
.
setAttribute
(
'
title
'
,
this
.
state
.
title
);
}
if
(
this
.
state
.
step
)
{
textarea
.
setAttribute
(
'
step
'
,
this
.
state
.
step
);
}
if
(
this
.
state
.
capture
)
{
textarea
.
setAttribute
(
'
capture
'
,
this
.
state
.
capture
);
}
if
(
this
.
state
.
accept
)
{
textarea
.
setAttribute
(
'
accept
'
,
this
.
state
.
accept
);
}
if
(
this
.
state
.
required
)
{
if
(
this
.
state
.
multiple
)
{
textarea
.
required
=
true
;
textarea
.
multiple
=
true
;
}
else
{
}
textarea
.
required
=
false
;
}
if
(
this
.
state
.
editable
)
{
if
(
this
.
state
.
required
)
{
textarea
.
readonly
=
true
;
textarea
.
required
=
true
;
}
else
{
}
else
{
textarea
.
readonly
=
false
;
textarea
.
required
=
false
;
}
}
if
(
this
.
state
.
hidden
&&
!
modification_dict
.
error_text
)
{
if
(
this
.
state
.
editable
)
{
textarea
.
hidden
=
true
;
textarea
.
readonly
=
true
;
}
else
{
}
else
{
textarea
.
hidden
=
false
;
textarea
.
readonly
=
false
;
}
}
if
(
this
.
state
.
focus
===
true
)
{
if
(
this
.
state
.
focus
===
true
)
{
textarea
.
autofocus
=
true
;
textarea
.
autofocus
=
true
;
textarea
.
focus
();
textarea
.
focus
();
}
}
if
(
this
.
state
.
focus
===
false
)
{
if
(
this
.
state
.
focus
===
false
)
{
textarea
.
autofocus
=
false
;
textarea
.
autofocus
=
false
;
textarea
.
blur
();
textarea
.
blur
();
}
}
if
(
modification_dict
.
append
)
{
if
(
modification_dict
.
append
)
{
this
.
element
.
classList
.
add
(
'
ui-input-has-appendinx
'
);
this
.
element
.
classList
.
add
(
'
ui-input-has-appendinx
'
);
tmp
=
document
.
createElement
(
'
i
'
);
tmp
=
document
.
createElement
(
'
i
'
);
tmp
.
appendChild
(
document
.
createTextNode
(
modification_dict
.
append
));
tmp
.
appendChild
(
document
.
createTextNode
(
modification_dict
.
append
));
this
.
element
.
appendChild
(
tmp
);
this
.
element
.
appendChild
(
tmp
);
tmp
=
undefined
;
tmp
=
undefined
;
}
}
if
(
modification_dict
.
prepend
)
{
if
(
modification_dict
.
prepend
)
{
this
.
element
.
classList
.
add
(
'
ui-input-has-prependinx
'
);
this
.
element
.
classList
.
add
(
'
ui-input-has-prependinx
'
);
tmp
=
document
.
createElement
(
'
i
'
);
tmp
=
document
.
createElement
(
'
i
'
);
tmp
.
appendChild
(
document
.
createTextNode
(
modification_dict
.
append
));
tmp
.
appendChild
(
document
.
createTextNode
(
modification_dict
.
append
));
this
.
element
.
insertBefore
(
tmp
,
textarea
);
this
.
element
.
insertBefore
(
tmp
,
textarea
);
tmp
=
undefined
;
tmp
=
undefined
;
}
}
}
if
(
this
.
state
.
error_text
&&
if
(
modification_dict
.
hasOwnProperty
(
'
error_text
'
)
||
!
textarea
.
classList
.
contains
(
"
is-invalid
"
))
{
modification_dict
.
hasOwnProperty
(
'
hidden
'
))
{
textarea
.
classList
.
add
(
"
is-invalid
"
);
if
(
this
.
state
.
hidden
&&
!
this
.
state
.
error_text
)
{
}
else
if
(
!
this
.
state
.
error_text
&&
textarea
.
hidden
=
true
;
textarea
.
classList
.
contains
(
"
is-invalid
"
))
{
}
else
{
textarea
.
classList
.
remove
(
"
is-invalid
"
);
textarea
.
hidden
=
false
;
}
if
(
this
.
state
.
error_text
&&
!
textarea
.
classList
.
contains
(
"
is-invalid
"
))
{
textarea
.
classList
.
add
(
"
is-invalid
"
);
}
else
if
(
!
this
.
state
.
error_text
&&
textarea
.
classList
.
contains
(
"
is-invalid
"
))
{
textarea
.
classList
.
remove
(
"
is-invalid
"
);
}
}
}
})
})
...
@@ -240,7 +261,6 @@
...
@@ -240,7 +261,6 @@
},
{
mutex
:
'
changestate
'
})
},
{
mutex
:
'
changestate
'
})
.
declareJob
(
'
deferErrorText
'
,
function
deferErrorText
(
error_text
)
{
.
declareJob
(
'
deferErrorText
'
,
function
deferErrorText
(
error_text
)
{
var
input
=
this
.
element
.
querySelector
(
"
input
"
);
return
this
.
changeState
({
return
this
.
changeState
({
error_text
:
error_text
error_text
:
error_text
});
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
View file @
489d20bc
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
990.2
7297.58624.60416
</string>
</value>
<value>
<string>
990.2
8219.58167.35225
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16146
39525.14
</float>
<float>
16146
95141.57
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment