node-red-contrib-ui_list
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -20,4 +20,7 @@ { | ||
"check" : "checkbox to send changed item" | ||
}, | ||
"error": { | ||
"no-group": "group not configured" | ||
} | ||
} | ||
} |
@@ -20,4 +20,7 @@ { | ||
"check" : "チェック状態が変化した要素を送信" | ||
}, | ||
"error": { | ||
"no-group": "グループが設定されていません" | ||
} | ||
} | ||
} |
{ | ||
"name": "node-red-contrib-ui_list", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Node-RED UI widget node for simple list", | ||
@@ -5,0 +5,0 @@ "author" : "Hiroyasu Nishiyama", |
@@ -15,2 +15,4 @@ node-red-contrib-ui_list | ||
*This node uses APIs that are supported from Node-RED 0.19 & Node-RED Dashboard 2.10.* | ||
Usage | ||
@@ -17,0 +19,0 @@ ----- |
@@ -24,2 +24,10 @@ /** | ||
function checkConfig(node, conf) { | ||
if (!conf || !conf.hasOwnProperty("group")) { | ||
node.error(RED._("ui_list.error.no-group")); | ||
return false; | ||
} | ||
return true; | ||
} | ||
function HTML(config) { | ||
@@ -79,30 +87,33 @@ var actionType = config.actionType; | ||
RED.nodes.createNode(this, config); | ||
var html = HTML(config); | ||
var done = ui.addWidget({ | ||
node: node, | ||
width: config.width, | ||
height: config.height, | ||
format: html, | ||
templateScope: "local", | ||
group: config.group, | ||
emitOnlyNewValues: false, | ||
forwardInputMessages: false, | ||
storeFrontEndInputAsState: false, | ||
convertBack: function (value) { | ||
return value; | ||
}, | ||
beforeEmit: function(msg, value) { | ||
return { msg: { items: value } }; | ||
}, | ||
beforeSend: function (msg, orig) { | ||
if (orig) { | ||
return orig.msg; | ||
var done = null; | ||
if (checkConfig(node, config)) { | ||
var html = HTML(config); | ||
done = ui.addWidget({ | ||
node: node, | ||
width: config.width, | ||
height: config.height, | ||
format: html, | ||
templateScope: "local", | ||
group: config.group, | ||
emitOnlyNewValues: false, | ||
forwardInputMessages: false, | ||
storeFrontEndInputAsState: false, | ||
convertBack: function (value) { | ||
return value; | ||
}, | ||
beforeEmit: function(msg, value) { | ||
return { msg: { items: value } }; | ||
}, | ||
beforeSend: function (msg, orig) { | ||
if (orig) { | ||
return orig.msg; | ||
} | ||
}, | ||
initController: function($scope, events) { | ||
$scope.click = function(item) { | ||
$scope.send({payload: item}); | ||
}; | ||
} | ||
}, | ||
initController: function($scope, events) { | ||
$scope.click = function(item) { | ||
$scope.send({payload: item}); | ||
}; | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -112,5 +123,9 @@ catch (e) { | ||
} | ||
node.on("close", done); | ||
node.on("close", function() { | ||
if (done) { | ||
done(); | ||
} | ||
}); | ||
} | ||
RED.nodes.registerType('ui_list', ListNode); | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85480
174
47