Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
props-compute
Project
Project
Details
Activity
Releases
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
劳工
props-compute
Commits
f2121e72
Commit
f2121e72
authored
Sep 23, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持range类型
parent
ba414655
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
4 deletions
+98
-4
index.es.js
dist/index.es.js
+24
-1
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+24
-0
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+24
-0
index.umd.js.map
dist/index.umd.js.map
+1
-1
index.ts
src/index.ts
+23
-0
No files found.
dist/index.es.js
View file @
f2121e72
...
...
@@ -25,6 +25,9 @@ function compute(props, options) {
case
'vector2'
:
value
=
parseVector2
(
sourceValue
);
break
;
case
'range'
:
value
=
parseRange
(
sourceValue
);
break
;
case
'array'
:
var
seps
=
sourceValue
.
split
(
','
);
seps
=
seps
.
map
(
function
(
sep
)
{
...
...
@@ -85,6 +88,26 @@ function parseVector2(sourceValue) {
}
return
value
;
}
function
parseRange
(
sourceValue
)
{
var
value
=
sourceValue
;
if
(
!
sourceValue
)
{
value
=
{
x
:
undefined
,
y
:
undefined
};
}
if
(
typeof
sourceValue
===
'string'
)
{
var
arr
=
sourceValue
.
split
(
','
);
value
=
{
min
:
arr
[
0
]
===
''
?
undefined
:
parseFloat
(
arr
[
0
]),
max
:
arr
[
1
]
===
''
?
undefined
:
parseFloat
(
arr
[
1
]),
};
}
else
if
(
Array
.
isArray
(
sourceValue
))
{
value
=
{
min
:
sourceValue
[
0
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
0
]),
max
:
sourceValue
[
1
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
1
]),
};
}
return
value
;
}
function
getValue
(
props
,
option
,
key
)
{
var
value
;
if
(
props
.
hasOwnProperty
(
key
))
{
...
...
@@ -96,5 +119,5 @@ function getValue(props, option, key) {
return
value
;
}
export
{
compute
,
parseType
,
parseVector2
};
export
{
compute
,
parse
Range
,
parse
Type
,
parseVector2
};
//# sourceMappingURL=index.es.js.map
dist/index.es.js.map
View file @
f2121e72
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
f2121e72
...
...
@@ -29,6 +29,9 @@ function compute(props, options) {
case
'vector2'
:
value
=
parseVector2
(
sourceValue
);
break
;
case
'range'
:
value
=
parseRange
(
sourceValue
);
break
;
case
'array'
:
var
seps
=
sourceValue
.
split
(
','
);
seps
=
seps
.
map
(
function
(
sep
)
{
...
...
@@ -89,6 +92,26 @@ function parseVector2(sourceValue) {
}
return
value
;
}
function
parseRange
(
sourceValue
)
{
var
value
=
sourceValue
;
if
(
!
sourceValue
)
{
value
=
{
x
:
undefined
,
y
:
undefined
};
}
if
(
typeof
sourceValue
===
'string'
)
{
var
arr
=
sourceValue
.
split
(
','
);
value
=
{
min
:
arr
[
0
]
===
''
?
undefined
:
parseFloat
(
arr
[
0
]),
max
:
arr
[
1
]
===
''
?
undefined
:
parseFloat
(
arr
[
1
]),
};
}
else
if
(
Array
.
isArray
(
sourceValue
))
{
value
=
{
min
:
sourceValue
[
0
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
0
]),
max
:
sourceValue
[
1
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
1
]),
};
}
return
value
;
}
function
getValue
(
props
,
option
,
key
)
{
var
value
;
if
(
props
.
hasOwnProperty
(
key
))
{
...
...
@@ -101,6 +124,7 @@ function getValue(props, option, key) {
}
exports
.
compute
=
compute
;
exports
.
parseRange
=
parseRange
;
exports
.
parseType
=
parseType
;
exports
.
parseVector2
=
parseVector2
;
//# sourceMappingURL=index.js.map
dist/index.js.map
View file @
f2121e72
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
f2121e72
...
...
@@ -31,6 +31,9 @@
case
'vector2'
:
value
=
parseVector2
(
sourceValue
);
break
;
case
'range'
:
value
=
parseRange
(
sourceValue
);
break
;
case
'array'
:
var
seps
=
sourceValue
.
split
(
','
);
seps
=
seps
.
map
(
function
(
sep
)
{
...
...
@@ -91,6 +94,26 @@
}
return
value
;
}
function
parseRange
(
sourceValue
)
{
var
value
=
sourceValue
;
if
(
!
sourceValue
)
{
value
=
{
x
:
undefined
,
y
:
undefined
};
}
if
(
typeof
sourceValue
===
'string'
)
{
var
arr
=
sourceValue
.
split
(
','
);
value
=
{
min
:
arr
[
0
]
===
''
?
undefined
:
parseFloat
(
arr
[
0
]),
max
:
arr
[
1
]
===
''
?
undefined
:
parseFloat
(
arr
[
1
]),
};
}
else
if
(
Array
.
isArray
(
sourceValue
))
{
value
=
{
min
:
sourceValue
[
0
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
0
]),
max
:
sourceValue
[
1
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
1
]),
};
}
return
value
;
}
function
getValue
(
props
,
option
,
key
)
{
var
value
;
if
(
props
.
hasOwnProperty
(
key
))
{
...
...
@@ -103,6 +126,7 @@
}
exports
.
compute
=
compute
;
exports
.
parseRange
=
parseRange
;
exports
.
parseType
=
parseType
;
exports
.
parseVector2
=
parseVector2
;
...
...
dist/index.umd.js.map
View file @
f2121e72
This diff is collapsed.
Click to expand it.
src/index.ts
View file @
f2121e72
...
...
@@ -31,6 +31,9 @@ export function compute(props, options: Object | Array<any>) {
case
'vector2'
:
value
=
parseVector2
(
sourceValue
);
break
;
case
'range'
:
value
=
parseRange
(
sourceValue
);
break
;
case
'array'
:
let
seps
=
sourceValue
.
split
(
','
);
seps
=
seps
.
map
(
sep
=>
{
...
...
@@ -93,6 +96,26 @@ export function parseVector2(sourceValue) {
return
value
;
}
export
function
parseRange
(
sourceValue
)
{
let
value
=
sourceValue
;
if
(
!
sourceValue
)
{
value
=
{
x
:
undefined
,
y
:
undefined
};
}
if
(
typeof
sourceValue
===
'string'
)
{
let
arr
=
sourceValue
.
split
(
','
);
value
=
{
min
:
arr
[
0
]
===
''
?
undefined
:
parseFloat
(
arr
[
0
]),
max
:
arr
[
1
]
===
''
?
undefined
:
parseFloat
(
arr
[
1
]),
};
}
else
if
(
Array
.
isArray
(
sourceValue
))
{
value
=
{
min
:
sourceValue
[
0
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
0
]),
max
:
sourceValue
[
1
]
===
''
?
undefined
:
parseFloat
(
sourceValue
[
1
]),
};
}
return
value
;
}
function
getValue
(
props
,
option
,
key
)
{
let
value
;
if
(
props
.
hasOwnProperty
(
key
))
{
...
...
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