Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kus-admin
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
Иван Кубота
kus-admin
Commits
aecac90e
Commit
aecac90e
authored
Jan 28, 2020
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
back referenced cls set
parent
170f7211
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
14 deletions
+57
-14
DOM.js
src/core/DOM.js
+51
-9
LabeledField.jsx
src/view/cmp/field/LabeledField.jsx
+6
-5
No files found.
src/core/DOM.js
View file @
aecac90e
...
@@ -265,27 +265,69 @@ NS.apply = function(a,b) {
...
@@ -265,27 +265,69 @@ NS.apply = function(a,b) {
return
out
;
return
out
;
};
};
D
.
cls
=
function
()
{
var
dpID
=
1
;
var
out
=
[],
i
=
0
,
_i
=
arguments
.
length
,
token
,
tmp
,
key
;
var
DataPiece
=
function
(
id
){
this
.
id
=
id
;};
DataPiece
.
prototype
=
{
value
:
void
0
,
update
:
function
(){}};
var
DataPieceFactory
=
function
(
refs
,
fn
)
{
var
id
=
dpID
++
;
var
dp
=
new
DataPiece
(
id
);
refs
.
push
(
dp
);
fn
(
function
(
val
)
{
dp
.
value
=
val
;
dp
.
update
();
});
return
dp
;
};
var
RefHash
=
function
(){};
RefHash
.
prototype
=
{
any
:
false
};
D
.
__cls
=
function
(
args
,
refs
)
{
return
function
(
update
)
{
var
i
,
_i
,
lastCls
,
constructCls
=
function
()
{
var
cls
=
D
.
_cls
(
args
,
[],
0
);
if
(
lastCls
!==
cls
)
update
(
lastCls
=
cls
);
};
for
(
i
=
0
,
_i
=
refs
.
length
;
i
<
_i
;
i
++
)
refs
[
i
].
update
=
constructCls
;
constructCls
();
};
};
D
.
_cls
=
function
(
args
,
refs
,
depth
)
{
var
out
=
[],
i
=
0
,
_i
=
args
.
length
,
token
,
tmp
,
key
;
for
(;
i
<
_i
;
i
++
){
for
(;
i
<
_i
;
i
++
){
token
=
arg
ument
s
[
i
];
token
=
args
[
i
];
if
(
typeof
token
===
'string'
&&
token
){
if
(
typeof
token
===
'string'
&&
token
){
out
.
push
(
token
);
out
.
push
(
token
);
}
else
if
(
typeof
token
===
'object'
){
}
else
if
(
typeof
token
===
'object'
){
if
(
Array
.
isArray
(
token
)){
if
(
token
instanceof
DataPiece
){
tmp
=
D
.
cls
.
apply
(
null
,
token
);
token
.
value
&&
out
.
push
(
token
.
value
);
}
else
if
(
Array
.
isArray
(
token
)){
tmp
=
D
.
_cls
(
token
,
refs
,
depth
+
1
);
// TODO check for push tmp
tmp
&&
out
.
push
(
token
);
tmp
&&
out
.
push
(
token
);
}
else
{
}
else
{
for
(
key
in
token
){
for
(
key
in
token
){
token
[
key
]
&&
out
.
push
(
key
);
if
(
token
[
key
]
instanceof
DataPiece
){
token
[
key
].
value
&&
out
.
push
(
key
);
}
else
if
(
typeof
token
[
key
]
===
'function'
){
token
[
key
]
=
DataPieceFactory
(
refs
,
token
[
key
]);
}
else
{
token
[
key
]
&&
out
.
push
(
key
);
}
}
}
}
}
}
else
if
(
typeof
token
===
'function'
){
}
else
if
(
typeof
token
===
'function'
){
args
[
i
]
=
DataPieceFactory
(
refs
,
args
[
i
]);
}
}
}
}
return
out
.
join
(
' '
);
return
depth
===
0
&&
refs
.
length
?
D
.
__cls
(
args
,
refs
):
out
.
join
(
' '
);
};
};
D
.
cls
=
function
()
{
return
D
.
_cls
(
arguments
,
[],
0
);
};
D
.
escapeCls
=
function
(
cls
)
{
D
.
escapeCls
=
function
(
cls
)
{
return
(
cls
+
''
).
replace
(
/
[^
a-zA-Z0-9
\-
_
]
/g
,
''
);
return
(
cls
+
''
).
replace
(
/
[^
a-zA-Z0-9
\-
_
]
/g
,
''
);
};
};
...
...
src/view/cmp/field/LabeledField.jsx
View file @
aecac90e
import
'./LabeledField.scss'
;
import
'./LabeledField.scss'
;
import
Input
from
'./Input.jsx'
;
import
Input
from
'./Input.jsx'
;
export
default
D
.
declare
(
'view.cmp.field.LabeledField'
,
(
cfg
,
children
)
=>
export
default
D
.
declare
(
'view.cmp.field.LabeledField'
,
(
cfg
,
children
)
=>
{
<
div
class=
{
D
.
cls
(
"labeled-field"
,
{
"labeled-field--invalid"
:
cfg
.
invalid
})
}
>
console
.
log
(
cfg
.
invalid
)
return
<
div
class=
{
D
.
cls
(
"labeled-field"
,
cfg
.
cls
,
{
"labeled-field--invalid"
:
cfg
.
invalid
}
)
}
>
<
label
class=
"labeled-field__label"
>
<
label
class=
"labeled-field__label"
>
<
span
class=
"labeled-field__label-text"
>
{
cfg
.
label
}
</
span
>
<
span
class=
"labeled-field__label-text"
>
{
cfg
.
label
}
</
span
>
<
Input
class=
"labeled-field__input"
type=
{
cfg
.
type
}
placeholder=
{
cfg
.
placeholder
}
{
...
cfg
}
/>
<
Input
class=
"labeled-field__input"
type=
{
cfg
.
type
}
placeholder=
{
cfg
.
placeholder
}
{
...
cfg
}
/>
</
label
>
</
label
>
{
children
}
{
children
}
</
div
>
</
div
>
)
}
)
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