@srikanthsai27/afrisure-blockly-expression 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Input, Component, EventEmitter, Output, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import * as Blockly from 'blockly/core';
|
|
5
|
+
import 'blockly/blocks';
|
|
6
|
+
import { javascriptGenerator, Order } from 'blockly/javascript';
|
|
7
|
+
import * as En from 'blockly/msg/en';
|
|
8
|
+
import { ContinuousMetrics, ContinuousFlyout } from '@blockly/continuous-toolbox';
|
|
9
|
+
import '@blockly/toolbox-search';
|
|
10
|
+
import * as i2$1 from '@angular/material/dialog';
|
|
11
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
12
|
+
import { ZoomToFitControl } from '@blockly/zoom-to-fit';
|
|
13
|
+
import { CommonModule } from '@angular/common';
|
|
14
|
+
import * as i3 from '@angular/material/button';
|
|
15
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
16
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
+
import * as i4 from '@ngx-translate/core';
|
|
18
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
19
|
+
import * as i1 from '@angular/material/card';
|
|
20
|
+
import { MatCardModule } from '@angular/material/card';
|
|
21
|
+
import * as i2 from '@angular/material/divider';
|
|
22
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
23
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
24
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
25
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
26
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
27
|
+
import { MatInputModule } from '@angular/material/input';
|
|
28
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
29
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
30
|
+
import { MatSliderModule } from '@angular/material/slider';
|
|
31
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
32
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
33
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
34
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
35
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
36
|
+
import { MatGridListModule } from '@angular/material/grid-list';
|
|
37
|
+
import { MatListModule } from '@angular/material/list';
|
|
38
|
+
import { MatStepperModule } from '@angular/material/stepper';
|
|
39
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
|
40
|
+
import { MatTreeModule } from '@angular/material/tree';
|
|
41
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
42
|
+
import { MatBadgeModule } from '@angular/material/badge';
|
|
43
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
44
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
45
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
46
|
+
import { MatRippleModule } from '@angular/material/core';
|
|
47
|
+
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
|
|
48
|
+
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
49
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
50
|
+
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
51
|
+
import { MatSortModule } from '@angular/material/sort';
|
|
52
|
+
import { MatTableModule } from '@angular/material/table';
|
|
53
|
+
import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core';
|
|
54
|
+
import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment';
|
|
55
|
+
|
|
56
|
+
class LoaderService {
|
|
57
|
+
constructor() {
|
|
58
|
+
this._loading$ = new Subject();
|
|
59
|
+
this.loading$ = this._loading$.asObservable();
|
|
60
|
+
this._loadingCnt$ = new Subject();
|
|
61
|
+
this.loadingCnt$ = this._loadingCnt$.asObservable();
|
|
62
|
+
this._excelLoadingCnt$ = new Subject();
|
|
63
|
+
this.excelLoadingCnt$ = this._excelLoadingCnt$.asObservable();
|
|
64
|
+
}
|
|
65
|
+
show() {
|
|
66
|
+
this._loading$.next(true);
|
|
67
|
+
}
|
|
68
|
+
hide() {
|
|
69
|
+
this._loading$.next(false);
|
|
70
|
+
}
|
|
71
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: LoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
72
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: LoaderService, providedIn: 'root' }); }
|
|
73
|
+
}
|
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: LoaderService, decorators: [{
|
|
75
|
+
type: Injectable,
|
|
76
|
+
args: [{
|
|
77
|
+
providedIn: 'root'
|
|
78
|
+
}]
|
|
79
|
+
}] });
|
|
80
|
+
|
|
81
|
+
class PopUpTemplate {
|
|
82
|
+
constructor() { }
|
|
83
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PopUpTemplate, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
84
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: PopUpTemplate, isStandalone: true, selector: "app-pop-up-template", inputs: { isTitle: "isTitle" }, ngImport: i0, template: "<mat-card class=\"container-fluid shadow-none \">\r\n <div class=\"p-16 pt-4\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n\r\n <mat-card-title><ng-content select=\"[Ctitle]\"></ng-content></mat-card-title>\r\n\r\n <ng-content select=\"[closeButton]\"></ng-content>\r\n </div>\r\n\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n\r\n\r\n\r\n <ng-content select=\"[output]\"></ng-content>\r\n</mat-card>", styles: [""], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }] }); }
|
|
85
|
+
}
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: PopUpTemplate, decorators: [{
|
|
87
|
+
type: Component,
|
|
88
|
+
args: [{ selector: 'app-pop-up-template', standalone: true, imports: [MatCardModule, MatDividerModule], template: "<mat-card class=\"container-fluid shadow-none \">\r\n <div class=\"p-16 pt-4\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n\r\n <mat-card-title><ng-content select=\"[Ctitle]\"></ng-content></mat-card-title>\r\n\r\n <ng-content select=\"[closeButton]\"></ng-content>\r\n </div>\r\n\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n\r\n\r\n\r\n <ng-content select=\"[output]\"></ng-content>\r\n</mat-card>" }]
|
|
89
|
+
}], ctorParameters: () => [], propDecorators: { isTitle: [{
|
|
90
|
+
type: Input
|
|
91
|
+
}] } });
|
|
92
|
+
|
|
93
|
+
class BlocklyExpression {
|
|
94
|
+
constructor(loader, dialogRef, data) {
|
|
95
|
+
this.loader = loader;
|
|
96
|
+
this.dialogRef = dialogRef;
|
|
97
|
+
this.data = data;
|
|
98
|
+
this.variableList = [];
|
|
99
|
+
this.errorMessage = '';
|
|
100
|
+
this.exportedExpression = '';
|
|
101
|
+
this.generatedCode = '';
|
|
102
|
+
this.code = '';
|
|
103
|
+
this.lookupList = [];
|
|
104
|
+
this.workspace = null;
|
|
105
|
+
this.InputBlockyExpression = [];
|
|
106
|
+
this.outputResponse = new EventEmitter();
|
|
107
|
+
this.maxCountList = this.createMaxCountList(100);
|
|
108
|
+
}
|
|
109
|
+
ngOnInit() {
|
|
110
|
+
console.log(this.data.InputBlockyExpression.lookup);
|
|
111
|
+
this.loader.show();
|
|
112
|
+
console.log(this.InputBlockyExpression);
|
|
113
|
+
this.variableList = this.InputBlockyExpression.lookup || [];
|
|
114
|
+
}
|
|
115
|
+
createMaxCountList(maxCount) {
|
|
116
|
+
let maxCountList = [];
|
|
117
|
+
for (let i = 2; i <= maxCount; i++) {
|
|
118
|
+
maxCountList.push([i.toString(), i.toString()]);
|
|
119
|
+
}
|
|
120
|
+
return maxCountList;
|
|
121
|
+
}
|
|
122
|
+
generateExpressionFromBlocklyJson(jsonString) {
|
|
123
|
+
const workspaceState = JSON.parse(jsonString);
|
|
124
|
+
const blocks = workspaceState?.blocks?.blocks;
|
|
125
|
+
const blockMap = new Map();
|
|
126
|
+
blocks.forEach((block) => addBlocksToMap(block));
|
|
127
|
+
function addBlocksToMap(block) {
|
|
128
|
+
blockMap.set(block.id, block);
|
|
129
|
+
Object.values(block.inputs || {}).forEach((input) => {
|
|
130
|
+
if (input.block) {
|
|
131
|
+
addBlocksToMap(input.block);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function processBlock(blockId) {
|
|
136
|
+
const block = blockMap.get(blockId);
|
|
137
|
+
if (!block) {
|
|
138
|
+
return '';
|
|
139
|
+
}
|
|
140
|
+
switch (block.type) {
|
|
141
|
+
case 'math_addition':
|
|
142
|
+
case 'math_subtraction':
|
|
143
|
+
case 'math_division':
|
|
144
|
+
case 'math_max':
|
|
145
|
+
case 'math_min':
|
|
146
|
+
case 'math_multiplication':
|
|
147
|
+
return processOperationBlock(block);
|
|
148
|
+
case 'variables_get_dynamic':
|
|
149
|
+
return block.fields.VAR.id;
|
|
150
|
+
case 'example_number':
|
|
151
|
+
return block.fields.FIELDNAME ? block.fields.FIELDNAME : '0';
|
|
152
|
+
case 'example_string':
|
|
153
|
+
return `'${block.fields.FIELDNAME}'`;
|
|
154
|
+
case 'controls_if':
|
|
155
|
+
return processIfBlock(block);
|
|
156
|
+
case 'controls_ifelse':
|
|
157
|
+
return processIfElseBlock(block);
|
|
158
|
+
case 'logic_compare':
|
|
159
|
+
return processLogicCompareBlock(block);
|
|
160
|
+
case 'logic_boolean':
|
|
161
|
+
return processLogicBooleanBlock(block);
|
|
162
|
+
case 'variables_set_dynamic':
|
|
163
|
+
return processVariablesSetBlock(block);
|
|
164
|
+
default:
|
|
165
|
+
return '';
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function processLogicBooleanBlock(block) {
|
|
169
|
+
return block.fields.BOOL === 'TRUE' ? 'true' : 'false';
|
|
170
|
+
}
|
|
171
|
+
function processIfBlock(block) {
|
|
172
|
+
let code = '';
|
|
173
|
+
const elseifCount = block.extraState ? block.extraState.elseIfCount : 0;
|
|
174
|
+
const hasElse = block.extraState ? block.extraState.hasElse : false;
|
|
175
|
+
// Process IF condition
|
|
176
|
+
if (block?.inputs != null) {
|
|
177
|
+
const ifCondition = processBlock(block?.inputs['IF0'].block?.id);
|
|
178
|
+
const ifStatement = processBlock(block?.inputs['DO0'].block?.id);
|
|
179
|
+
code += `if (${ifCondition}) { ${ifStatement} }`;
|
|
180
|
+
// Process ELSE-IF conditions
|
|
181
|
+
for (let i = 1; i <= elseifCount; i++) {
|
|
182
|
+
const elseifCondition = processBlock(block?.inputs[`IF${i}`].block?.id);
|
|
183
|
+
const elseifStatement = processBlock(block?.inputs[`DO${i}`].block?.id);
|
|
184
|
+
code += ` else if (${elseifCondition}) { ${elseifStatement} }`;
|
|
185
|
+
}
|
|
186
|
+
// Process ELSE condition
|
|
187
|
+
if (hasElse) {
|
|
188
|
+
const elseStatement = processBlock(block?.inputs['ELSE'].block?.id);
|
|
189
|
+
code += ` else { ${elseStatement} }`;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return code;
|
|
193
|
+
}
|
|
194
|
+
function processIfElseBlock(block) {
|
|
195
|
+
const condition = getBlockInputValue(block, 'IF0');
|
|
196
|
+
const doBranch = getBlockStatementValue(block, 'DO0');
|
|
197
|
+
const elseBranch = getBlockStatementValue(block, 'ELSE');
|
|
198
|
+
return `if (${condition}) { ${doBranch} } else { ${elseBranch} }`;
|
|
199
|
+
}
|
|
200
|
+
function processLogicCompareBlock(block) {
|
|
201
|
+
const operandA = processBlock(block.inputs['A'].block.id);
|
|
202
|
+
const operandB = processBlock(block.inputs['B'].block.id);
|
|
203
|
+
let operatorSymbol;
|
|
204
|
+
switch (block.fields.OP) {
|
|
205
|
+
case 'EQ':
|
|
206
|
+
operatorSymbol = '==';
|
|
207
|
+
break;
|
|
208
|
+
case 'NEQ':
|
|
209
|
+
operatorSymbol = '!=';
|
|
210
|
+
break;
|
|
211
|
+
case 'LT':
|
|
212
|
+
operatorSymbol = '<';
|
|
213
|
+
break;
|
|
214
|
+
case 'LTE':
|
|
215
|
+
operatorSymbol = '<=';
|
|
216
|
+
break;
|
|
217
|
+
case 'GT':
|
|
218
|
+
operatorSymbol = '>';
|
|
219
|
+
break;
|
|
220
|
+
case 'GTE':
|
|
221
|
+
operatorSymbol = '>=';
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
operatorSymbol = '=='; // Default case or throw an error
|
|
225
|
+
}
|
|
226
|
+
return `${operandA} ${operatorSymbol} ${operandB}`;
|
|
227
|
+
}
|
|
228
|
+
function processVariablesSetBlock(block) {
|
|
229
|
+
// Process the variables set block, for example:
|
|
230
|
+
const variableName = block.fields.VAR.id; // Adjust based on your Blockly setup
|
|
231
|
+
const value = processBlock(block.inputs['VALUE'].block.id);
|
|
232
|
+
return `${variableName} = ${value}`;
|
|
233
|
+
}
|
|
234
|
+
function getBlockInputValue(block, inputName) {
|
|
235
|
+
if (block?.inputs[inputName]?.block) {
|
|
236
|
+
return processBlock(block.inputs[inputName].block.id);
|
|
237
|
+
}
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
240
|
+
function getBlockStatementValue(block, statementName) {
|
|
241
|
+
// Check if the block has statements and the specific statement
|
|
242
|
+
if (block?.statements[statementName]) {
|
|
243
|
+
const statementBlockId = block?.statements[statementName]?.block?.id;
|
|
244
|
+
if (statementBlockId) {
|
|
245
|
+
return processBlock(statementBlockId);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
250
|
+
function processStatementInput(block, statementName) {
|
|
251
|
+
if (block?.inputs[statementName]?.block) {
|
|
252
|
+
return processBlock(block.inputs[statementName].block.id);
|
|
253
|
+
}
|
|
254
|
+
return '';
|
|
255
|
+
}
|
|
256
|
+
function processOperationBlock(block) {
|
|
257
|
+
const numFields = parseInt(block.fields.NUM_FIELDS) || 2; // Default to 2 if not specified
|
|
258
|
+
let operationSymbol = '';
|
|
259
|
+
let operationFunction = '';
|
|
260
|
+
switch (block.type) {
|
|
261
|
+
case 'math_addition':
|
|
262
|
+
operationSymbol = ' + ';
|
|
263
|
+
break;
|
|
264
|
+
case 'math_subtraction':
|
|
265
|
+
operationSymbol = ' - ';
|
|
266
|
+
break;
|
|
267
|
+
case 'math_division':
|
|
268
|
+
operationSymbol = ' / ';
|
|
269
|
+
break;
|
|
270
|
+
case 'math_max':
|
|
271
|
+
operationFunction = 'Math.max';
|
|
272
|
+
break;
|
|
273
|
+
case 'math_min': // Handling math_min operation
|
|
274
|
+
operationFunction = 'Math.min';
|
|
275
|
+
break;
|
|
276
|
+
case 'math_multiplication':
|
|
277
|
+
operationSymbol = ' * ';
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
let inputValues = [];
|
|
281
|
+
for (let i = 0; i < numFields; i++) {
|
|
282
|
+
const inputName = getInputName(block.type, i);
|
|
283
|
+
if (block?.inputs != null) {
|
|
284
|
+
const value = block?.inputs[inputName]?.block
|
|
285
|
+
? processBlock(block?.inputs[inputName].block.id)
|
|
286
|
+
: '0';
|
|
287
|
+
inputValues.push(value);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (operationFunction) {
|
|
291
|
+
return `${operationFunction}(${inputValues.join(', ')})`;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
return `(${inputValues.join(operationSymbol)})`;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function getInputName(blockType, index) {
|
|
298
|
+
const prefixMap = {
|
|
299
|
+
math_addition: 'ADD',
|
|
300
|
+
math_subtraction: 'SUB',
|
|
301
|
+
math_division: 'DIV',
|
|
302
|
+
math_max: 'NUM',
|
|
303
|
+
math_min: 'NUM',
|
|
304
|
+
math_multiplication: 'MUL',
|
|
305
|
+
};
|
|
306
|
+
return `${prefixMap[blockType] || 'INPUT'}${index}`;
|
|
307
|
+
}
|
|
308
|
+
if (blocks.length > 0) {
|
|
309
|
+
return processBlock(blocks[0].id);
|
|
310
|
+
}
|
|
311
|
+
return '';
|
|
312
|
+
}
|
|
313
|
+
ExtractWorkspace() {
|
|
314
|
+
const state = Blockly.serialization.workspaces.save(this.workspace);
|
|
315
|
+
const stateStrJSON = JSON.stringify(state);
|
|
316
|
+
const code = javascriptGenerator.workspaceToCode(this.workspace);
|
|
317
|
+
const lines = code.split('\n');
|
|
318
|
+
if (lines.length > 2) {
|
|
319
|
+
lines.splice(0, 2);
|
|
320
|
+
}
|
|
321
|
+
this.code = lines.join('\n');
|
|
322
|
+
this.exportedExpression = this.generateExpressionFromBlocklyJson(stateStrJSON);
|
|
323
|
+
}
|
|
324
|
+
LoadBlockExpression() {
|
|
325
|
+
const tempJSON = this.blockExpressionJSON.loadexpression;
|
|
326
|
+
// dont remove this code this is for parameter validation
|
|
327
|
+
// if (tempJSON) {
|
|
328
|
+
// let parseTempJSON = tempJSON ? JSON.parse(tempJSON) : []
|
|
329
|
+
// let variables = parseTempJSON?.variables ?? [];
|
|
330
|
+
// let lookup = this.data.InputBlockyExpression.lookup ?? []
|
|
331
|
+
// let missingVariables = variables.filter(variable =>
|
|
332
|
+
// !lookup.some(lookupItem => lookupItem.id === variable.id)
|
|
333
|
+
// );
|
|
334
|
+
// console.log(missingVariables)
|
|
335
|
+
// if (missingVariables.length > 0) {
|
|
336
|
+
// let missingDetailsArray = missingVariables.map(variable => ({ id: variable.id, name: variable.name }));
|
|
337
|
+
// console.log(missingDetailsArray);
|
|
338
|
+
// const dialogRef = this.dialog.open(MatDialogComponent, {
|
|
339
|
+
// panelClass: ['dialog-responsive'],
|
|
340
|
+
// width: '60vw',
|
|
341
|
+
// disableClose: true,
|
|
342
|
+
// data: {
|
|
343
|
+
// yesOrNoPopupBlockly: true, errorMessage: missingDetailsArray
|
|
344
|
+
// }
|
|
345
|
+
// });
|
|
346
|
+
// dialogRef.afterClosed().subscribe((res) => {
|
|
347
|
+
// if (!res) {
|
|
348
|
+
// // Blockly.serialization.workspaces.load(JSON.parse(tempJSON), this.workspace);
|
|
349
|
+
// } else {
|
|
350
|
+
// this.goBack()
|
|
351
|
+
// }
|
|
352
|
+
// });
|
|
353
|
+
// } else {
|
|
354
|
+
// Blockly.serialization.workspaces.load(JSON.parse(tempJSON), this.workspace);
|
|
355
|
+
// }
|
|
356
|
+
// }
|
|
357
|
+
if (tempJSON) {
|
|
358
|
+
let parseVal = JSON.parse(tempJSON);
|
|
359
|
+
// this condition for while edit already send parmeters if not there in new parameter list that will remove here changes by gowtham
|
|
360
|
+
let parseValD = parseVal?.variables?.filter(item => this.variableList.some(main => main.id === item.id));
|
|
361
|
+
parseVal['variables'] = parseValD;
|
|
362
|
+
Blockly.serialization.workspaces.load(parseVal, this.workspace);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
ngAfterViewInit() {
|
|
366
|
+
window['maxCountList'] = this.maxCountList;
|
|
367
|
+
Blockly.setLocale(En);
|
|
368
|
+
this.DefineBlocklyCustomBlocks();
|
|
369
|
+
this.DefineBlocklyCustomJavascript();
|
|
370
|
+
const toolboxCategories = {
|
|
371
|
+
kind: 'categoryToolbox',
|
|
372
|
+
contents: [
|
|
373
|
+
{
|
|
374
|
+
'kind': 'search',
|
|
375
|
+
'name': 'Search',
|
|
376
|
+
'contents': [],
|
|
377
|
+
},
|
|
378
|
+
/* {
|
|
379
|
+
"kind": "category",
|
|
380
|
+
"name": "Control",
|
|
381
|
+
"contents": [
|
|
382
|
+
{
|
|
383
|
+
"kind": "block",
|
|
384
|
+
"type": "controls_if"
|
|
385
|
+
},
|
|
386
|
+
]
|
|
387
|
+
}, */
|
|
388
|
+
{
|
|
389
|
+
kind: 'category',
|
|
390
|
+
name: 'Logical',
|
|
391
|
+
contents: [
|
|
392
|
+
{
|
|
393
|
+
kind: 'block',
|
|
394
|
+
type: 'controls_if',
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
kind: 'block',
|
|
398
|
+
type: 'logic_compare',
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
kind: 'block',
|
|
402
|
+
type: 'logic_operation',
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
kind: 'block',
|
|
406
|
+
type: 'logic_boolean',
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
kind: 'block',
|
|
410
|
+
type: 'return_statement',
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
kind: 'block',
|
|
414
|
+
type: 'math_arithmetic',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
kind: 'block',
|
|
418
|
+
type: 'math_number',
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
kind: 'block',
|
|
422
|
+
type: 'math_single',
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
kind: 'block',
|
|
426
|
+
type: 'math_constant',
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
kind: 'block',
|
|
430
|
+
type: 'math_number_property',
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
kind: 'block',
|
|
434
|
+
type: 'math_change',
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
kind: 'block',
|
|
438
|
+
type: 'math_round',
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
kind: 'block',
|
|
442
|
+
type: 'math_on_list',
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
kind: 'block',
|
|
446
|
+
type: 'math_arithmetic_multiple',
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
kind: 'category',
|
|
452
|
+
name: 'Math',
|
|
453
|
+
contents: [
|
|
454
|
+
{
|
|
455
|
+
kind: 'block',
|
|
456
|
+
name: 'Math.Addition',
|
|
457
|
+
type: 'math_addition',
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
kind: 'block',
|
|
461
|
+
name: 'Math.Subtraction',
|
|
462
|
+
type: 'math_subtraction',
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
kind: 'block',
|
|
466
|
+
name: 'Math.Multiplication',
|
|
467
|
+
type: 'math_multiplication',
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
kind: 'block',
|
|
471
|
+
name: 'Math.Division',
|
|
472
|
+
type: 'math_division',
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
kind: 'block',
|
|
476
|
+
name: 'Math.Max',
|
|
477
|
+
type: 'math_max',
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
kind: 'block',
|
|
481
|
+
name: 'Math.Min',
|
|
482
|
+
type: 'math_min',
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
kind: 'category',
|
|
488
|
+
name: 'Value',
|
|
489
|
+
contents: [
|
|
490
|
+
{
|
|
491
|
+
kind: 'block',
|
|
492
|
+
name: 'example_number',
|
|
493
|
+
type: 'example_number',
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
kind: 'block',
|
|
497
|
+
name: 'example_string',
|
|
498
|
+
type: 'example_string',
|
|
499
|
+
},
|
|
500
|
+
],
|
|
501
|
+
},
|
|
502
|
+
/* {
|
|
503
|
+
"kind": "category",
|
|
504
|
+
"name": "Variables",
|
|
505
|
+
"custom": "VARIABLE"
|
|
506
|
+
}, */
|
|
507
|
+
{
|
|
508
|
+
kind: 'category',
|
|
509
|
+
name: 'LookUps',
|
|
510
|
+
custom: 'VARIABLE_DYNAMIC',
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
kind: 'category',
|
|
514
|
+
name: 'Functions',
|
|
515
|
+
custom: 'PROCEDURE',
|
|
516
|
+
},
|
|
517
|
+
// {
|
|
518
|
+
// 'kind': 'search',
|
|
519
|
+
// 'name': 'Search',
|
|
520
|
+
// 'contents': [],
|
|
521
|
+
// }
|
|
522
|
+
],
|
|
523
|
+
};
|
|
524
|
+
this.workspace = Blockly.inject('blocklyDiv', {
|
|
525
|
+
plugins: {
|
|
526
|
+
// toolbox: ContinuousToolbox,
|
|
527
|
+
flyoutsVerticalToolbox: ContinuousFlyout,
|
|
528
|
+
metricsManager: ContinuousMetrics
|
|
529
|
+
},
|
|
530
|
+
toolbox: toolboxCategories,
|
|
531
|
+
zoom: {
|
|
532
|
+
controls: true,
|
|
533
|
+
},
|
|
534
|
+
});
|
|
535
|
+
// Initialize plugin.
|
|
536
|
+
const zoomToFit = new ZoomToFitControl(this.workspace);
|
|
537
|
+
zoomToFit.init();
|
|
538
|
+
this.loader.show();
|
|
539
|
+
setTimeout(() => {
|
|
540
|
+
this.InputBlockyExpression = this.data.InputBlockyExpression || [];
|
|
541
|
+
this.variableList = this.InputBlockyExpression.lookup || [];
|
|
542
|
+
this.blockExpressionJSON = this.InputBlockyExpression.blockExpressionJSON || [];
|
|
543
|
+
this.createVariables();
|
|
544
|
+
this.LoadBlockExpression();
|
|
545
|
+
this.loader.hide();
|
|
546
|
+
});
|
|
547
|
+
this.createLookupVariables();
|
|
548
|
+
}
|
|
549
|
+
DefineBlocklyCustomBlocks() {
|
|
550
|
+
Blockly.Blocks['math_add_container'] = {
|
|
551
|
+
init: function () {
|
|
552
|
+
this.appendDummyInput().appendField('add numbers');
|
|
553
|
+
this.appendStatementInput('STACK');
|
|
554
|
+
this.setColour(230);
|
|
555
|
+
this.contextMenu = false;
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
Blockly.Blocks['math_addition'] = {
|
|
559
|
+
init: function () {
|
|
560
|
+
const maxCountList = window['maxCountList'] || [['2', '2']];
|
|
561
|
+
this.appendDummyInput().appendField('Add');
|
|
562
|
+
// Dropdown to choose the number of addition inputs
|
|
563
|
+
this.appendDummyInput().appendField(new Blockly.FieldDropdown(maxCountList, this.updateFields_.bind(this)), 'NUM_FIELDS');
|
|
564
|
+
// Initial addition fields
|
|
565
|
+
this.appendValueInput('ADD0').setCheck('Number');
|
|
566
|
+
this.appendValueInput('ADD1').setCheck('Number');
|
|
567
|
+
this.setInputsInline(true);
|
|
568
|
+
this.setOutput(true, 'Number');
|
|
569
|
+
this.setColour(230);
|
|
570
|
+
this.itemCount_ = 2;
|
|
571
|
+
},
|
|
572
|
+
// Function to update the number of input fields
|
|
573
|
+
updateFields_: function (newValue) {
|
|
574
|
+
let newCount = parseInt(newValue);
|
|
575
|
+
while (this.itemCount_ < newCount) {
|
|
576
|
+
this.appendValueInput('ADD' + this.itemCount_).setCheck('Number');
|
|
577
|
+
this.itemCount_++;
|
|
578
|
+
}
|
|
579
|
+
while (this.itemCount_ > newCount) {
|
|
580
|
+
this.removeInput('ADD' + (this.itemCount_ - 1));
|
|
581
|
+
this.itemCount_--;
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
mutationToDom: function () {
|
|
585
|
+
let container = Blockly.utils.xml.createElement('mutation');
|
|
586
|
+
container.setAttribute('items', this.itemCount_);
|
|
587
|
+
return container;
|
|
588
|
+
},
|
|
589
|
+
domToMutation: function (xmlElement) {
|
|
590
|
+
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
|
591
|
+
this.updateShape_();
|
|
592
|
+
},
|
|
593
|
+
decompose: function (workspace) {
|
|
594
|
+
let containerBlock = workspace.newBlock('math_add_container');
|
|
595
|
+
containerBlock.initSvg();
|
|
596
|
+
let connection = containerBlock.getInput('STACK').connection;
|
|
597
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
598
|
+
let itemBlock = workspace.newBlock('math_add_item');
|
|
599
|
+
itemBlock.initSvg();
|
|
600
|
+
connection.connect(itemBlock.previousConnection);
|
|
601
|
+
connection = itemBlock.nextConnection;
|
|
602
|
+
}
|
|
603
|
+
return containerBlock;
|
|
604
|
+
},
|
|
605
|
+
compose: function (containerBlock) {
|
|
606
|
+
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
607
|
+
// Count number of inputs.
|
|
608
|
+
let connections = [];
|
|
609
|
+
while (itemBlock) {
|
|
610
|
+
connections.push(itemBlock.valueConnection_);
|
|
611
|
+
itemBlock = itemBlock?.nextConnection?.targetBlock();
|
|
612
|
+
}
|
|
613
|
+
// Disconnect any children that don't belong.
|
|
614
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
615
|
+
let connection = this.getInput('ADD' + i).connection.targetConnection;
|
|
616
|
+
if (connection && connections.indexOf(connection) === -1) {
|
|
617
|
+
connection.disconnect();
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
this.itemCount_ = connections.length;
|
|
621
|
+
this.updateShape_();
|
|
622
|
+
// Reconnect any child blocks.
|
|
623
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
624
|
+
connections[i].reconnect(this, 'ADD' + i);
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
saveConnections: function (containerBlock) {
|
|
628
|
+
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
629
|
+
let i = 0;
|
|
630
|
+
while (itemBlock) {
|
|
631
|
+
let input = this.getInput('ADD' + i);
|
|
632
|
+
itemBlock.valueConnection_ = input?.connection?.targetConnection;
|
|
633
|
+
i++;
|
|
634
|
+
itemBlock = itemBlock?.nextConnection?.targetBlock();
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
updateShape_: function () {
|
|
638
|
+
// Adjust inputs.
|
|
639
|
+
// for (let i = 0; i < this.itemCount_; i++) {
|
|
640
|
+
// if (!this.getInput('ADD' + i)) {
|
|
641
|
+
// this.appendValueInput('ADD' + i).setCheck('Number');
|
|
642
|
+
// }
|
|
643
|
+
// }
|
|
644
|
+
// // Remove deleted inputs.
|
|
645
|
+
// while (this.getInput('ADD' + i)) {
|
|
646
|
+
// this.removeInput('ADD' + i);
|
|
647
|
+
// i++;
|
|
648
|
+
// }
|
|
649
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
650
|
+
if (!this.getInput('ADD' + i)) {
|
|
651
|
+
this.appendValueInput('ADD' + i).setCheck('Number');
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
// Remove deleted inputs.
|
|
655
|
+
let j = this.itemCount_;
|
|
656
|
+
while (this.getInput('ADD' + j)) {
|
|
657
|
+
this.removeInput('ADD' + j);
|
|
658
|
+
j++;
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
};
|
|
662
|
+
Blockly.Blocks['math_subtraction'] = {
|
|
663
|
+
init: function () {
|
|
664
|
+
const maxCountList = window['maxCountList'] || [['2', '2']];
|
|
665
|
+
this.appendDummyInput().appendField('Subtract');
|
|
666
|
+
this.appendDummyInput().appendField(new Blockly.FieldDropdown(maxCountList, this.updateFields_.bind(this)), 'NUM_FIELDS');
|
|
667
|
+
this.appendValueInput('SUB0').setCheck('Number');
|
|
668
|
+
this.appendValueInput('SUB1').setCheck('Number');
|
|
669
|
+
this.setInputsInline(true);
|
|
670
|
+
this.setOutput(true, 'Number');
|
|
671
|
+
this.setColour(230);
|
|
672
|
+
this.itemCount_ = 2;
|
|
673
|
+
},
|
|
674
|
+
updateFields_: function (newValue) {
|
|
675
|
+
let newCount = parseInt(newValue);
|
|
676
|
+
while (this.itemCount_ < newCount) {
|
|
677
|
+
this.appendValueInput('SUB' + this.itemCount_).setCheck('Number');
|
|
678
|
+
this.itemCount_++;
|
|
679
|
+
}
|
|
680
|
+
while (this.itemCount_ > newCount) {
|
|
681
|
+
this.removeInput('SUB' + (this.itemCount_ - 1));
|
|
682
|
+
this.itemCount_--;
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
};
|
|
686
|
+
Blockly.Blocks['math_multiplication'] = {
|
|
687
|
+
init: function () {
|
|
688
|
+
const maxCountList = window['maxCountList'] || [['2', '2']];
|
|
689
|
+
this.appendDummyInput().appendField('Multiply');
|
|
690
|
+
this.appendDummyInput().appendField(new Blockly.FieldDropdown(maxCountList, this.updateFields_.bind(this)), 'NUM_FIELDS');
|
|
691
|
+
this.appendValueInput('MUL0').setCheck('Number');
|
|
692
|
+
this.appendValueInput('MUL1').setCheck('Number');
|
|
693
|
+
this.setInputsInline(true);
|
|
694
|
+
this.setOutput(true, 'Number');
|
|
695
|
+
this.setColour(230);
|
|
696
|
+
this.itemCount_ = 2;
|
|
697
|
+
},
|
|
698
|
+
updateFields_: function (newValue) {
|
|
699
|
+
let newCount = parseInt(newValue);
|
|
700
|
+
while (this.itemCount_ < newCount) {
|
|
701
|
+
this.appendValueInput('MUL' + this.itemCount_).setCheck('Number');
|
|
702
|
+
this.itemCount_++;
|
|
703
|
+
}
|
|
704
|
+
while (this.itemCount_ > newCount) {
|
|
705
|
+
this.removeInput('MUL' + (this.itemCount_ - 1));
|
|
706
|
+
this.itemCount_--;
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
};
|
|
710
|
+
Blockly.Blocks['math_max'] = {
|
|
711
|
+
init: function () {
|
|
712
|
+
const maxCountList = window['maxCountList'] || [['2', '2']];
|
|
713
|
+
this.appendDummyInput().appendField('Max');
|
|
714
|
+
this.appendDummyInput().appendField(new Blockly.FieldDropdown(maxCountList, this.updateFields_.bind(this)), 'NUM_FIELDS');
|
|
715
|
+
this.appendValueInput('NUM0').setCheck('Number');
|
|
716
|
+
this.appendValueInput('NUM1').setCheck('Number');
|
|
717
|
+
this.setInputsInline(true);
|
|
718
|
+
this.setOutput(true, 'Number');
|
|
719
|
+
this.setColour(230);
|
|
720
|
+
this.itemCount_ = 2;
|
|
721
|
+
},
|
|
722
|
+
updateFields_: function (newValue) {
|
|
723
|
+
let newCount = parseInt(newValue);
|
|
724
|
+
while (this.itemCount_ < newCount) {
|
|
725
|
+
this.appendValueInput('NUM' + this.itemCount_).setCheck('Number');
|
|
726
|
+
this.itemCount_++;
|
|
727
|
+
}
|
|
728
|
+
while (this.itemCount_ > newCount) {
|
|
729
|
+
this.removeInput('NUM' + (this.itemCount_ - 1));
|
|
730
|
+
this.itemCount_--;
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
};
|
|
734
|
+
Blockly.Blocks['math_min'] = {
|
|
735
|
+
init: function () {
|
|
736
|
+
const maxCountList = window['maxCountList'] || [['2', '2']];
|
|
737
|
+
this.appendDummyInput().appendField('Min');
|
|
738
|
+
this.appendDummyInput().appendField(new Blockly.FieldDropdown(maxCountList, this.updateFields_.bind(this)), 'NUM_FIELDS');
|
|
739
|
+
this.appendValueInput('NUM0').setCheck('Number');
|
|
740
|
+
this.appendValueInput('NUM1').setCheck('Number');
|
|
741
|
+
this.setInputsInline(true);
|
|
742
|
+
this.setOutput(true, 'Number');
|
|
743
|
+
this.setColour(230);
|
|
744
|
+
this.itemCount_ = 2;
|
|
745
|
+
},
|
|
746
|
+
updateFields_: function (newValue) {
|
|
747
|
+
let newCount = parseInt(newValue);
|
|
748
|
+
while (this.itemCount_ < newCount) {
|
|
749
|
+
this.appendValueInput('NUM' + this.itemCount_).setCheck('Number');
|
|
750
|
+
this.itemCount_++;
|
|
751
|
+
}
|
|
752
|
+
while (this.itemCount_ > newCount) {
|
|
753
|
+
this.removeInput('NUM' + (this.itemCount_ - 1));
|
|
754
|
+
this.itemCount_--;
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
};
|
|
758
|
+
Blockly.Blocks['math_division'] = {
|
|
759
|
+
init: function () {
|
|
760
|
+
this.appendDummyInput().appendField('Divide');
|
|
761
|
+
// Access the global variable or service
|
|
762
|
+
const maxCountList = window['maxCountList'] || [['2', '2']];
|
|
763
|
+
this.appendDummyInput().appendField(new Blockly.FieldDropdown(maxCountList, this.updateFields_.bind(this)), 'NUM_FIELDS');
|
|
764
|
+
this.appendValueInput('DIV0').setCheck('Number');
|
|
765
|
+
this.appendValueInput('DIV1').setCheck('Number');
|
|
766
|
+
this.setInputsInline(true);
|
|
767
|
+
this.setOutput(true, 'Number');
|
|
768
|
+
this.setColour(230);
|
|
769
|
+
this.itemCount_ = 2;
|
|
770
|
+
},
|
|
771
|
+
updateFields_: function (newValue) {
|
|
772
|
+
let newCount = parseInt(newValue);
|
|
773
|
+
while (this.itemCount_ < newCount) {
|
|
774
|
+
this.appendValueInput('DIV' + this.itemCount_).setCheck('Number');
|
|
775
|
+
this.itemCount_++;
|
|
776
|
+
}
|
|
777
|
+
while (this.itemCount_ > newCount) {
|
|
778
|
+
this.removeInput('DIV' + (this.itemCount_ - 1));
|
|
779
|
+
this.itemCount_--;
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
};
|
|
783
|
+
Blockly.Blocks['example_number'] = {
|
|
784
|
+
init: function () {
|
|
785
|
+
this.appendDummyInput()
|
|
786
|
+
.appendField('number:')
|
|
787
|
+
.appendField(new Blockly.FieldNumber(100, 0, 999999999999, 0.0000000000001), 'FIELDNAME');
|
|
788
|
+
this.setOutput(true, 'Number');
|
|
789
|
+
this.setTooltip('Tooltip text.');
|
|
790
|
+
},
|
|
791
|
+
};
|
|
792
|
+
Blockly.Blocks['example_string'] = {
|
|
793
|
+
init: function () {
|
|
794
|
+
this.appendDummyInput()
|
|
795
|
+
.appendField('string:')
|
|
796
|
+
.appendField(new Blockly.FieldTextInput('name'), 'FIELDNAME');
|
|
797
|
+
this.setOutput(true, 'String');
|
|
798
|
+
this.setTooltip('Tooltip text.');
|
|
799
|
+
},
|
|
800
|
+
};
|
|
801
|
+
Blockly.Blocks['string_length'] = {
|
|
802
|
+
init: function () {
|
|
803
|
+
this.appendValueInput('VALUE')
|
|
804
|
+
.setCheck('String')
|
|
805
|
+
.appendField('length of');
|
|
806
|
+
this.setOutput(true, 'Number');
|
|
807
|
+
this.setColour(160);
|
|
808
|
+
this.setTooltip('Returns number of letters in the provided text.');
|
|
809
|
+
this.setHelpUrl('http://www.w3schools.com/jsref/jsref_length_string.asp');
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
Blockly.Blocks['string_length2'] = {
|
|
813
|
+
init: function () {
|
|
814
|
+
this.jsonInit({
|
|
815
|
+
message0: 'length of %1',
|
|
816
|
+
args0: [
|
|
817
|
+
{
|
|
818
|
+
type: 'input_value',
|
|
819
|
+
name: 'VALUE',
|
|
820
|
+
check: 'String',
|
|
821
|
+
},
|
|
822
|
+
],
|
|
823
|
+
output: 'Number',
|
|
824
|
+
colour: 160,
|
|
825
|
+
tooltip: 'Returns number of letters in the provided text.',
|
|
826
|
+
helpUrl: 'http://www.w3schools.com/jsref/jsref_length_string.asp',
|
|
827
|
+
});
|
|
828
|
+
},
|
|
829
|
+
};
|
|
830
|
+
Blockly.Blocks['return_statement'] = {
|
|
831
|
+
init: function () {
|
|
832
|
+
this.appendValueInput('VALUE')
|
|
833
|
+
.setCheck(null) // You can specify a specific type or leave it as null for any type.
|
|
834
|
+
.appendField('return');
|
|
835
|
+
this.setPreviousStatement(true, null);
|
|
836
|
+
this.setColour(230);
|
|
837
|
+
this.setTooltip('Returns a value from a function');
|
|
838
|
+
this.setHelpUrl(''); // URL to further documentation if necessary
|
|
839
|
+
},
|
|
840
|
+
};
|
|
841
|
+
Blockly.Blocks['math_arithmetic_multiple'] = {
|
|
842
|
+
init: function () {
|
|
843
|
+
this.appendValueInput('NUM0').setCheck('Number');
|
|
844
|
+
this.appendValueInput('NUM1').setCheck('Number');
|
|
845
|
+
this.setOutput(true, 'Number');
|
|
846
|
+
this.setColour(230);
|
|
847
|
+
this.setTooltip('');
|
|
848
|
+
this.setHelpUrl('');
|
|
849
|
+
this.itemCount_ = 2;
|
|
850
|
+
this.updateShape_();
|
|
851
|
+
},
|
|
852
|
+
mutationToDom: function () {
|
|
853
|
+
let container = Blockly.utils.xml.createElement('mutation');
|
|
854
|
+
container.setAttribute('items', this.itemCount_);
|
|
855
|
+
return container;
|
|
856
|
+
},
|
|
857
|
+
domToMutation: function (xmlElement) {
|
|
858
|
+
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
|
859
|
+
this.updateShape_();
|
|
860
|
+
},
|
|
861
|
+
decompose: function (workspace) {
|
|
862
|
+
let containerBlock = workspace.newBlock('math_arithmetic_container');
|
|
863
|
+
containerBlock.initSvg();
|
|
864
|
+
let connection = containerBlock.getInput('STACK').connection;
|
|
865
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
866
|
+
let itemBlock = workspace.newBlock('math_arithmetic_input');
|
|
867
|
+
itemBlock.initSvg();
|
|
868
|
+
connection.connect(itemBlock.previousConnection);
|
|
869
|
+
connection = itemBlock.nextConnection;
|
|
870
|
+
}
|
|
871
|
+
return containerBlock;
|
|
872
|
+
},
|
|
873
|
+
compose: function (containerBlock) {
|
|
874
|
+
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
875
|
+
// Collect connections
|
|
876
|
+
let connections = [];
|
|
877
|
+
while (itemBlock && !itemBlock.isInsertionMarker()) {
|
|
878
|
+
connections.push(itemBlock.valueConnection_);
|
|
879
|
+
itemBlock = itemBlock?.nextConnection?.targetBlock();
|
|
880
|
+
}
|
|
881
|
+
// Disconnect any children that don't belong
|
|
882
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
883
|
+
const connection = this.getInput('NUM' + i).connection.targetConnection;
|
|
884
|
+
if (connection && connections.indexOf(connection) === -1) {
|
|
885
|
+
connection.disconnect();
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
this.itemCount_ = connections.length;
|
|
889
|
+
this.updateShape_();
|
|
890
|
+
// Reconnect valid child blocks
|
|
891
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
892
|
+
if (connections[i]) {
|
|
893
|
+
connections[i].reconnect(this, 'NUM' + i);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
saveConnections: function (containerBlock) {
|
|
898
|
+
let itemBlock = containerBlock.getInputTargetBlock('STACK');
|
|
899
|
+
let i = 0;
|
|
900
|
+
while (itemBlock) {
|
|
901
|
+
let input = this.getInput('NUM' + i);
|
|
902
|
+
itemBlock.valueConnection_ = input?.connection?.targetConnection;
|
|
903
|
+
i++;
|
|
904
|
+
itemBlock = itemBlock?.nextConnection?.targetBlock();
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
updateShape_: function () {
|
|
908
|
+
// Add missing value inputs.
|
|
909
|
+
for (let i = 0; i < this.itemCount_; i++) {
|
|
910
|
+
if (!this.getInput('NUM' + i)) {
|
|
911
|
+
this.appendValueInput('NUM' + i).setCheck('Number');
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
// Remove any extra inputs.
|
|
915
|
+
let j = this.itemCount_;
|
|
916
|
+
while (this.getInput('NUM' + j)) {
|
|
917
|
+
this.removeInput('NUM' + j);
|
|
918
|
+
j++;
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
};
|
|
922
|
+
Blockly.Blocks['math_arithmetic_container'] = {
|
|
923
|
+
init: function () {
|
|
924
|
+
this.appendDummyInput().appendField('add numbers');
|
|
925
|
+
this.appendStatementInput('STACK');
|
|
926
|
+
this.setColour(230);
|
|
927
|
+
this.setTooltip('');
|
|
928
|
+
this.contextMenu = false;
|
|
929
|
+
},
|
|
930
|
+
};
|
|
931
|
+
Blockly.Blocks['math_arithmetic_input'] = {
|
|
932
|
+
init: function () {
|
|
933
|
+
this.appendDummyInput().appendField('number');
|
|
934
|
+
this.setPreviousStatement(true);
|
|
935
|
+
this.setNextStatement(true);
|
|
936
|
+
this.setColour(230);
|
|
937
|
+
this.setTooltip('');
|
|
938
|
+
this.contextMenu = false;
|
|
939
|
+
},
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
DefineBlocklyCustomJavascript() {
|
|
943
|
+
javascriptGenerator.forBlock['math_addition'] = function (block, generator) {
|
|
944
|
+
const fieldCount = parseInt(block.getFieldValue('NUM_FIELDS'), 10);
|
|
945
|
+
let values = [];
|
|
946
|
+
for (let i = 0; i < fieldCount; i++) {
|
|
947
|
+
const value = generator.valueToCode(block, 'ADD' + i, Order.ATOMIC) || '0';
|
|
948
|
+
values.push(value);
|
|
949
|
+
}
|
|
950
|
+
const code = values.join(' + ');
|
|
951
|
+
return ['(' + code + ')', Order.NONE];
|
|
952
|
+
};
|
|
953
|
+
javascriptGenerator.forBlock['math_subtraction'] = function (block, generator) {
|
|
954
|
+
const fieldCount = parseInt(block.getFieldValue('NUM_FIELDS'), 10);
|
|
955
|
+
let values = [];
|
|
956
|
+
for (let i = 0; i < fieldCount; i++) {
|
|
957
|
+
const value = generator.valueToCode(block, 'SUB' + i, Order.ATOMIC) || '0';
|
|
958
|
+
values.push(value);
|
|
959
|
+
}
|
|
960
|
+
const code = values.join(' - ');
|
|
961
|
+
return ['(' + code + ')', Order.NONE];
|
|
962
|
+
};
|
|
963
|
+
javascriptGenerator.forBlock['math_max'] = function (block, generator) {
|
|
964
|
+
const fieldCount = parseInt(block.getFieldValue('NUM_FIELDS'), 10);
|
|
965
|
+
let values = [];
|
|
966
|
+
for (let i = 0; i < fieldCount; i++) {
|
|
967
|
+
const value = generator.valueToCode(block, 'NUM' + i, Order.ATOMIC) || '0';
|
|
968
|
+
values.push(value);
|
|
969
|
+
}
|
|
970
|
+
const code = 'Math.max(' + values.join(', ') + ')';
|
|
971
|
+
return [code, Order.NONE];
|
|
972
|
+
};
|
|
973
|
+
javascriptGenerator.forBlock['math_min'] = function (block, generator) {
|
|
974
|
+
const fieldCount = parseInt(block.getFieldValue('NUM_FIELDS'), 10);
|
|
975
|
+
let values = [];
|
|
976
|
+
for (let i = 0; i < fieldCount; i++) {
|
|
977
|
+
const value = generator.valueToCode(block, 'NUM' + i, Order.ATOMIC) || '0';
|
|
978
|
+
values.push(value);
|
|
979
|
+
}
|
|
980
|
+
const code = 'Math.min(' + values.join(', ') + ')';
|
|
981
|
+
return [code, Order.NONE];
|
|
982
|
+
};
|
|
983
|
+
javascriptGenerator.forBlock['math_division'] = function (block, generator) {
|
|
984
|
+
const fieldCount = parseInt(block.getFieldValue('NUM_FIELDS'), 10);
|
|
985
|
+
let values = [];
|
|
986
|
+
for (let i = 0; i < fieldCount; i++) {
|
|
987
|
+
const value = generator.valueToCode(block, 'DIV' + i, Order.ATOMIC) || '0';
|
|
988
|
+
values.push(value);
|
|
989
|
+
}
|
|
990
|
+
const code = values.join(' / ');
|
|
991
|
+
return ['(' + code + ')', Order.NONE];
|
|
992
|
+
};
|
|
993
|
+
javascriptGenerator.forBlock['math_multiplication'] = function (block, generator) {
|
|
994
|
+
const fieldCount = parseInt(block.getFieldValue('NUM_FIELDS'), 10);
|
|
995
|
+
let values = [];
|
|
996
|
+
for (let i = 0; i < fieldCount; i++) {
|
|
997
|
+
const value = generator.valueToCode(block, 'MUL' + i, Order.ATOMIC) || '1';
|
|
998
|
+
values.push(value);
|
|
999
|
+
}
|
|
1000
|
+
const code = values.join(' * ');
|
|
1001
|
+
return ['(' + code + ')', Order.NONE];
|
|
1002
|
+
};
|
|
1003
|
+
javascriptGenerator.forBlock['variables_get_dynamic'] = function (block, generator) {
|
|
1004
|
+
let variableId = block.getFieldValue('VAR');
|
|
1005
|
+
let code = `${variableId}`;
|
|
1006
|
+
return [code, Order.ATOMIC];
|
|
1007
|
+
};
|
|
1008
|
+
javascriptGenerator.forBlock['example_number'] = function (block, generator) {
|
|
1009
|
+
let variableId = block.getFieldValue('FIELDNAME');
|
|
1010
|
+
let code = `${variableId}`;
|
|
1011
|
+
return [code, Order.ATOMIC];
|
|
1012
|
+
};
|
|
1013
|
+
javascriptGenerator.forBlock['example_string'] = function (block, generator) {
|
|
1014
|
+
let variableId = block.getFieldValue('FIELDNAME');
|
|
1015
|
+
let code = `'${variableId}'`;
|
|
1016
|
+
return [code, Order.ATOMIC];
|
|
1017
|
+
};
|
|
1018
|
+
javascriptGenerator.forBlock['return_statement'] = function (block, generator) {
|
|
1019
|
+
let value = generator.valueToCode(block, 'VALUE', Order.NONE) || '';
|
|
1020
|
+
return 'return ' + value + ';\n';
|
|
1021
|
+
};
|
|
1022
|
+
javascriptGenerator.forBlock['math_arithmetic_multiple'] = function (block, generator) {
|
|
1023
|
+
let code = [];
|
|
1024
|
+
for (let n = 0; n < block.itemCount_; n++) {
|
|
1025
|
+
code[n] = generator.valueToCode(block, 'NUM' + n, Order.NONE) || '0';
|
|
1026
|
+
}
|
|
1027
|
+
return [code, Order.ATOMIC];
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
createVariables() {
|
|
1031
|
+
this.loader.show();
|
|
1032
|
+
this.variableList?.forEach((variableObj) => {
|
|
1033
|
+
// let varialbleName = variableObj.title? variableObj.name :variableObj.name
|
|
1034
|
+
// setTimeout(() => {
|
|
1035
|
+
setTimeout(() => {
|
|
1036
|
+
this.workspace?.createVariable(variableObj?.name, variableObj?.type, variableObj?.id);
|
|
1037
|
+
}, 1);
|
|
1038
|
+
// });
|
|
1039
|
+
});
|
|
1040
|
+
this.loader.hide();
|
|
1041
|
+
}
|
|
1042
|
+
createLookupVariables() {
|
|
1043
|
+
this.lookupList.forEach((variableObj) => {
|
|
1044
|
+
this.workspace?.createVariable(variableObj?.name, variableObj?.type, variableObj?.id);
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
goBack() {
|
|
1048
|
+
this.workspace.dispose();
|
|
1049
|
+
this.dialogRef.close(false);
|
|
1050
|
+
}
|
|
1051
|
+
extractVarIds(blocks, varIds = []) {
|
|
1052
|
+
for (const block of blocks) {
|
|
1053
|
+
// Check if the block has a VAR field and push the id if it exists
|
|
1054
|
+
if (block?.fields?.VAR?.id) {
|
|
1055
|
+
varIds.push(block.fields.VAR.id);
|
|
1056
|
+
}
|
|
1057
|
+
// Recursively process all inputs if they exist
|
|
1058
|
+
if (block.inputs) {
|
|
1059
|
+
for (const key in block.inputs) {
|
|
1060
|
+
if (block.inputs[key].block) {
|
|
1061
|
+
this.extractVarIds([block.inputs[key].block], varIds);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
// If the block is an array, recursively process it
|
|
1066
|
+
if (Array.isArray(block)) {
|
|
1067
|
+
this.extractVarIds(block, varIds);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return varIds;
|
|
1071
|
+
}
|
|
1072
|
+
submit() {
|
|
1073
|
+
const state = Blockly.serialization.workspaces.save(this.workspace);
|
|
1074
|
+
let result = this.extractVarIds(state.blocks.blocks);
|
|
1075
|
+
let filteredVariable = state?.variables?.filter(item => result?.includes(item.id));
|
|
1076
|
+
let finalVal = {
|
|
1077
|
+
variables: filteredVariable,
|
|
1078
|
+
blocks: state.blocks
|
|
1079
|
+
};
|
|
1080
|
+
const stateStrJSON = JSON.stringify(finalVal);
|
|
1081
|
+
const code = javascriptGenerator.workspaceToCode(this.workspace);
|
|
1082
|
+
const lines = code.split('\n');
|
|
1083
|
+
if (lines.length > 2) {
|
|
1084
|
+
lines.splice(0, 2);
|
|
1085
|
+
}
|
|
1086
|
+
// Join the remaining lines to form the modified code
|
|
1087
|
+
const modifiedCode = lines.filter(item => item !== "").join("");
|
|
1088
|
+
// Assign the modified code to generatedCode
|
|
1089
|
+
this.generatedCode = modifiedCode;
|
|
1090
|
+
const savedState = JSON.parse(stateStrJSON);
|
|
1091
|
+
const blocks = savedState?.blocks?.blocks;
|
|
1092
|
+
this.errorMessage = '';
|
|
1093
|
+
if (Array.isArray(blocks) && blocks?.length != 0) {
|
|
1094
|
+
this.loader.show();
|
|
1095
|
+
this.exportedExpression = this.generateExpressionFromBlocklyJson(stateStrJSON);
|
|
1096
|
+
let val = {
|
|
1097
|
+
expression: this.generatedCode,
|
|
1098
|
+
javascriptCode: this.generatedCode,
|
|
1099
|
+
loadexpression: stateStrJSON,
|
|
1100
|
+
};
|
|
1101
|
+
this.loader.hide();
|
|
1102
|
+
this.outputResponse.emit(val);
|
|
1103
|
+
if (val) {
|
|
1104
|
+
this.receiveOutputResponse(val);
|
|
1105
|
+
}
|
|
1106
|
+
this.workspace.dispose();
|
|
1107
|
+
}
|
|
1108
|
+
else {
|
|
1109
|
+
this.loader.hide();
|
|
1110
|
+
this.errorMessage = 'Please drag and drop the blocks, there is no expression to add.';
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
receiveOutputResponse(response) {
|
|
1114
|
+
this.outputResponse.emit(response);
|
|
1115
|
+
this.dialogRef.close(response);
|
|
1116
|
+
}
|
|
1117
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BlocklyExpression, deps: [{ token: LoaderService }, { token: i2$1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1118
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: BlocklyExpression, isStandalone: true, selector: "app-blockly-expression", outputs: { outputResponse: "outputResponse" }, ngImport: i0, template: "<app-pop-up-template>\r\n\r\n <h5 Ctitle>\r\n {{'Expression Logic' | translate}}\r\n </h5>\r\n <div class=\"ps-1\" closeButton>\r\n <button mat-icon-button (click)=\"goBack()\" class=\"d-flex justify-content-center\">\r\n <span class=\"iconify f-s-24 \" data-icon=\"mdi:close\"></span>\r\n </button>\r\n </div>\r\n <ng-content output>\r\n\r\n\r\n <div id=\"blocklyDiv\" style=\"height: 66vh; width: 100%;\"></div>\r\n\r\n <div class=\"col-12 text-center\">\r\n <button mat-button (click)=\"ExtractWorkspace()\"\r\n class=\"mt-1 btnreset\">{{'Export_Expression'|translate}} <i class=\"fa fa-eye\"></i></button>\r\n <div>\r\n @if(code){\r\n <h5>{{'Expression'|translate}}:</h5>\r\n <div>{{code}}</div>\r\n }\r\n </div>\r\n <div>\r\n @if(errorMessage){\r\n <span class=\"text-danger\">{{errorMessage}}</span>\r\n }\r\n\r\n <div class=\"col-12 text-center mt-4 \">\r\n <button mat-button class=\"btnreset\" type=\"button\" (click)=\"goBack()\">\r\n {{'Close' | translate}} <em class=\"fa fa-times-circle\"></em>\r\n </button> \r\n <button mat-button class=\"btnc\" type=\"button\" (click)=\"submit()\">\r\n {{'next' | translate}} <em class=\"fa fa-arrow-right\"></em>\r\n </button>\r\n\r\n </div>\r\n </div>\r\n </div>\r\n\r\n </ng-content>\r\n</app-pop-up-template>", styles: ["::ng-deep .blocklyDropDownDiv{position:fixed!important}::ng-deep .blocklyWidgetDiv{position:fixed!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: PopUpTemplate, selector: "app-pop-up-template", inputs: ["isTitle"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
|
|
1119
|
+
}
|
|
1120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BlocklyExpression, decorators: [{
|
|
1121
|
+
type: Component,
|
|
1122
|
+
args: [{ selector: 'app-blockly-expression', standalone: true, imports: [
|
|
1123
|
+
CommonModule,
|
|
1124
|
+
MatButtonModule,
|
|
1125
|
+
MatIconModule,
|
|
1126
|
+
MatDialogModule,
|
|
1127
|
+
TranslateModule,
|
|
1128
|
+
PopUpTemplate
|
|
1129
|
+
], template: "<app-pop-up-template>\r\n\r\n <h5 Ctitle>\r\n {{'Expression Logic' | translate}}\r\n </h5>\r\n <div class=\"ps-1\" closeButton>\r\n <button mat-icon-button (click)=\"goBack()\" class=\"d-flex justify-content-center\">\r\n <span class=\"iconify f-s-24 \" data-icon=\"mdi:close\"></span>\r\n </button>\r\n </div>\r\n <ng-content output>\r\n\r\n\r\n <div id=\"blocklyDiv\" style=\"height: 66vh; width: 100%;\"></div>\r\n\r\n <div class=\"col-12 text-center\">\r\n <button mat-button (click)=\"ExtractWorkspace()\"\r\n class=\"mt-1 btnreset\">{{'Export_Expression'|translate}} <i class=\"fa fa-eye\"></i></button>\r\n <div>\r\n @if(code){\r\n <h5>{{'Expression'|translate}}:</h5>\r\n <div>{{code}}</div>\r\n }\r\n </div>\r\n <div>\r\n @if(errorMessage){\r\n <span class=\"text-danger\">{{errorMessage}}</span>\r\n }\r\n\r\n <div class=\"col-12 text-center mt-4 \">\r\n <button mat-button class=\"btnreset\" type=\"button\" (click)=\"goBack()\">\r\n {{'Close' | translate}} <em class=\"fa fa-times-circle\"></em>\r\n </button> \r\n <button mat-button class=\"btnc\" type=\"button\" (click)=\"submit()\">\r\n {{'next' | translate}} <em class=\"fa fa-arrow-right\"></em>\r\n </button>\r\n\r\n </div>\r\n </div>\r\n </div>\r\n\r\n </ng-content>\r\n</app-pop-up-template>", styles: ["::ng-deep .blocklyDropDownDiv{position:fixed!important}::ng-deep .blocklyWidgetDiv{position:fixed!important}\n"] }]
|
|
1130
|
+
}], ctorParameters: () => [{ type: LoaderService }, { type: i2$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
1131
|
+
type: Inject,
|
|
1132
|
+
args: [MAT_DIALOG_DATA]
|
|
1133
|
+
}] }], propDecorators: { outputResponse: [{
|
|
1134
|
+
type: Output
|
|
1135
|
+
}] } });
|
|
1136
|
+
|
|
1137
|
+
class MaterialModule {
|
|
1138
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1139
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: MaterialModule, exports: [MatAutocompleteModule,
|
|
1140
|
+
MatCheckboxModule,
|
|
1141
|
+
MatDatepickerModule,
|
|
1142
|
+
MatFormFieldModule,
|
|
1143
|
+
MatInputModule,
|
|
1144
|
+
MatRadioModule,
|
|
1145
|
+
MatSelectModule,
|
|
1146
|
+
MatSliderModule,
|
|
1147
|
+
MatSlideToggleModule,
|
|
1148
|
+
MatMenuModule,
|
|
1149
|
+
MatSidenavModule,
|
|
1150
|
+
MatToolbarModule,
|
|
1151
|
+
MatCardModule,
|
|
1152
|
+
MatDividerModule,
|
|
1153
|
+
MatExpansionModule,
|
|
1154
|
+
MatGridListModule,
|
|
1155
|
+
MatListModule,
|
|
1156
|
+
MatStepperModule,
|
|
1157
|
+
MatTabsModule,
|
|
1158
|
+
MatTreeModule,
|
|
1159
|
+
MatButtonModule,
|
|
1160
|
+
MatButtonToggleModule,
|
|
1161
|
+
MatBadgeModule,
|
|
1162
|
+
MatChipsModule,
|
|
1163
|
+
MatIconModule,
|
|
1164
|
+
MatProgressSpinnerModule,
|
|
1165
|
+
MatProgressBarModule,
|
|
1166
|
+
MatRippleModule,
|
|
1167
|
+
MatBottomSheetModule,
|
|
1168
|
+
MatDialogModule,
|
|
1169
|
+
MatSnackBarModule,
|
|
1170
|
+
MatTooltipModule,
|
|
1171
|
+
MatPaginatorModule,
|
|
1172
|
+
MatSortModule,
|
|
1173
|
+
MatTableModule,
|
|
1174
|
+
MatTooltipModule,
|
|
1175
|
+
MatMomentDatetimeModule,
|
|
1176
|
+
MatDatetimepickerModule,
|
|
1177
|
+
MatNativeDatetimeModule] }); }
|
|
1178
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: MaterialModule, imports: [MatAutocompleteModule,
|
|
1179
|
+
MatCheckboxModule,
|
|
1180
|
+
MatDatepickerModule,
|
|
1181
|
+
MatFormFieldModule,
|
|
1182
|
+
MatInputModule,
|
|
1183
|
+
MatRadioModule,
|
|
1184
|
+
MatSelectModule,
|
|
1185
|
+
MatSliderModule,
|
|
1186
|
+
MatSlideToggleModule,
|
|
1187
|
+
MatMenuModule,
|
|
1188
|
+
MatSidenavModule,
|
|
1189
|
+
MatToolbarModule,
|
|
1190
|
+
MatCardModule,
|
|
1191
|
+
MatDividerModule,
|
|
1192
|
+
MatExpansionModule,
|
|
1193
|
+
MatGridListModule,
|
|
1194
|
+
MatListModule,
|
|
1195
|
+
MatStepperModule,
|
|
1196
|
+
MatTabsModule,
|
|
1197
|
+
MatTreeModule,
|
|
1198
|
+
MatButtonModule,
|
|
1199
|
+
MatButtonToggleModule,
|
|
1200
|
+
MatBadgeModule,
|
|
1201
|
+
MatChipsModule,
|
|
1202
|
+
MatIconModule,
|
|
1203
|
+
MatProgressSpinnerModule,
|
|
1204
|
+
MatProgressBarModule,
|
|
1205
|
+
MatRippleModule,
|
|
1206
|
+
MatBottomSheetModule,
|
|
1207
|
+
MatDialogModule,
|
|
1208
|
+
MatSnackBarModule,
|
|
1209
|
+
MatTooltipModule,
|
|
1210
|
+
MatPaginatorModule,
|
|
1211
|
+
MatSortModule,
|
|
1212
|
+
MatTableModule,
|
|
1213
|
+
MatTooltipModule,
|
|
1214
|
+
MatMomentDatetimeModule,
|
|
1215
|
+
MatDatetimepickerModule,
|
|
1216
|
+
MatNativeDatetimeModule] }); }
|
|
1217
|
+
}
|
|
1218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: MaterialModule, decorators: [{
|
|
1219
|
+
type: NgModule,
|
|
1220
|
+
args: [{
|
|
1221
|
+
declarations: [],
|
|
1222
|
+
exports: [
|
|
1223
|
+
MatAutocompleteModule,
|
|
1224
|
+
MatCheckboxModule,
|
|
1225
|
+
MatDatepickerModule,
|
|
1226
|
+
MatFormFieldModule,
|
|
1227
|
+
MatInputModule,
|
|
1228
|
+
MatRadioModule,
|
|
1229
|
+
MatSelectModule,
|
|
1230
|
+
MatSliderModule,
|
|
1231
|
+
MatSlideToggleModule,
|
|
1232
|
+
MatMenuModule,
|
|
1233
|
+
MatSidenavModule,
|
|
1234
|
+
MatToolbarModule,
|
|
1235
|
+
MatCardModule,
|
|
1236
|
+
MatDividerModule,
|
|
1237
|
+
MatExpansionModule,
|
|
1238
|
+
MatGridListModule,
|
|
1239
|
+
MatListModule,
|
|
1240
|
+
MatStepperModule,
|
|
1241
|
+
MatTabsModule,
|
|
1242
|
+
MatTreeModule,
|
|
1243
|
+
MatButtonModule,
|
|
1244
|
+
MatButtonToggleModule,
|
|
1245
|
+
MatBadgeModule,
|
|
1246
|
+
MatChipsModule,
|
|
1247
|
+
MatIconModule,
|
|
1248
|
+
MatProgressSpinnerModule,
|
|
1249
|
+
MatProgressBarModule,
|
|
1250
|
+
MatRippleModule,
|
|
1251
|
+
MatBottomSheetModule,
|
|
1252
|
+
MatDialogModule,
|
|
1253
|
+
MatSnackBarModule,
|
|
1254
|
+
MatTooltipModule,
|
|
1255
|
+
MatPaginatorModule,
|
|
1256
|
+
MatSortModule,
|
|
1257
|
+
MatTableModule,
|
|
1258
|
+
MatTooltipModule,
|
|
1259
|
+
MatMomentDatetimeModule,
|
|
1260
|
+
MatDatetimepickerModule,
|
|
1261
|
+
MatNativeDatetimeModule
|
|
1262
|
+
],
|
|
1263
|
+
}]
|
|
1264
|
+
}] });
|
|
1265
|
+
|
|
1266
|
+
/*
|
|
1267
|
+
* Public API Surface of afrisure-blockly-expression
|
|
1268
|
+
*/
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* Generated bundle index. Do not edit.
|
|
1272
|
+
*/
|
|
1273
|
+
|
|
1274
|
+
export { BlocklyExpression, LoaderService, MaterialModule, PopUpTemplate };
|
|
1275
|
+
//# sourceMappingURL=srikanthsai27-afrisure-blockly-expression.mjs.map
|