Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (parameter.type) {
input.setCheck(typeExt(parameter.type));
}
if (parameter.label) {
input.appendField(parameter.label);
}
}
}
}
this.setInputsInline(false);
if (options.builtinQuery) {
this.setColour(290);
if (!options.selfLimiting) {
this.appendDummyInput()
.appendField("limit to first")
.appendField(new Blockly.FieldNumber(defaultLimit, 0, maxLimit), "LIMIT")
.appendField("rows");
}
} else {
if (options.baseQuery) {
this.setColour(290);
// this.appendDummyInput();
this.appendStatementInput("WHERE")
.setCheck(typeExt("GraphPattern"))
.appendField("where");
Blocks.query.orderFields.init.call(this);
this.setInputsInline(true);
} else {
this.setColour(330);
this.appendStatementInput("QUERY")
.setCheck(typeExt("SelectQuery"))
.appendField(" ⚙");
if (!limitField && queryBlock.getInput("LIMIT")) {
queryBlock.moveInputBefore(inputName, "LIMIT");
}
// queryBlock.moveInputBefore(inputName, "RESULTS");
}
if (dirFieldName) {
var dirField = new Blockly.FieldDropdown([["▲", "ASC"], ["▼", "DESC"]]);
if (oldDirValue) {
dirField.setValue(oldDirValue);
}
input.appendField(dirField, dirFieldName);
}
if (limitField) {
input.appendField(" limit to first", otherFieldNames[0])
.appendField(
new Blockly.FieldNumber(oldLimitValue || defaultLimit, 0, maxLimit),
otherFieldNames[1])
.appendField("rows", otherFieldNames[2]);
} else {
input.appendField(
index > 1 ?
(!lastOrderField || index > 2 ? ", " : "") +
(lastOrderField ? "and " : "") + "then by" :
"order by",
otherFieldNames[0]);
}
if (lastOrderField) {
setOrderField(queryBlock, index + 1, false, true);
}
};
init: function() {
this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);
this.setColour(HUE);
this.appendDummyInput()
.appendField(new Blockly.FieldNumber(0), 'NUM');
this.setOutput(true, 'LiteralNumber');
this.setTooltip(Msg.MATH_NUMBER_TOOLTIP);
}
});