Add lists_sort block.

This commit is contained in:
Dan LaLiberte
2016-05-04 17:03:24 -04:00
parent 7faafe0b6d
commit c1cfec8dbd
83 changed files with 3039 additions and 2161 deletions

View File

@@ -643,6 +643,49 @@ Blockly.Blocks['lists_getSublist'] = {
}
};
Blockly.Blocks['lists_sort'] = {
/**
* Block for sorting a list.
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"id": "list_sort",
"message0": Blockly.Msg.LISTS_SORT_TITLE,
"args0": [
{
"type": "field_dropdown",
"name": "TYPE",
"options": [
[Blockly.Msg.LISTS_SORT_TYPE_NUMERIC, "NUMERIC"],
[Blockly.Msg.LISTS_SORT_TYPE_TEXT, "TEXT"],
[Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE, "IGNORE_CASE"]
]
},
{
"type": "field_dropdown",
"name": "DIRECTION",
"options": [
[Blockly.Msg.LISTS_SORT_ORDER_ASCENDING, "1"],
[Blockly.Msg.LISTS_SORT_ORDER_DESCENDING, "-1"]
]
},
{
"type": "input_value",
"name": "LIST",
"check": "Array"
}
],
//"previousStatement": null,
//"nextStatement": null,
"output": "Array",
"colour": Blockly.Blocks.lists.HUE,
"tooltip": Blockly.Msg.LISTS_SORT_TOOLTIP,
"helpUrl": Blockly.Msg.LISTS_SORT_HELPURL
});
}
};
Blockly.Blocks['lists_split'] = {
/**
* Block for splitting text into a list, or joining a list into text.