Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
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
劳工
zeroing-libs
Commits
57589133
Commit
57589133
authored
Dec 14, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善比较节点
parent
39a1173e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
15 deletions
+59
-15
compare.json
dist/processes/base/compare.json
+14
-2
dispatch-event.json
dist/processes/base/dispatch-event.json
+2
-2
index.ts
src/process/base/compare/index.ts
+33
-5
meta.json
src/process/base/compare/meta.json
+7
-4
index.ts
src/process/base/dispatch-event/index.ts
+1
-0
meta.json
src/process/base/dispatch-event/meta.json
+2
-2
No files found.
dist/processes/base/compare.json
View file @
57589133
...
...
@@ -23,9 +23,21 @@
">"
,
">="
,
"<"
,
"<="
"<="
,
"exist"
],
"default"
:
"=="
},
"type"
:
{
"alias"
:
"判断类型"
,
"type"
:
"enum"
,
"enum"
:
[
"unset"
,
"string"
,
"number"
,
"boolean"
],
"default"
:
"unset"
}
},
"output"
:
[
...
...
@@ -33,7 +45,7 @@
"false"
],
"id"
:
"compare"
,
"script"
:
"var leftValue =
typeof props.left === 'string' ? '
\"
' + props.left + '
\"
' : props.left;
\n
var rightValue = typeof props.right === 'string' ? '
\"
' + props.right + '
\"
' : props.right;
\n
var operator = props.operator;
\n
var func = new Function('return ' + leftValue + operator + rightValue);
\n
var result = func();
\n
next(result ? 'true' : 'false');
\n
"
,
"script"
:
"var leftValue =
engine.findVariable('left', args, props);
\n
var rightValue = engine.findVariable('right', args, props);
\n
var operator = engine.findVariable('operator', args, props);
\n
var result;
\n
if (operator === 'exist') {
\n
result = !!leftValue;
\n
}
\n
else {
\n
switch (props.type) {
\n
case 'string':
\n
leftValue = '
\"
' + leftValue + '
\"
';
\n
rightValue = '
\"
' + rightValue + '
\"
';
\n
break;
\n
case 'number':
\n
leftValue = typeof leftValue === 'number' ? leftValue : parseFloat(leftValue);
\n
rightValue = typeof rightValue === 'number' ? rightValue : parseFloat(rightValue);
\n
break;
\n
case 'boolean':
\n
leftValue = typeof leftValue === 'boolean' ? leftValue :
\n
(leftValue === 'true' ? true :
\n
(leftValue === 'false' ? false : !!leftValue));
\n
rightValue = typeof rightValue === 'boolean' ? rightValue :
\n
(rightValue === 'true' ? true :
\n
(rightValue === 'false' ? false : !!rightValue));
\n
break;
\n
}
\n
var func = new Function('return ' + leftValue + operator + rightValue);
\n
result = func();
\n
}
\n
next(result ? 'true' : 'false');
\n
"
,
"group"
:
"base"
,
"type"
:
"builtin"
}
dist/processes/base/dispatch-event.json
View file @
57589133
{
"name"
:
"
发送
事件"
,
"desc"
:
"
发送
事件"
,
"name"
:
"
派发
事件"
,
"desc"
:
"
派发
事件"
,
"props"
:
{
"eventName"
:
{
"type"
:
"string"
,
...
...
src/process/base/compare/index.ts
View file @
57589133
...
...
@@ -2,9 +2,37 @@
* Created by rockyl on 2019-11-16.
*/
let
leftValue
=
typeof
props
.
left
===
'string'
?
'"'
+
props
.
left
+
'"'
:
props
.
left
;
let
rightValue
=
typeof
props
.
right
===
'string'
?
'"'
+
props
.
right
+
'"'
:
props
.
right
;
let
operator
=
props
.
operator
;
let
func
=
new
Function
(
'return '
+
leftValue
+
operator
+
rightValue
);
let
result
=
func
();
let
leftValue
=
engine
.
findVariable
(
'left'
,
args
,
props
);
let
rightValue
=
engine
.
findVariable
(
'right'
,
args
,
props
);
let
operator
=
engine
.
findVariable
(
'operator'
,
args
,
props
);
let
result
;
if
(
operator
===
'exist'
)
{
result
=
!!
leftValue
;
}
else
{
switch
(
props
.
type
)
{
case
'string'
:
leftValue
=
'"'
+
leftValue
+
'"'
;
rightValue
=
'"'
+
rightValue
+
'"'
;
break
;
case
'number'
:
leftValue
=
typeof
leftValue
===
'number'
?
leftValue
:
parseFloat
(
leftValue
);
rightValue
=
typeof
rightValue
===
'number'
?
rightValue
:
parseFloat
(
rightValue
);
break
;
case
'boolean'
:
leftValue
=
typeof
leftValue
===
'boolean'
?
leftValue
:
(
leftValue
===
'true'
?
true
:
(
leftValue
===
'false'
?
false
:
!!
leftValue
));
rightValue
=
typeof
rightValue
===
'boolean'
?
rightValue
:
(
rightValue
===
'true'
?
true
:
(
rightValue
===
'false'
?
false
:
!!
rightValue
));
break
;
}
let
func
=
new
Function
(
'return '
+
leftValue
+
operator
+
rightValue
);
result
=
func
();
}
next
(
result
?
'true'
:
'false'
);
src/process/base/compare/meta.json
View file @
57589133
...
...
@@ -2,11 +2,14 @@
"name"
:
"比较"
,
"desc"
:
"比较两个值"
,
"props"
:
{
"left"
:
{
"alias"
:
"左值"
,
"type"
:
"dynamic"
,
"default"
:
""
},
"right"
:
{
"alias"
:
"右值"
,
"type"
:
"dynamic"
,
"default"
:
""
},
"left"
:
{
"alias"
:
"左值"
,
"type"
:
"dynamic"
,
"default"
:
""
},
"right"
:
{
"alias"
:
"右值"
,
"type"
:
"dynamic"
,
"default"
:
""
},
"operator"
:
{
"alias"
:
"操作符"
,
"type"
:
"enum"
,
"enum"
:
[
"=="
,
"!="
,
"==="
,
"!=="
,
">"
,
">="
,
"<"
,
"<="
],
"default"
:
"=="
}
"enum"
:
[
"=="
,
"!="
,
"==="
,
"!=="
,
">"
,
">="
,
"<"
,
"<="
,
"exist"
],
"default"
:
"=="
},
"type"
:
{
"alias"
:
"判断类型"
,
"type"
:
"enum"
,
"enum"
:
[
"unset"
,
"string"
,
"number"
,
"boolean"
],
"default"
:
"unset"
}
},
"output"
:
[
"true"
,
"false"
...
...
src/process/base/dispatch-event/index.ts
View file @
57589133
...
...
@@ -9,4 +9,5 @@ const useCapture = engine.findVariable('useCapture', args, props);
if
(
eventName
){
engine
.
globalEvent
.
dispatchEvent
(
eventName
,
data
,
useCapture
);
}
next
(
'success'
,
args
);
src/process/base/dispatch-event/meta.json
View file @
57589133
{
"name"
:
"
发送
事件"
,
"desc"
:
"
发送
事件"
,
"name"
:
"
派发
事件"
,
"desc"
:
"
派发
事件"
,
"props"
:
{
"eventName"
:
{
"type"
:
"string"
,
...
...
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