Loading src/app/p_services/admin/lifeCycleManagement/service-rule-design/service-rule-design.component.html +17 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,23 @@ </shadow> </value> </block> <block type="text_replace"> <value name="STRING"> <block type="variables_get"> <field name="VAR">textVariable</field> </block> </value> <value name="SEARCH"> <shadow type="text"> <field name="TEXT">before</field> </shadow> </value> <value name="REPLACE"> <shadow type="text"> <field name="TEXT">after</field> </shadow> </value> </block> </category> Loading src/app/p_services/admin/lifeCycleManagement/services/blockly-java.service.ts +12 −0 Original line number Diff line number Diff line Loading @@ -804,6 +804,18 @@ export class BlocklyJavaService { return [argument0 + operator, Blockly.Java.ORDER_FUNCTION_CALL]; }; Blockly.Java['text_replace'] = function (block: { getFieldValue: (arg0: string) => string; }) { // Search the text for a substring. var argument0 = Blockly.Java.valueToCode(block, 'SEARCH', Blockly.Java.ORDER_NONE) || '""'; var argument1 = Blockly.Java.valueToCode(block, 'REPLACE', Blockly.Java.ORDER_NONE) || '""'; var argument2 = Blockly.Java.valueToCode(block, 'STRING', Blockly.Java.ORDER_MEMBER) || '""'; var code = argument2 + '.replace(' + argument0 + ',' + argument1 + ')'; return [code, Blockly.Java.ORDER_MEMBER]; }; Blockly.Java['text_print'] = function (block: any) { // Print statement. var argument0 = Blockly.Java.valueToCode(block, 'TEXT', Loading src/assets/blockly/custom_java_blocks.js +26 −0 Original line number Diff line number Diff line Loading @@ -706,6 +706,32 @@ Blockly.Blocks['variable_set_string'] = { customContextMenu: Blockly.Blocks['variables_get'].customContextMenu }; Blockly.Blocks['text_replace'] = { /** * Block for string replacement. * @this Blockly.Block */ init: function() { this.setStyle('text_blocks'); this.appendValueInput("STRING") .setCheck("String") .appendField("in text"); this.appendValueInput("SEARCH") .setCheck("String") .appendField("replace"); this.appendValueInput('REPLACE') .setCheck("String") .appendField("with"); this.setInputsInline(true); this.setOutput(true,'String'); this.setTooltip("Replaces all occurrences of a substring in a string with another"); }, }; Loading Loading
src/app/p_services/admin/lifeCycleManagement/service-rule-design/service-rule-design.component.html +17 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,23 @@ </shadow> </value> </block> <block type="text_replace"> <value name="STRING"> <block type="variables_get"> <field name="VAR">textVariable</field> </block> </value> <value name="SEARCH"> <shadow type="text"> <field name="TEXT">before</field> </shadow> </value> <value name="REPLACE"> <shadow type="text"> <field name="TEXT">after</field> </shadow> </value> </block> </category> Loading
src/app/p_services/admin/lifeCycleManagement/services/blockly-java.service.ts +12 −0 Original line number Diff line number Diff line Loading @@ -804,6 +804,18 @@ export class BlocklyJavaService { return [argument0 + operator, Blockly.Java.ORDER_FUNCTION_CALL]; }; Blockly.Java['text_replace'] = function (block: { getFieldValue: (arg0: string) => string; }) { // Search the text for a substring. var argument0 = Blockly.Java.valueToCode(block, 'SEARCH', Blockly.Java.ORDER_NONE) || '""'; var argument1 = Blockly.Java.valueToCode(block, 'REPLACE', Blockly.Java.ORDER_NONE) || '""'; var argument2 = Blockly.Java.valueToCode(block, 'STRING', Blockly.Java.ORDER_MEMBER) || '""'; var code = argument2 + '.replace(' + argument0 + ',' + argument1 + ')'; return [code, Blockly.Java.ORDER_MEMBER]; }; Blockly.Java['text_print'] = function (block: any) { // Print statement. var argument0 = Blockly.Java.valueToCode(block, 'TEXT', Loading
src/assets/blockly/custom_java_blocks.js +26 −0 Original line number Diff line number Diff line Loading @@ -706,6 +706,32 @@ Blockly.Blocks['variable_set_string'] = { customContextMenu: Blockly.Blocks['variables_get'].customContextMenu }; Blockly.Blocks['text_replace'] = { /** * Block for string replacement. * @this Blockly.Block */ init: function() { this.setStyle('text_blocks'); this.appendValueInput("STRING") .setCheck("String") .appendField("in text"); this.appendValueInput("SEARCH") .setCheck("String") .appendField("replace"); this.appendValueInput('REPLACE') .setCheck("String") .appendField("with"); this.setInputsInline(true); this.setOutput(true,'String'); this.setTooltip("Replaces all occurrences of a substring in a string with another"); }, }; Loading