Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
react-vanilla
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
react-vanilla
Commits
24d5ed8e
Commit
24d5ed8e
authored
Jan 07, 2026
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Number Input
parent
8ef62f12
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
Cmp.js
Cmp.js
+24
-0
Store.js
Store.js
+4
-2
No files found.
Cmp.js
View file @
24d5ed8e
...
...
@@ -55,6 +55,30 @@
);
});
D
.
Field
.
Number
=
D
.
declare
(
'field.Number'
,
(
cfg
)
=>
{
let
changeHandler
=
cfg
.
onchange
||
cfg
.
onclick
;
var
input
=
D
.
h
(
'input'
,
{
cls
:
"cmp-number__input"
,
type
:
"number"
,
min
:
cfg
.
min
,
max
:
cfg
.
max
,
step
:
cfg
.
step
});
if
(
cfg
.
bind
){
cfg
.
bind
.
hook
(
val
=>
{
input
.
value
=
val
;
changeHandler
&&
changeHandler
(
val
);
});
};
var
change
=
Store
.
debounce
(
function
(
e
){
cfg
.
bind
.
set
(
parseFloat
(
input
.
value
))
},
5
);
'input, change,click, mouseup,wheel'
.
split
(
','
)
.
map
(
a
=>
a
.
trim
())
.
forEach
(
evt
=>
input
.
addEventListener
(
evt
,
change
));
return
D
.
h
(
'label'
,
{
cls
:
clsBuilder
(
"cmp-number"
,
cfg
),
title
:
cfg
.
alt
||
"Change value"
,
renderTo
:
cfg
.
renderTo
},
(
cfg
.
label
?
D
.
h
(
'span'
,
{
cls
:
"cmp-number--title"
},
cfg
.
label
)
:
null
),
input
,
(
cfg
.
after
?
cfg
.
after
:
null
)
);
});
D
.
Field
.
Slider
=
D
.
declare
(
'field.Slider'
,
(
cfg
)
=>
{
let
changeHandler
=
cfg
.
onchange
||
cfg
.
onclick
;
...
...
Store.js
View file @
24d5ed8e
...
...
@@ -3,6 +3,7 @@ Observable Store based in 2016 April by Ivan Kubota
License: MPL 2.0
Contact: zibx@quokka.pub
*/
;(
function
(){
const
isEqual
=
function
(
original
,
fn
)
{
return
function
(
val
)
{
fn
(
val
===
original
);
...
...
@@ -1172,4 +1173,5 @@ var _Store = new Store();
Store
.
sub
=
_Store
.
sub
.
bind
(
_Store
);
typeof
module
===
'object'
&&
(
module
.
exports
=
Store
);
(
typeof
window
===
'object'
)
&&
(
window
.
Store
=
Store
);
\ No newline at end of file
(
typeof
window
===
'object'
)
&&
(
window
.
Store
=
Store
);
})();
\ No newline at end of file
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