wuic-framework-lib 1.0.11 → 1.0.20
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.
- package/fesm2022/{wuic-framework-lib-chart-list.component-vuzmQW9F.mjs → wuic-framework-lib-chart-list.component-B44k_wZe.mjs} +79 -19
- package/fesm2022/{wuic-framework-lib-code-editor.component-BjbIkm4g.mjs → wuic-framework-lib-code-editor.component-D1dy4Dl9.mjs} +261 -261
- package/fesm2022/{wuic-framework-lib-designer.component-BM3elB-a.mjs → wuic-framework-lib-designer.component-CnOQbvEH.mjs} +178 -151
- package/fesm2022/{wuic-framework-lib-first-run-wizard.component-5tcl67dK.mjs → wuic-framework-lib-first-run-wizard.component-C9lswoxG.mjs} +248 -42
- package/fesm2022/{wuic-framework-lib-framework-docs.component-BGcJ7k1X.mjs → wuic-framework-lib-framework-docs.component-B6qNTs5H.mjs} +830 -121
- package/fesm2022/{wuic-framework-lib-pivot-builder.component-ChNyMAfi.mjs → wuic-framework-lib-pivot-builder.component-DMk26H0M.mjs} +475 -100
- package/fesm2022/{wuic-framework-lib-prompt-dialog-fallback-host.component-DFLR_EmK.mjs → wuic-framework-lib-prompt-dialog-fallback-host.component-y3shST6g.mjs} +5 -5
- package/fesm2022/{wuic-framework-lib-report-designer.component-B_SC7VkW.mjs → wuic-framework-lib-report-designer.component-BnngR2eL.mjs} +15 -15
- package/fesm2022/{wuic-framework-lib-report-viewer.component-BTK-p8xF.mjs → wuic-framework-lib-report-viewer.component-LGNRIQh2.mjs} +82 -12
- package/fesm2022/{wuic-framework-lib-scheduler-list.component-CIoGVf4O.mjs → wuic-framework-lib-scheduler-list.component-DbcFMwx5.mjs} +42 -19
- package/fesm2022/{wuic-framework-lib-spreadsheet-list-sf.component-DQ5OxO4j.mjs → wuic-framework-lib-spreadsheet-list-sf.component-DXyRX0YK.mjs} +25 -11
- package/fesm2022/{wuic-framework-lib-workflow-designer.component-BHLT4MER.mjs → wuic-framework-lib-workflow-designer.component-Bm719AWV.mjs} +9 -9
- package/fesm2022/{wuic-framework-lib-wuic-framework-lib-DDokY6wY.mjs → wuic-framework-lib-wuic-framework-lib-CGCZvtKK.mjs} +3795 -1466
- package/fesm2022/wuic-framework-lib.mjs +1 -1
- package/package.json +1 -1
- package/types/wuic-framework-lib.d.ts +647 -26
|
@@ -6,7 +6,7 @@ import * as i1 from '@materia-ui/ngx-monaco-editor';
|
|
|
6
6
|
import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor';
|
|
7
7
|
import { filter, take } from 'rxjs/operators';
|
|
8
8
|
import { Emitter } from 'monaco-editor/esm/vs/base/common/event';
|
|
9
|
-
import { W as WtoolboxService, M as MetadataProviderService, e as MetadatiColonna, m as MetaInfo, U as UserInfoService, f as DataProviderService } from './wuic-framework-lib-wuic-framework-lib-
|
|
9
|
+
import { W as WtoolboxService, M as MetadataProviderService, e as MetadatiColonna, m as MetaInfo, U as UserInfoService, f as DataProviderService } from './wuic-framework-lib-wuic-framework-lib-CGCZvtKK.mjs';
|
|
10
10
|
import { NgClass, NgStyle } from '@angular/common';
|
|
11
11
|
import * as i13 from 'primeng/contextmenu';
|
|
12
12
|
import { ContextMenuModule } from 'primeng/contextmenu';
|
|
@@ -136,14 +136,14 @@ class SqlProvider {
|
|
|
136
136
|
*/
|
|
137
137
|
async registerSqlProvider(treeNodes) {
|
|
138
138
|
this.treeNodes = treeNodes;
|
|
139
|
-
|
|
139
|
+
let normalizedKeywords = [];
|
|
140
140
|
sqlKeywords.forEach(element => {
|
|
141
141
|
normalizedKeywords = normalizedKeywords.concat(element.split(' '));
|
|
142
142
|
});
|
|
143
143
|
const scaffoldedOnly = this.editorOptions?.scaffoldedOnly ?? false;
|
|
144
144
|
this.schemas = (await this.http.get(`${WtoolboxService.appSettings.api_url}CodeEditor/AutocompleteSqlObjects?scaffoldedOnly=${scaffoldedOnly}`).toPromise());
|
|
145
145
|
this.userDefTypes = this.schemas.map(x => x.types).flat(1);
|
|
146
|
-
|
|
146
|
+
let nodes = this.createTreeMenu();
|
|
147
147
|
nodes.forEach(node => {
|
|
148
148
|
this.treeNodes.push(node);
|
|
149
149
|
});
|
|
@@ -171,7 +171,7 @@ class SqlProvider {
|
|
|
171
171
|
],
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
-
|
|
174
|
+
let rules = [
|
|
175
175
|
{ token: "keyword", foreground: "569CD6" },
|
|
176
176
|
{ token: "types", foreground: "0CCB23" },
|
|
177
177
|
{ token: "udt", foreground: "089319" },
|
|
@@ -189,9 +189,9 @@ class SqlProvider {
|
|
|
189
189
|
monaco.languages.registerCompletionItemProvider('sql', {
|
|
190
190
|
triggerCharacters: ['.', ' ', '\n'], // '('
|
|
191
191
|
provideCompletionItems: (model, position, context, token) => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
let lastWord = model.getWordUntilPosition(position); //getWordUntilPosition //getWordAtPosition
|
|
193
|
+
let originalText = model.getValueInRange(model.getFullModelRange());
|
|
194
|
+
let scaffoldedOnly = this.editorOptions?.scaffoldedOnly ?? false;
|
|
195
195
|
return this.getAutocompleteSuggestions(originalText, position, lastWord, scaffoldedOnly);
|
|
196
196
|
}
|
|
197
197
|
});
|
|
@@ -257,17 +257,17 @@ class SqlProvider {
|
|
|
257
257
|
// });
|
|
258
258
|
}
|
|
259
259
|
getAutocompleteSuggestions(originalText, position, lastWord, scaffoldedOnly = true) {
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
let fullText = this.sanitize(originalText);
|
|
261
|
+
let range = {
|
|
262
262
|
startLineNumber: position.lineNumber,
|
|
263
263
|
startColumn: lastWord ? lastWord.startColumn : position.column,
|
|
264
264
|
endLineNumber: position.lineNumber,
|
|
265
265
|
endColumn: lastWord ? lastWord.endColumn : position.column
|
|
266
266
|
};
|
|
267
267
|
this.previousStatements = fullText.split(';').filter(x => x.length > 0).map(x => x.trim()); //.toUpperCase()
|
|
268
|
-
|
|
268
|
+
let contextInfo = this.getContextInfo(originalText, position);
|
|
269
269
|
this.parseStatements();
|
|
270
|
-
|
|
270
|
+
let ctx = this.getAutocompleteContext(contextInfo);
|
|
271
271
|
return this.getSuggestionsByContext(ctx, range, originalText, contextInfo, scaffoldedOnly);
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
@@ -390,10 +390,10 @@ class SqlProvider {
|
|
|
390
390
|
return str.replace(/(\r\n|\n|\r|\t)/gm, " ").replace(/ +(?= )/g, '');
|
|
391
391
|
}
|
|
392
392
|
normalizeStatement(previousWords) {
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
let skipNext = false;
|
|
394
|
+
let sanitizedPreviousWords = [];
|
|
395
395
|
previousWords.forEach((elementObj, indx) => {
|
|
396
|
-
|
|
396
|
+
let element = (elementObj.token || '').toUpperCase();
|
|
397
397
|
if ((element == 'INNER' || element == 'LEFT' || element == 'RIGHT' || element == 'ORDER' || element == 'INSERT' || element == 'GROUP' || element == 'CASE' || element == 'CREATE')
|
|
398
398
|
&&
|
|
399
399
|
previousWords.length > indx + 1) {
|
|
@@ -425,8 +425,8 @@ class SqlProvider {
|
|
|
425
425
|
*/
|
|
426
426
|
removeNestedStatements(statement, nestedStatements, currentIndx) {
|
|
427
427
|
if (nestedStatements.length) {
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
let currentIndxx = currentIndx ?? 0;
|
|
429
|
+
let cleanString = '';
|
|
430
430
|
nestedStatements.forEach(x => {
|
|
431
431
|
cleanString += `${statement.substring(currentIndxx, x.index)}`;
|
|
432
432
|
currentIndx = x.index + x[0].length;
|
|
@@ -487,7 +487,7 @@ class SqlProvider {
|
|
|
487
487
|
let fakeDepth = 0;
|
|
488
488
|
// identify position in text
|
|
489
489
|
for (let index = 0; index < text.length; index++) {
|
|
490
|
-
|
|
490
|
+
let c = text[index];
|
|
491
491
|
if (c === '\n' || c === '\r') {
|
|
492
492
|
lineNumber++;
|
|
493
493
|
column = 0;
|
|
@@ -517,8 +517,8 @@ class SqlProvider {
|
|
|
517
517
|
parsedText.push([]);
|
|
518
518
|
depthIndx.push({ depth: depth, index: 0 });
|
|
519
519
|
}
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
let parentDepth = depthIndx.find(x => x.depth == depth - 1);
|
|
521
|
+
let parentIndex = parentDepth ? parentDepth.index : -1;
|
|
522
522
|
parsedText[depth].push({
|
|
523
523
|
char: c === '\n' || c === '\r' ? ' ' : c,
|
|
524
524
|
column: column,
|
|
@@ -546,7 +546,7 @@ class SqlProvider {
|
|
|
546
546
|
* @returns ContextInfo per il motore suggerimenti.
|
|
547
547
|
*/
|
|
548
548
|
getContextInfo(originalText, position) {
|
|
549
|
-
|
|
549
|
+
let parsedText = this.processText(originalText, position);
|
|
550
550
|
const emptyContext = () => {
|
|
551
551
|
return {
|
|
552
552
|
words: [],
|
|
@@ -561,11 +561,11 @@ class SqlProvider {
|
|
|
561
561
|
if (!parsedText || parsedText.length === 0) {
|
|
562
562
|
return emptyContext();
|
|
563
563
|
}
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
let levelBlock = parsedText.find(y => y.find(z => z.lineNumber == position.lineNumber && z.column == position.column - 1));
|
|
565
|
+
let charToken;
|
|
566
566
|
//quando triggera autocomplete dopo a capo
|
|
567
567
|
if (!levelBlock && position.column == 1 && position.lineNumber > 1) {
|
|
568
|
-
|
|
568
|
+
let levelLineBlock = parsedText.filter(y => y.find(z => z.lineNumber == position.lineNumber - 1));
|
|
569
569
|
if (levelLineBlock.length > 0) {
|
|
570
570
|
levelBlock = levelLineBlock[levelLineBlock.length - 1];
|
|
571
571
|
charToken = levelBlock[levelBlock.length - 1];
|
|
@@ -584,21 +584,21 @@ class SqlProvider {
|
|
|
584
584
|
if (!charToken || !levelBlock) {
|
|
585
585
|
return emptyContext();
|
|
586
586
|
}
|
|
587
|
-
|
|
587
|
+
let charTokenIndx = levelBlock.indexOf(charToken);
|
|
588
588
|
if (charTokenIndx < 0) {
|
|
589
589
|
charTokenIndx = 0;
|
|
590
590
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
591
|
+
let adjacentChars = (charTokenIndx > 0 ? levelBlock[charTokenIndx].char : '') + (levelBlock.length > charTokenIndx + 1 ? levelBlock[charTokenIndx + 1].char : '');
|
|
592
|
+
let nestingIndex = charToken.nestingIndex;
|
|
593
|
+
let nestingLevel = charToken.nestingLevel;
|
|
594
|
+
let statementIndx = charToken.statementIndex;
|
|
595
|
+
let previousWords = [];
|
|
596
|
+
let previousNonNestedWords = [];
|
|
597
|
+
let previousWordString = '';
|
|
598
|
+
let previousNonNestedWordString = '';
|
|
599
599
|
parsedText.forEach((level) => {
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
let offset = 0;
|
|
601
|
+
let token = level[offset];
|
|
602
602
|
while (token && (token.lineNumber < position.lineNumber || (token.lineNumber == position.lineNumber && token.column <= position.column))) {
|
|
603
603
|
if (token.nestingLevel == nestingLevel && token.nestingIndex == nestingIndex) {
|
|
604
604
|
previousNonNestedWordString += token.char;
|
|
@@ -629,14 +629,14 @@ class SqlProvider {
|
|
|
629
629
|
* @returns ContextInfo calcolato con algoritmo precedente.
|
|
630
630
|
*/
|
|
631
631
|
getContextInfoOld(originalText, position) {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
632
|
+
let previousWords = [];
|
|
633
|
+
let previousNonNestedWords = [];
|
|
634
|
+
let statementIndex = 1;
|
|
635
|
+
let txtLines = originalText.split('\r\n');
|
|
636
|
+
let nestedStatements = this.getNestedStatements(originalText);
|
|
637
|
+
let parsedInput = this.processText(originalText, position);
|
|
638
|
+
let adjacentChars = '';
|
|
639
|
+
let x = txtLines[position.lineNumber - 1];
|
|
640
640
|
if (x.length >= position.column - 1) {
|
|
641
641
|
if (position.column > 2) {
|
|
642
642
|
adjacentChars = adjacentChars + (x[position.column - 2] || '');
|
|
@@ -645,14 +645,14 @@ class SqlProvider {
|
|
|
645
645
|
adjacentChars = adjacentChars + (x[position.column - 1] || '');
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
|
|
649
|
-
|
|
648
|
+
let absolutePosition = 0;
|
|
649
|
+
let endPosition = 0;
|
|
650
650
|
txtLines.forEach((line, indx) => {
|
|
651
651
|
if (indx <= position.lineNumber - 1) {
|
|
652
652
|
if (indx < position.lineNumber - 1) {
|
|
653
653
|
endPosition = absolutePosition += line.length + 1;
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
let overlappings = nestedStatements.filter(x => (x.index >= absolutePosition && x.index <= endPosition) || (x.index + x[1].length >= absolutePosition && x.index + x[1].length <= endPosition) || (x.index <= absolutePosition && x.index + x[1].length >= endPosition));
|
|
655
|
+
let cleanString = line;
|
|
656
656
|
overlappings.forEach(overlapping => {
|
|
657
657
|
for (let ovIndex = overlapping.index; ovIndex < overlapping.index + overlapping[0].length; ovIndex++) {
|
|
658
658
|
cleanString = cleanString.substring(0, ovIndex) + '§' + line.substring(ovIndex + 1);
|
|
@@ -669,8 +669,8 @@ class SqlProvider {
|
|
|
669
669
|
}
|
|
670
670
|
else {
|
|
671
671
|
endPosition = absolutePosition + Math.min(position.column, line.length);
|
|
672
|
-
|
|
673
|
-
|
|
672
|
+
let overlappings = nestedStatements.filter(x => (x.index >= absolutePosition && x.index <= endPosition) || (x.index + x[1].length >= absolutePosition && x.index + x[1].length <= endPosition) || (x.index <= absolutePosition && x.index + x[1].length >= endPosition));
|
|
673
|
+
let cleanString = line;
|
|
674
674
|
overlappings.forEach(overlapping => {
|
|
675
675
|
for (let ovIndex = overlapping.index; ovIndex < overlapping.index + overlapping[0].length; ovIndex++) {
|
|
676
676
|
cleanString = cleanString.substring(0, ovIndex) + '§' + line.substring(ovIndex + 1);
|
|
@@ -690,14 +690,14 @@ class SqlProvider {
|
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
692
|
});
|
|
693
|
-
|
|
693
|
+
let nestedStatementIndex = -1;
|
|
694
694
|
if (nestedStatements.length > 0) {
|
|
695
695
|
nestedStatementIndex = nestedStatements.indexOf(nestedStatements.find(x => {
|
|
696
696
|
return x.length > 1 && x.index <= absolutePosition && x.index + x[1].length >= absolutePosition;
|
|
697
697
|
}));
|
|
698
698
|
if (nestedStatementIndex >= 0) {
|
|
699
|
-
|
|
700
|
-
|
|
699
|
+
let currentStatementuniqueWords = previousWords.map((x, indx) => x.word + indx.toString());
|
|
700
|
+
let nestings = currentStatementuniqueWords.filter(x => x.startsWith('('))
|
|
701
701
|
.map((x, indx) => currentStatementuniqueWords.indexOf(x));
|
|
702
702
|
if (nestings.length > nestedStatementIndex) {
|
|
703
703
|
previousWords = previousWords.filter((x, indx) => indx >= nestings[nestedStatementIndex]).map(x => { return { word: x.word.replace('(', '').trim(), statementIndx: x.statementIndx }; }).filter(x => x.word.length > 0);
|
|
@@ -722,28 +722,28 @@ class SqlProvider {
|
|
|
722
722
|
getAutocompleteContext(contextInfo) {
|
|
723
723
|
//use this.currents.statements !!!
|
|
724
724
|
//triggerKind = 0 = word
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
let currentStatementWords;
|
|
726
|
+
let contextWords = [];
|
|
727
|
+
let statementIndex = contextInfo.currentStmntIndex;
|
|
728
728
|
if (contextInfo.nestedStatementLevel > 0) {
|
|
729
729
|
contextWords = contextInfo.words.filter(x => x.statementIndx == statementIndex);
|
|
730
730
|
}
|
|
731
731
|
else {
|
|
732
732
|
contextWords = contextInfo.nonNestedWords.filter(x => x.statementIndx == statementIndex);
|
|
733
733
|
}
|
|
734
|
-
|
|
734
|
+
let normalized = this.normalizeStatement(contextWords.map((x, indx) => { return { token: x.word, tokenIndx: indx }; }));
|
|
735
735
|
currentStatementWords = normalized.map(x => x.token.replace("(", ""));
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
736
|
+
let keywordIndx = -1;
|
|
737
|
+
let matchingKeyWords = currentStatementWords.filter(x => sqlKeywords.indexOf(x.toUpperCase()) >= 0);
|
|
738
|
+
let matchingKeyWord = matchingKeyWords.length > 0 ? matchingKeyWords[matchingKeyWords.length - 1] : '';
|
|
739
739
|
if (matchingKeyWord) {
|
|
740
740
|
keywordIndx = sqlKeywords.indexOf(matchingKeyWord.toUpperCase());
|
|
741
741
|
}
|
|
742
742
|
if (keywordIndx >= 0) {
|
|
743
|
-
|
|
743
|
+
let currentStmnt = this.currents.statements.find(x => x.index == statementIndex);
|
|
744
744
|
if (currentStmnt) {
|
|
745
|
-
|
|
746
|
-
|
|
745
|
+
let subStmnt = currentStmnt.subStatements.find(x => x.key.toUpperCase() == matchingKeyWord.toUpperCase());
|
|
746
|
+
let match = { key: null, statement: null, parentStatement: null, desiredLevel: -1, desiredIndex: -1 };
|
|
747
747
|
if (contextInfo.nestedStatementLevel > 0) {
|
|
748
748
|
match.desiredLevel = 1; // implement contextInfo.nestedStatementLevel
|
|
749
749
|
match.desiredIndex = contextInfo.nestedStatementIndex;
|
|
@@ -762,7 +762,7 @@ class SqlProvider {
|
|
|
762
762
|
if (subStmnt) {
|
|
763
763
|
contextInfo.currentStatement = currentStmnt;
|
|
764
764
|
contextInfo.currentSubStatement = subStmnt;
|
|
765
|
-
|
|
765
|
+
let currentSubStmntWords = subStmnt.statement.words;
|
|
766
766
|
switch (subStmnt.key) {
|
|
767
767
|
case 'DECLARE':
|
|
768
768
|
if (currentSubStmntWords[currentSubStmntWords.length - 1].token.indexOf('@') < 0) {
|
|
@@ -787,17 +787,17 @@ class SqlProvider {
|
|
|
787
787
|
return autocompleteContext.table;
|
|
788
788
|
});
|
|
789
789
|
case 'SELECT':
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
790
|
+
let previousWord;
|
|
791
|
+
let nextWord;
|
|
792
|
+
let previousWords = currentSubStmntWords.filter(x => x.tokenIndx < contextInfo.position.column - 1);
|
|
793
793
|
if (previousWords.length > 0) {
|
|
794
794
|
previousWord = previousWords[previousWords.length - 1];
|
|
795
795
|
}
|
|
796
|
-
|
|
796
|
+
let nextWords = currentSubStmntWords.filter(x => x.tokenIndx >= contextInfo.position.column - 1);
|
|
797
797
|
if (nextWords.length > 0) {
|
|
798
798
|
nextWord = nextWords[0];
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
let selectLastToken = (currentSubStmntWords[currentSubStmntWords.length - 1]?.token || '').trim();
|
|
801
801
|
if (selectLastToken.indexOf('.') >= 0) {
|
|
802
802
|
// Alias-qualified column completion (e.g. AppCit. or AppCit.Sta)
|
|
803
803
|
return autocompleteContext.columnWhereRestricted;
|
|
@@ -828,9 +828,9 @@ class SqlProvider {
|
|
|
828
828
|
case 'LEFT JOIN':
|
|
829
829
|
case 'RIGHT JOIN':
|
|
830
830
|
if (currentSubStmntWords.length > 1) {
|
|
831
|
-
|
|
831
|
+
let schemaTableAliasToken = currentSubStmntWords[1];
|
|
832
832
|
if (schemaTableAliasToken) {
|
|
833
|
-
|
|
833
|
+
let schemaAndTableOrAlias = schemaTableAliasToken.token.split('.').filter(x => x.length > 0);
|
|
834
834
|
if (schemaAndTableOrAlias.length > 0) {
|
|
835
835
|
}
|
|
836
836
|
else {
|
|
@@ -863,7 +863,7 @@ class SqlProvider {
|
|
|
863
863
|
return autocompleteContext.columnGroupBy;
|
|
864
864
|
case 'SET':
|
|
865
865
|
if (currentSubStmntWords[currentSubStmntWords.length - 1].token.trim().toUpperCase() == 'SET') {
|
|
866
|
-
|
|
866
|
+
let updtStmnt = currentStmnt.subStatements.find(x => x.key == 'UPDATE');
|
|
867
867
|
if (updtStmnt && updtStmnt.statement.words.length > 1) {
|
|
868
868
|
// this.currents.table = updtStmnt.statement.sqlTables[updtStmnt.statement.sqlTables.length - 1];
|
|
869
869
|
return autocompleteContext.columnWhere;
|
|
@@ -957,7 +957,7 @@ class SqlProvider {
|
|
|
957
957
|
* @returns Context specifico WHERE.
|
|
958
958
|
*/
|
|
959
959
|
evaluateAutocompleteWhereContext(currents, currentStatementWords, whereSubStatemnt) {
|
|
960
|
-
|
|
960
|
+
let lastToken = currentStatementWords[currentStatementWords.length - 1].trim().toUpperCase();
|
|
961
961
|
if (lastToken == 'AND' || lastToken == 'WHERE') {
|
|
962
962
|
return autocompleteContext.columnWhere;
|
|
963
963
|
}
|
|
@@ -985,7 +985,7 @@ class SqlProvider {
|
|
|
985
985
|
//https://github.com/sqljs/node-sqljs
|
|
986
986
|
this.clearCurrents();
|
|
987
987
|
this.previousStatements.forEach((statement, stmntIndx) => {
|
|
988
|
-
|
|
988
|
+
let sanitedStatement = this.sanitize(statement);
|
|
989
989
|
this.parseStatementRecursive(sanitedStatement, stmntIndx);
|
|
990
990
|
});
|
|
991
991
|
}
|
|
@@ -997,15 +997,15 @@ class SqlProvider {
|
|
|
997
997
|
* @param parentStatement Parent opzionale per annidamento.
|
|
998
998
|
*/
|
|
999
999
|
parseStatementRecursive(statement, stmntIndx, parentStatement) {
|
|
1000
|
-
|
|
1000
|
+
let statementObj = new Statement(statement, stmntIndx + 1);
|
|
1001
1001
|
if (parentStatement) {
|
|
1002
1002
|
parentStatement.subStatements.push({ key: statement.trim(), statement: statementObj });
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1004
|
+
let subStatement;
|
|
1005
|
+
let nestedStatements = this.getNestedStatements(statement);
|
|
1006
|
+
let z = nestedStatements[0];
|
|
1007
1007
|
statementObj.statement = this.removeNestedStatements(statement, nestedStatements);
|
|
1008
|
-
|
|
1008
|
+
let previousWords = statement.split(' ').filter(x => x.length > 0).map((x, splitIndx) => {
|
|
1009
1009
|
return {
|
|
1010
1010
|
token: x.trim(),
|
|
1011
1011
|
tokenIndx: 0
|
|
@@ -1014,20 +1014,20 @@ class SqlProvider {
|
|
|
1014
1014
|
previousWords.forEach((x, indx) => {
|
|
1015
1015
|
x.tokenIndx = indx == 0 ? 0 : (previousWords[indx - 1].tokenIndx + previousWords[indx - 1].token.length + 1);
|
|
1016
1016
|
});
|
|
1017
|
-
|
|
1017
|
+
let sanitizedPreviousWords = this.normalizeStatement(previousWords);
|
|
1018
1018
|
statementObj.words = sanitizedPreviousWords;
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1019
|
+
let currentStatementTag;
|
|
1020
|
+
let found = false;
|
|
1021
|
+
let nested = null;
|
|
1022
1022
|
for (let indx = 0; indx < sanitizedPreviousWords.length; indx++) {
|
|
1023
1023
|
const elementObj = sanitizedPreviousWords[indx];
|
|
1024
|
-
|
|
1025
|
-
|
|
1024
|
+
let element = elementObj.token;
|
|
1025
|
+
let indxOffset = 0;
|
|
1026
1026
|
for (let nestedIndex = 0; nestedIndex < nestedStatements.length; nestedIndex++) {
|
|
1027
1027
|
nested = nestedStatements[nestedIndex];
|
|
1028
1028
|
if (nested.length > 1 && elementObj.tokenIndx >= nested.index && elementObj.tokenIndx <= nested.index + nested[1].length) {
|
|
1029
1029
|
this.parseStatementRecursive(nested[1], indx, subStatement);
|
|
1030
|
-
|
|
1030
|
+
let firstWordOutsideNested = sanitizedPreviousWords.find(x => x.tokenIndx > nested.index + nested[1].length);
|
|
1031
1031
|
indxOffset = sanitizedPreviousWords.indexOf(firstWordOutsideNested) - 1;
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
@@ -1087,14 +1087,14 @@ class SqlProvider {
|
|
|
1087
1087
|
* @returns `true` se e stata trovata una tabella globale.
|
|
1088
1088
|
*/
|
|
1089
1089
|
populateGlobalTables(statement, found) {
|
|
1090
|
-
|
|
1090
|
+
let tableName = statement.split(' ').find(x => x.indexOf('#') == 0);
|
|
1091
1091
|
if (tableName) {
|
|
1092
1092
|
tableName = tableName.split('(')[0];
|
|
1093
|
-
|
|
1093
|
+
let table = new SqlTable();
|
|
1094
1094
|
table.table = tableName;
|
|
1095
1095
|
table.alias = tableName;
|
|
1096
1096
|
table.columns = statement.split('(')[1].split(')')[0].split(',').map(x => {
|
|
1097
|
-
|
|
1097
|
+
let col = new SqlColumn();
|
|
1098
1098
|
col.column = x.split(' ')[0].trim();
|
|
1099
1099
|
col.table = tableName;
|
|
1100
1100
|
if (x.split(' ').length > 1) {
|
|
@@ -1117,10 +1117,10 @@ class SqlProvider {
|
|
|
1117
1117
|
*/
|
|
1118
1118
|
populateDeclarations(statement, found) {
|
|
1119
1119
|
if (statement.indexOf('@') >= 0) {
|
|
1120
|
-
|
|
1120
|
+
let decStr = statement.trim().toUpperCase().split(' ');
|
|
1121
1121
|
if (decStr.length >= 3) {
|
|
1122
|
-
|
|
1123
|
-
|
|
1122
|
+
let dec = { paramName: decStr[1], paramtype: decStr[2], usertype: null };
|
|
1123
|
+
let type;
|
|
1124
1124
|
if (decStr[2].indexOf('.') >= 0) {
|
|
1125
1125
|
type = this.userDefTypes.find(x => x.table.toUpperCase() == decStr[2].split('.')[1] && x.schema.toUpperCase() == decStr[2].split('.')[0]);
|
|
1126
1126
|
}
|
|
@@ -1146,16 +1146,16 @@ class SqlProvider {
|
|
|
1146
1146
|
* @param subStatement Sub-statement corrente.
|
|
1147
1147
|
*/
|
|
1148
1148
|
populateCurrentColumns(element, stmntIndx, statementObj, subStatement) {
|
|
1149
|
-
|
|
1149
|
+
let selStmnt = statementObj.subStatements.find(x => x.key == 'SELECT');
|
|
1150
1150
|
if (selStmnt) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1151
|
+
let columns = selStmnt.statement.statement.replace('SELECT', '').trim().toUpperCase().split(',').filter(x => x).map(x => {
|
|
1152
|
+
let col = null;
|
|
1153
1153
|
x = x.trim();
|
|
1154
|
-
|
|
1155
|
-
|
|
1154
|
+
let ownerTbl;
|
|
1155
|
+
let isAlias = false;
|
|
1156
1156
|
if (x.indexOf('.') >= 0) {
|
|
1157
|
-
|
|
1158
|
-
|
|
1157
|
+
let schema = x.split('.')[0].replace('[', '').replace(']', '').replace('(', '').replace(')', '').toUpperCase();
|
|
1158
|
+
let ownerSchema = this.schemas.find(s => s.schema.toUpperCase() === schema);
|
|
1159
1159
|
if (!ownerSchema) {
|
|
1160
1160
|
ownerSchema = this.schemas.find(x => x.tables.find(t => t.alias.toUpperCase() === schema));
|
|
1161
1161
|
if (ownerSchema) {
|
|
@@ -1167,8 +1167,8 @@ class SqlProvider {
|
|
|
1167
1167
|
ownerTbl = ownerSchema.tables.find(t => t.table.toUpperCase() === x.split('.')[1].replace('[', '').replace(']', '').replace('(', '').replace(')', '').toUpperCase());
|
|
1168
1168
|
}
|
|
1169
1169
|
if (ownerTbl) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1170
|
+
let colDef = x.split('.')[isAlias ? 1 : 2].replace('[', '').replace(']', '').replace('(', '').replace(')', '').trim().toUpperCase().split(' ');
|
|
1171
|
+
let ownerCol = ownerTbl.columns.find(c => c.column.toUpperCase() === colDef[0].toUpperCase());
|
|
1172
1172
|
if (ownerCol) {
|
|
1173
1173
|
col = {
|
|
1174
1174
|
column: ownerCol,
|
|
@@ -1178,11 +1178,11 @@ class SqlProvider {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
1180
|
else {
|
|
1181
|
-
|
|
1181
|
+
let colDef = x.trim().replace('[', '').replace(']', '').replace('(', '').replace(')', '').toUpperCase().split(' ');
|
|
1182
1182
|
if (colDef.length == 2) {
|
|
1183
|
-
|
|
1183
|
+
let tbl = statementObj.sqlTables.find(t => t.table.columns.find(c => c.column.toUpperCase() === colDef[0]));
|
|
1184
1184
|
if (tbl) {
|
|
1185
|
-
|
|
1185
|
+
let tableCol = tbl.table.columns.find(c => c.column.toUpperCase() === colDef[1]);
|
|
1186
1186
|
if (tableCol) {
|
|
1187
1187
|
col = {
|
|
1188
1188
|
column: tableCol,
|
|
@@ -1192,9 +1192,9 @@ class SqlProvider {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
1194
|
else if (colDef.length == 1) {
|
|
1195
|
-
|
|
1195
|
+
let tbl = statementObj.sqlTables.find(t => t.table.columns.find(c => c.column.toUpperCase() === colDef[0]));
|
|
1196
1196
|
if (tbl) {
|
|
1197
|
-
|
|
1197
|
+
let tableCol = tbl.table.columns.find(c => c.column.toUpperCase() === colDef[0]);
|
|
1198
1198
|
if (tableCol) {
|
|
1199
1199
|
col = {
|
|
1200
1200
|
column: tableCol,
|
|
@@ -1207,7 +1207,7 @@ class SqlProvider {
|
|
|
1207
1207
|
return col;
|
|
1208
1208
|
}).filter(x => x);
|
|
1209
1209
|
columns.forEach(x => {
|
|
1210
|
-
|
|
1210
|
+
let normalizedColumn = x?.column?.column?.toUpperCase();
|
|
1211
1211
|
if (!normalizedColumn) {
|
|
1212
1212
|
return;
|
|
1213
1213
|
}
|
|
@@ -1236,11 +1236,11 @@ class SqlProvider {
|
|
|
1236
1236
|
populateAlias(element, stmntIndx, found, statementObj, subStatement) {
|
|
1237
1237
|
if (subStatement) {
|
|
1238
1238
|
if (subStatement.words.length > 1) {
|
|
1239
|
-
|
|
1239
|
+
let alias = subStatement.words[1].token.replace('[', '').replace(']', '').replace('(', '').replace(')', '');
|
|
1240
1240
|
if (alias) {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1241
|
+
let fromStmnt; // = statementObj.subStatements.find(x => x.key == 'FROM');
|
|
1242
|
+
let matchTbl;
|
|
1243
|
+
let subStatementIndex = statementObj.subStatements.indexOf(statementObj.subStatements.find(x => x.statement.statement == subStatement.statement));
|
|
1244
1244
|
if (subStatementIndex > 1) {
|
|
1245
1245
|
fromStmnt = statementObj.subStatements[subStatementIndex - 1];
|
|
1246
1246
|
}
|
|
@@ -1277,12 +1277,12 @@ class SqlProvider {
|
|
|
1277
1277
|
* @returns `true` se tabella schema-resolved trovata.
|
|
1278
1278
|
*/
|
|
1279
1279
|
populateCurrentSchemaTables(element, stmntIndx, found, statementObj, subStatement) {
|
|
1280
|
-
|
|
1280
|
+
let tblStr = element.trim().toUpperCase().split(' ');
|
|
1281
1281
|
if (tblStr.length > 0 && tblStr[0].split('.').length > 1) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1282
|
+
let identifierParts = tblStr[0].replace('[', '').replace(']', '').split('.').filter(x => x);
|
|
1283
|
+
let schemaName = '';
|
|
1284
|
+
let tableName = '';
|
|
1285
|
+
let dbName = '';
|
|
1286
1286
|
if (identifierParts.length >= 3) {
|
|
1287
1287
|
dbName = identifierParts[0];
|
|
1288
1288
|
schemaName = identifierParts[1];
|
|
@@ -1292,34 +1292,34 @@ class SqlProvider {
|
|
|
1292
1292
|
schemaName = identifierParts[0];
|
|
1293
1293
|
tableName = (identifierParts[1] || '').split('(')[0];
|
|
1294
1294
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1295
|
+
let match = this.schemas.find(x => {
|
|
1296
|
+
let modelSchema = this.getModelSchemaName(x).toUpperCase();
|
|
1297
|
+
let modelDb = (this.getModelDatabaseName(x) || '').toUpperCase();
|
|
1298
1298
|
return modelSchema === schemaName.toUpperCase() && (!dbName || modelDb === dbName.toUpperCase());
|
|
1299
1299
|
});
|
|
1300
1300
|
if (match) {
|
|
1301
1301
|
if (statementObj) {
|
|
1302
|
-
|
|
1302
|
+
let matchSchema = statementObj.sqlModels.find(x => match.schema.toUpperCase() === x.schema.toUpperCase());
|
|
1303
1303
|
if (!matchSchema) {
|
|
1304
1304
|
statementObj.sqlModels.push(match);
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
1307
|
if (subStatement) {
|
|
1308
|
-
|
|
1308
|
+
let matchSchema = subStatement.sqlModels.find(x => match.schema.toUpperCase() === x.schema.toUpperCase());
|
|
1309
1309
|
if (!matchSchema) {
|
|
1310
1310
|
subStatement.sqlModels.push(match);
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
|
-
|
|
1313
|
+
let matchTable = match.tables.find(x => x.table.toUpperCase() === tableName.toUpperCase());
|
|
1314
1314
|
if (matchTable) {
|
|
1315
1315
|
if (statementObj) {
|
|
1316
|
-
|
|
1316
|
+
let matchTbl = statementObj.sqlTables.find(x => x.table.table.toUpperCase() == matchTable.table.toUpperCase() && x.table.schema.toUpperCase() == matchTable.schema.toUpperCase());
|
|
1317
1317
|
if (!matchTbl) {
|
|
1318
1318
|
statementObj.sqlTables.push({ table: matchTable, usedAlias: '' });
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
1321
|
if (subStatement) {
|
|
1322
|
-
|
|
1322
|
+
let matchTbl = subStatement.sqlTables.find(x => x.table.table.toUpperCase() == matchTable.table.toUpperCase() && x.table.schema.toUpperCase() == matchTable.schema.toUpperCase());
|
|
1323
1323
|
if (!matchTbl) {
|
|
1324
1324
|
subStatement.sqlTables.push({ table: matchTable, usedAlias: '' });
|
|
1325
1325
|
}
|
|
@@ -1328,13 +1328,13 @@ class SqlProvider {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
1330
|
else {
|
|
1331
|
-
|
|
1332
|
-
|
|
1331
|
+
let aliasCandidate = identifierParts[0] || '';
|
|
1332
|
+
let matchTbl = statementObj.sqlTables.find(x => x.usedAlias.toUpperCase() === aliasCandidate.toUpperCase());
|
|
1333
1333
|
if (matchTbl) {
|
|
1334
1334
|
if (!subStatement.sqlTables.find(x => x.table.table.toUpperCase() == matchTbl.table.table.toUpperCase() && x.table.schema.toUpperCase() == matchTbl.table.schema.toUpperCase())) {
|
|
1335
1335
|
subStatement.sqlTables.push({ table: matchTbl.table, usedAlias: matchTbl.usedAlias });
|
|
1336
1336
|
}
|
|
1337
|
-
|
|
1337
|
+
let matchSchema = statementObj.sqlModels.find(x => matchTbl.table.schema.toUpperCase() === x.schema.toUpperCase());
|
|
1338
1338
|
if (matchSchema && !subStatement.sqlModels.find(x => matchTbl.table.schema.toUpperCase() === x.schema.toUpperCase())) {
|
|
1339
1339
|
subStatement.sqlModels.push(matchSchema);
|
|
1340
1340
|
}
|
|
@@ -1346,14 +1346,14 @@ class SqlProvider {
|
|
|
1346
1346
|
// #endregion
|
|
1347
1347
|
// #region create suggestions
|
|
1348
1348
|
getSuggestionsByContext(context, range, originalText, contextInfo, scaffoldedOnly = true) {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1349
|
+
let ci = [];
|
|
1350
|
+
let selectFields = [];
|
|
1351
|
+
let newLinePrepend = '';
|
|
1352
1352
|
if (range.endLineNumber == 1 || originalText.split('\r\n')[range.endLineNumber - 1].indexOf(' ') > 0) {
|
|
1353
1353
|
newLinePrepend = '\r\n';
|
|
1354
1354
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1355
|
+
let currentStatement = contextInfo.currentStatement;
|
|
1356
|
+
let currentSubStatement;
|
|
1357
1357
|
if (currentStatement) {
|
|
1358
1358
|
currentSubStatement = contextInfo.currentSubStatement.statement;
|
|
1359
1359
|
}
|
|
@@ -1508,8 +1508,8 @@ class SqlProvider {
|
|
|
1508
1508
|
return true;
|
|
1509
1509
|
}).filter(x => {
|
|
1510
1510
|
if (context == autocompleteContext.columnWhereRestricted) {
|
|
1511
|
-
|
|
1512
|
-
|
|
1511
|
+
let restrictedToken = (currentSubStatement?.words?.[currentSubStatement.words.length - 1]?.token || '').trim();
|
|
1512
|
+
let restrictedParts = restrictedToken
|
|
1513
1513
|
.replace('[', '')
|
|
1514
1514
|
.replace(']', '')
|
|
1515
1515
|
.replace('(', '')
|
|
@@ -1518,32 +1518,32 @@ class SqlProvider {
|
|
|
1518
1518
|
.filter(y => y)
|
|
1519
1519
|
.map(y => y.trim().toUpperCase());
|
|
1520
1520
|
if (!scaffoldedOnly && restrictedParts.length >= 3) {
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1521
|
+
let dbFilter = restrictedParts[0];
|
|
1522
|
+
let schemaFilter = restrictedParts[1];
|
|
1523
|
+
let tableFilter = restrictedParts[2];
|
|
1524
|
+
let colDb = (this.getColumnDatabaseName(x) || '').toUpperCase();
|
|
1525
1525
|
return x.schema.toUpperCase() === schemaFilter
|
|
1526
1526
|
&& x.table.toUpperCase() === tableFilter
|
|
1527
1527
|
&& (!dbFilter || colDb === dbFilter);
|
|
1528
1528
|
}
|
|
1529
1529
|
if (restrictedParts.length >= 1 && restrictedToken.indexOf('.') >= 0) {
|
|
1530
|
-
|
|
1530
|
+
let aliasFilter = restrictedParts[0];
|
|
1531
1531
|
return (x.tableAlias || '').toUpperCase() === aliasFilter;
|
|
1532
1532
|
}
|
|
1533
|
-
|
|
1533
|
+
let scopedTables = (currentSubStatement?.sqlTables && currentSubStatement.sqlTables.length > 0)
|
|
1534
1534
|
? currentSubStatement.sqlTables
|
|
1535
1535
|
: (currentStatement?.sqlTables || []);
|
|
1536
1536
|
return scopedTables.find(y => (y.usedAlias || '').toUpperCase() == (x.tableAlias || '').toUpperCase());
|
|
1537
1537
|
}
|
|
1538
1538
|
return true;
|
|
1539
1539
|
}).map(x => {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1540
|
+
let restrictedToken = (currentSubStatement?.words?.[currentSubStatement.words.length - 1]?.token || '').trim();
|
|
1541
|
+
let isAliasQualifiedCompletion = context == autocompleteContext.columnWhereRestricted && restrictedToken.indexOf('.') >= 0;
|
|
1542
|
+
let aliasStmnts = currentStatement.subStatements.filter(s => s.key == 'FROM' || s.key.indexOf('JOIN') >= 0 || s.key == 'ON');
|
|
1543
|
+
let aliasStmnt = aliasStmnts.find(y => y.statement.sqlTables.length > 0 &&
|
|
1544
1544
|
y.statement.sqlTables[0].table.schema.toUpperCase() == x.schema.toUpperCase() &&
|
|
1545
1545
|
y.statement.sqlTables[0].table.table.toUpperCase() == x.table.toUpperCase());
|
|
1546
|
-
|
|
1546
|
+
let str = `${x.schema}.${x.table}.${x.column}`;
|
|
1547
1547
|
if (context == autocompleteContext.columnWhereSkipAlias) {
|
|
1548
1548
|
str = x.column;
|
|
1549
1549
|
}
|
|
@@ -1554,7 +1554,7 @@ class SqlProvider {
|
|
|
1554
1554
|
else if (aliasStmnt) {
|
|
1555
1555
|
str = `${aliasStmnt.statement.sqlTables[0].usedAlias}.${x.column}`;
|
|
1556
1556
|
}
|
|
1557
|
-
|
|
1557
|
+
let longDescr = `${x.column} (${x.type}, ${x.isNullable ? 'null' : 'not null'})${x.columnDescription ? ` - ${x.columnDescription}` : ''}`;
|
|
1558
1558
|
return {
|
|
1559
1559
|
documentation: longDescr,
|
|
1560
1560
|
insertText: str,
|
|
@@ -1564,7 +1564,7 @@ class SqlProvider {
|
|
|
1564
1564
|
};
|
|
1565
1565
|
}));
|
|
1566
1566
|
if (context == autocompleteContext.columnSelect || context == autocompleteContext.columnWhere || context == autocompleteContext.columnWhereSkipAlias) {
|
|
1567
|
-
|
|
1567
|
+
let allCols = ci.map(x => {
|
|
1568
1568
|
return x.insertText;
|
|
1569
1569
|
}).join(',');
|
|
1570
1570
|
ci.push({
|
|
@@ -1660,16 +1660,16 @@ class SqlProvider {
|
|
|
1660
1660
|
case autocompleteContext.table:
|
|
1661
1661
|
case autocompleteContext.tableNoAs:
|
|
1662
1662
|
case autocompleteContext.tableJoin:
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1663
|
+
let rawScopedToken = (currentSubStatement?.words?.[currentSubStatement.words.length - 1]?.token || '').trim();
|
|
1664
|
+
let currentSchema = currentStatement.sqlModels[currentStatement.sqlModels.length - 1]?.schema;
|
|
1665
|
+
let scopedParts = rawScopedToken
|
|
1666
1666
|
.replace('[', '')
|
|
1667
1667
|
.replace(']', '')
|
|
1668
1668
|
.replace('(', '')
|
|
1669
1669
|
.replace(')', '')
|
|
1670
1670
|
.split('.')
|
|
1671
1671
|
.filter(x => x);
|
|
1672
|
-
|
|
1672
|
+
let isDbScopedSchema = !scaffoldedOnly && rawScopedToken.indexOf('.') >= 0;
|
|
1673
1673
|
if (context == autocompleteContext.tableJoin) {
|
|
1674
1674
|
currentStatement.sqlTables.forEach(tbl => {
|
|
1675
1675
|
this.parseTblRelations(currentStatement, tbl, ci, range, currentSchema);
|
|
@@ -1677,11 +1677,11 @@ class SqlProvider {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
else {
|
|
1679
1679
|
if (isDbScopedSchema && rawScopedToken.endsWith('.') && scopedParts.length == 1) {
|
|
1680
|
-
|
|
1681
|
-
|
|
1680
|
+
let dbToken = scopedParts[0].toUpperCase();
|
|
1681
|
+
let dbModels = this.schemas.filter(x => (this.getModelDatabaseName(x) || '').toUpperCase() === dbToken);
|
|
1682
1682
|
if (dbModels.length > 0) {
|
|
1683
1683
|
ci = dbModels.map(x => {
|
|
1684
|
-
|
|
1684
|
+
let schemaLabel = this.getModelSchemaName(x);
|
|
1685
1685
|
return {
|
|
1686
1686
|
documentation: schemaLabel,
|
|
1687
1687
|
insertText: schemaLabel,
|
|
@@ -1693,15 +1693,15 @@ class SqlProvider {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
else {
|
|
1695
1695
|
// Token is likely a schema without db prefix: resolve against default db.
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1696
|
+
let defaultDb = this.getDefaultDatabaseName();
|
|
1697
|
+
let schemaToken = scopedParts[0];
|
|
1698
|
+
let defaultScopedModel = this.schemas.find(x => this.getModelSchemaName(x).toUpperCase() === schemaToken.toUpperCase()
|
|
1699
1699
|
&& (!defaultDb || (this.getModelDatabaseName(x) || '').toUpperCase() === defaultDb.toUpperCase()));
|
|
1700
|
-
|
|
1700
|
+
let sourceTables = defaultScopedModel?.tables || [];
|
|
1701
1701
|
ci = sourceTables.map(x => {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1702
|
+
let txtLine = originalText.split('\n')[range.startLineNumber - 1];
|
|
1703
|
+
let startCol = txtLine.toUpperCase().indexOf(`${schemaToken.toUpperCase()}.`);
|
|
1704
|
+
let replaceStartColumn = startCol >= 0 ? startCol + 1 : range.startColumn;
|
|
1705
1705
|
return {
|
|
1706
1706
|
documentation: x.table,
|
|
1707
1707
|
// The user already typed "<schema>." so only append table name.
|
|
@@ -1723,24 +1723,24 @@ class SqlProvider {
|
|
|
1723
1723
|
}
|
|
1724
1724
|
break;
|
|
1725
1725
|
}
|
|
1726
|
-
|
|
1726
|
+
let scopedModel = null;
|
|
1727
1727
|
if (isDbScopedSchema && scopedParts.length >= 2) {
|
|
1728
|
-
|
|
1729
|
-
|
|
1728
|
+
let dbName = scopedParts[0];
|
|
1729
|
+
let schemaName = scopedParts[1];
|
|
1730
1730
|
scopedModel = this.schemas.find(x => (this.getModelDatabaseName(x) || '').toUpperCase() === dbName.toUpperCase()
|
|
1731
1731
|
&& this.getModelSchemaName(x).toUpperCase() === schemaName.toUpperCase());
|
|
1732
1732
|
}
|
|
1733
1733
|
else if (currentSchema) {
|
|
1734
1734
|
scopedModel = this.schemas.find(x => this.getModelSchemaName(x).toUpperCase() === currentSchema.toUpperCase());
|
|
1735
1735
|
}
|
|
1736
|
-
|
|
1736
|
+
let sourceTables = scopedModel?.tables || [];
|
|
1737
1737
|
ci = sourceTables.map(x => {
|
|
1738
1738
|
try {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1739
|
+
let txtLine = originalText.split('\n')[range.startLineNumber - 1];
|
|
1740
|
+
let qualifiedSchema = scopedModel ? this.getModelSchemaName(scopedModel) : x.schema;
|
|
1741
|
+
let startCol = txtLine.toUpperCase().indexOf(`${qualifiedSchema.toUpperCase()}.`);
|
|
1742
|
+
let tokenHasQualifier = rawScopedToken.indexOf('.') >= 0;
|
|
1743
|
+
let insertTxt = (!x.alias || context == autocompleteContext.tableNoAs) ?
|
|
1744
1744
|
(tokenHasQualifier
|
|
1745
1745
|
? x.table
|
|
1746
1746
|
: `${context != autocompleteContext.tableNoAs ? `${qualifiedSchema}.` : ''}${x.table}`)
|
|
@@ -1771,8 +1771,8 @@ class SqlProvider {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
break;
|
|
1773
1773
|
case autocompleteContext.declaration:
|
|
1774
|
-
|
|
1775
|
-
|
|
1774
|
+
let paramName = '@Param';
|
|
1775
|
+
let paramIndx = 1;
|
|
1776
1776
|
while (this.currents.declarations.find(x => x.paramName.toUpperCase() === `${paramName}${paramIndx.toString()}`.toUpperCase())) {
|
|
1777
1777
|
paramIndx++;
|
|
1778
1778
|
}
|
|
@@ -1822,7 +1822,7 @@ class SqlProvider {
|
|
|
1822
1822
|
break;
|
|
1823
1823
|
default:
|
|
1824
1824
|
}
|
|
1825
|
-
|
|
1825
|
+
let t = {
|
|
1826
1826
|
suggestions: ci
|
|
1827
1827
|
};
|
|
1828
1828
|
return t;
|
|
@@ -1838,11 +1838,11 @@ class SqlProvider {
|
|
|
1838
1838
|
if (!model) {
|
|
1839
1839
|
return null;
|
|
1840
1840
|
}
|
|
1841
|
-
|
|
1841
|
+
let modelAny = model;
|
|
1842
1842
|
if (modelAny.database) {
|
|
1843
1843
|
return modelAny.database;
|
|
1844
1844
|
}
|
|
1845
|
-
|
|
1845
|
+
let schema = model.schema || '';
|
|
1846
1846
|
if (schema.indexOf('.') >= 0) {
|
|
1847
1847
|
return schema.split('.')[0];
|
|
1848
1848
|
}
|
|
@@ -1857,7 +1857,7 @@ class SqlProvider {
|
|
|
1857
1857
|
if (!model) {
|
|
1858
1858
|
return '';
|
|
1859
1859
|
}
|
|
1860
|
-
|
|
1860
|
+
let schema = model.schema || '';
|
|
1861
1861
|
if (schema.indexOf('.') >= 0) {
|
|
1862
1862
|
return schema.split('.').slice(1).join('.');
|
|
1863
1863
|
}
|
|
@@ -1872,7 +1872,7 @@ class SqlProvider {
|
|
|
1872
1872
|
if (!column) {
|
|
1873
1873
|
return null;
|
|
1874
1874
|
}
|
|
1875
|
-
|
|
1875
|
+
let ownerModel = this.schemas.find(m => this.getModelSchemaName(m).toUpperCase() === (column.schema || '').toUpperCase()
|
|
1876
1876
|
&& m.tables?.find(t => t.table.toUpperCase() === (column.table || '').toUpperCase()));
|
|
1877
1877
|
return this.getModelDatabaseName(ownerModel);
|
|
1878
1878
|
}
|
|
@@ -1881,7 +1881,7 @@ class SqlProvider {
|
|
|
1881
1881
|
* @returns Nome database default.
|
|
1882
1882
|
*/
|
|
1883
1883
|
getDefaultDatabaseName() {
|
|
1884
|
-
|
|
1884
|
+
let defaultModel = this.schemas.find(m => m?.isDefault);
|
|
1885
1885
|
if (defaultModel) {
|
|
1886
1886
|
return this.getModelDatabaseName(defaultModel);
|
|
1887
1887
|
}
|
|
@@ -1896,9 +1896,9 @@ class SqlProvider {
|
|
|
1896
1896
|
* @param schemaFilter Filtro schema opzionale.
|
|
1897
1897
|
*/
|
|
1898
1898
|
parseTblRelations(statement, tbl, ci, range, schemaFilter) {
|
|
1899
|
-
|
|
1899
|
+
let relations = [];
|
|
1900
1900
|
tbl.table.columns.forEach(col => {
|
|
1901
|
-
|
|
1901
|
+
let rel = col.childRelations.find(rel => {
|
|
1902
1902
|
if (schemaFilter) {
|
|
1903
1903
|
return rel.schemaFK.toUpperCase() === schemaFilter.toUpperCase();
|
|
1904
1904
|
}
|
|
@@ -1912,11 +1912,11 @@ class SqlProvider {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
});
|
|
1914
1914
|
relations.forEach(rel => {
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1915
|
+
let joinSuggestion = "";
|
|
1916
|
+
let tblPK = this.schemas.find(x => x.schema.toUpperCase() === rel.schemaPK.toUpperCase()).tables.find(x => x.table.toUpperCase() === rel.tablePK.toUpperCase());
|
|
1917
|
+
let tblFK = this.schemas.find(x => x.schema.toUpperCase() === rel.schemaFK.toUpperCase()).tables.find(x => x.table.toUpperCase() === rel.tableFK.toUpperCase());
|
|
1918
|
+
let aliasTblPK;
|
|
1919
|
+
let aliasTblFK;
|
|
1920
1920
|
if (rel.schemaFK == tbl.table.schema && rel.tableFK == tbl.table.table) {
|
|
1921
1921
|
aliasTblPK = tblPK.alias ? tblPK.alias : `${tblPK.schema}.${tblPK.table}`;
|
|
1922
1922
|
aliasTblFK = tbl.usedAlias ? tbl.usedAlias : (tblFK.alias ? tblFK.alias : `${tblFK.schema}.${tblFK.table}`);
|
|
@@ -1943,7 +1943,7 @@ class SqlProvider {
|
|
|
1943
1943
|
* @returns Tabella risolta oppure `undefined`.
|
|
1944
1944
|
*/
|
|
1945
1945
|
getTableByAlias(alias, statement) {
|
|
1946
|
-
|
|
1946
|
+
let tbl;
|
|
1947
1947
|
this.schemas.forEach(schema => {
|
|
1948
1948
|
schema.tables.forEach(table => {
|
|
1949
1949
|
if (table.alias && table.alias.toUpperCase() === alias.toUpperCase()) {
|
|
@@ -1974,9 +1974,9 @@ let DragDropInteractionEmitter$1 = class DragDropInteractionEmitter extends Emit
|
|
|
1974
1974
|
* @param event Evento drop con posizione Monaco.
|
|
1975
1975
|
*/
|
|
1976
1976
|
fire(event) {
|
|
1977
|
-
|
|
1977
|
+
let self = this;
|
|
1978
1978
|
self.position = event.position;
|
|
1979
|
-
|
|
1979
|
+
let de = {
|
|
1980
1980
|
event: {
|
|
1981
1981
|
dataTransfer: {
|
|
1982
1982
|
items: [
|
|
@@ -1985,19 +1985,19 @@ let DragDropInteractionEmitter$1 = class DragDropInteractionEmitter extends Emit
|
|
|
1985
1985
|
type: 'text/plain',
|
|
1986
1986
|
getAsFile: () => { return null; },
|
|
1987
1987
|
getAsString: (callback) => {
|
|
1988
|
-
|
|
1988
|
+
let dataItem = JSON.parse(event.event.dataTransfer.getData('text/plain'));
|
|
1989
1989
|
if (dataItem) {
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1990
|
+
let providerSchemas = (self.sqlProvider.schemas || []);
|
|
1991
|
+
let getDbPrefixFor = (schemaName, tableName, preferredDbName) => {
|
|
1992
|
+
let owner = providerSchemas.find(m => {
|
|
1993
1993
|
if (preferredDbName) {
|
|
1994
|
-
|
|
1994
|
+
let mDb = (m.database || ((m.schema || '').indexOf('.') >= 0 ? (m.schema || '').split('.')[0] : '') || '').toUpperCase();
|
|
1995
1995
|
if (mDb !== preferredDbName.toUpperCase()) {
|
|
1996
1996
|
return false;
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
|
-
|
|
2000
|
-
|
|
1999
|
+
let mSchema = (m.schema || '').indexOf('.') >= 0 ? (m.schema || '').split('.').slice(1).join('.') : (m.schema || '');
|
|
2000
|
+
let schemaMatch = mSchema.toUpperCase() === (schemaName || '').toUpperCase();
|
|
2001
2001
|
if (!schemaMatch) {
|
|
2002
2002
|
return false;
|
|
2003
2003
|
}
|
|
@@ -2009,25 +2009,25 @@ let DragDropInteractionEmitter$1 = class DragDropInteractionEmitter extends Emit
|
|
|
2009
2009
|
if (!owner) {
|
|
2010
2010
|
return '';
|
|
2011
2011
|
}
|
|
2012
|
-
|
|
2012
|
+
let db = owner.database || ((owner.schema || '').indexOf('.') >= 0 ? (owner.schema || '').split('.')[0] : '');
|
|
2013
2013
|
return db ? `${db}.` : '';
|
|
2014
2014
|
};
|
|
2015
2015
|
if (dataItem.sqlModel) {
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2016
|
+
let modelAny = dataItem.sqlModel;
|
|
2017
|
+
let modelDb = modelAny.database || ((dataItem.sqlModel.schema || '').indexOf('.') >= 0 ? (dataItem.sqlModel.schema || '').split('.')[0] : '');
|
|
2018
|
+
let modelSchema = (dataItem.sqlModel.schema || '').indexOf('.') >= 0
|
|
2019
2019
|
? (dataItem.sqlModel.schema || '').split('.').slice(1).join('.')
|
|
2020
2020
|
: (dataItem.sqlModel.schema || '');
|
|
2021
2021
|
callback(modelDb ? `${modelDb}.${modelSchema}.` : `${modelSchema}.`);
|
|
2022
2022
|
}
|
|
2023
2023
|
else if (dataItem.sqlTable) {
|
|
2024
|
-
|
|
2025
|
-
|
|
2024
|
+
let tableDbName = dataItem.sqlDatabase;
|
|
2025
|
+
let tblDbPrefix = tableDbName ? `${tableDbName}.` : getDbPrefixFor(dataItem.sqlTable.schema, dataItem.sqlTable.table);
|
|
2026
2026
|
callback(`${tblDbPrefix}${dataItem.sqlTable.schema}.${dataItem.sqlTable.table}`);
|
|
2027
2027
|
}
|
|
2028
2028
|
else if (dataItem.parentTable) {
|
|
2029
|
-
|
|
2030
|
-
|
|
2029
|
+
let suggestions = self.sqlProvider.getAutocompleteSuggestions(self.editor.getValue(), self.position);
|
|
2030
|
+
let colSugg = suggestions.suggestions.find(x => x.label == '<All columns>');
|
|
2031
2031
|
if (colSugg) {
|
|
2032
2032
|
callback(colSugg.insertText);
|
|
2033
2033
|
}
|
|
@@ -2036,21 +2036,21 @@ let DragDropInteractionEmitter$1 = class DragDropInteractionEmitter extends Emit
|
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
2038
|
else if (dataItem.sqlColumn) {
|
|
2039
|
-
|
|
2040
|
-
|
|
2039
|
+
let suggestions = self.sqlProvider.getAutocompleteSuggestions(self.editor.getValue(), self.position);
|
|
2040
|
+
let colSugg = suggestions.suggestions.find(x => x.insertText.indexOf(dataItem.sqlColumn.column) >= 0);
|
|
2041
2041
|
if (colSugg) {
|
|
2042
2042
|
callback(colSugg.insertText);
|
|
2043
2043
|
}
|
|
2044
2044
|
else {
|
|
2045
|
-
|
|
2046
|
-
|
|
2045
|
+
let columnDbName = dataItem.sqlDatabase;
|
|
2046
|
+
let colDbPrefix = columnDbName ? `${columnDbName}.` : getDbPrefixFor(dataItem.sqlColumn.schema, dataItem.sqlColumn.table);
|
|
2047
2047
|
callback(`${colDbPrefix}${dataItem.sqlColumn.schema}.${dataItem.sqlColumn.table}.${dataItem.sqlColumn.column}`);
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
2050
|
else if (dataItem.sqlRelation) {
|
|
2051
|
-
|
|
2051
|
+
let suggestions = self.sqlProvider.getAutocompleteSuggestions(self.editor.getValue(), self.position);
|
|
2052
2052
|
if (suggestions && suggestions.suggestions) {
|
|
2053
|
-
|
|
2053
|
+
let relSugg = suggestions.suggestions.find(x => x.insertText.indexOf(`${dataItem.sqlRelation.schemaPK}.${dataItem.sqlRelation.tablePK}`) >= 0);
|
|
2054
2054
|
if (relSugg) {
|
|
2055
2055
|
callback(relSugg.insertText);
|
|
2056
2056
|
}
|
|
@@ -2266,12 +2266,12 @@ class TSProvider {
|
|
|
2266
2266
|
editor;
|
|
2267
2267
|
contextMenuEvent;
|
|
2268
2268
|
snippets = {
|
|
2269
|
-
'http.get': `
|
|
2270
|
-
'http.post': `
|
|
2271
|
-
'prompt.text': `
|
|
2272
|
-
'msgbox.show': `
|
|
2269
|
+
'http.get': `let getResults = await (wtoolbox.http.get(wtoolbox.appSettings.api_url + '<method>').toPromise() as Promise<any>);`,
|
|
2270
|
+
'http.post': `let postResults = await (wtoolbox.http.post(wtoolbox.appSettings.api_url + '<method>', { }).toPromise() as Promise<any>);`,
|
|
2271
|
+
'prompt.text': `let promptResult = await wtoolbox.promptDialog('Title', 'Caption', [{ name: 'prompt', caption: 'prompt', type: 'text' }]);`,
|
|
2272
|
+
'msgbox.show': `let msboxResponse = await wtoolbox.confirm({ message: 'Are you sure?', header: 'Yes', acceptLabel: 'OK', rejectLabel: 'Cancel' });`,
|
|
2273
2273
|
'toast.show': `wtoolbox.messageNotificationService.add({ severity: 'success', summary: 'Success', detail: 'message...' });`,
|
|
2274
|
-
'select.by.route': `
|
|
2274
|
+
'select.by.route': `let selectResults:ResultInfo = await wtoolbox.dataService.selectByRoute('<routeName>', [], []);`,
|
|
2275
2275
|
};
|
|
2276
2276
|
constructor(http, editorOptions) {
|
|
2277
2277
|
this.http = http;
|
|
@@ -2284,8 +2284,8 @@ class TSProvider {
|
|
|
2284
2284
|
* @param snippetValue Contenuto snippet da inserire.
|
|
2285
2285
|
*/
|
|
2286
2286
|
snippeter(snippetKey, snippetValue) {
|
|
2287
|
-
|
|
2288
|
-
|
|
2287
|
+
let id = { major: 1, minor: 1 };
|
|
2288
|
+
let op = { identifier: id, range: this.contextMenuEvent.target.range, text: snippetValue, forceMoveMarkers: true };
|
|
2289
2289
|
this.editor.executeEdits("snippet." + snippetKey, [op]);
|
|
2290
2290
|
}
|
|
2291
2291
|
/**
|
|
@@ -2312,10 +2312,10 @@ class TSProvider {
|
|
|
2312
2312
|
* @param userInfo Contesto utente runtime.
|
|
2313
2313
|
*/
|
|
2314
2314
|
async registerTSProvider(formFieldOptions, field, codeContext, record, metaSrv, userInfo) {
|
|
2315
|
-
|
|
2315
|
+
let self = this;
|
|
2316
2316
|
let extraLibs = [];
|
|
2317
|
-
|
|
2318
|
-
|
|
2317
|
+
let libs = [];
|
|
2318
|
+
let contextMenuItems = [
|
|
2319
2319
|
{
|
|
2320
2320
|
label: 'Snippets', icon: 'pi pi-receipt',
|
|
2321
2321
|
items: []
|
|
@@ -2345,7 +2345,7 @@ class TSProvider {
|
|
|
2345
2345
|
this.editorOptions.onNodeDragEnd = (event, dataItem) => {
|
|
2346
2346
|
// debugger;
|
|
2347
2347
|
};
|
|
2348
|
-
|
|
2348
|
+
let compilerOptions = {
|
|
2349
2349
|
target: monaco.languages.typescript.ScriptTarget.ES2016,
|
|
2350
2350
|
allowNonTsExtensions: true,
|
|
2351
2351
|
moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
|
|
@@ -2372,7 +2372,7 @@ class TSProvider {
|
|
|
2372
2372
|
// // },
|
|
2373
2373
|
// // ....
|
|
2374
2374
|
// libs.push(this.http.get("assets/models/easygrid.server.d.ts", { responseType: 'text' }));
|
|
2375
|
-
|
|
2375
|
+
let headers = new HttpHeaders({
|
|
2376
2376
|
'Cache-Control': 'no-cache, no-store, must-revalidate, post-check=0, pre- check=0',
|
|
2377
2377
|
'Pragma': 'no-cache',
|
|
2378
2378
|
'Expires': '0'
|
|
@@ -2387,34 +2387,34 @@ class TSProvider {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
codeContext = formFieldOptions.codeContext || '';
|
|
2389
2389
|
if (codeContext) {
|
|
2390
|
-
|
|
2391
|
-
|
|
2390
|
+
let routeIdContextField = field.extras.customEditorConfig?.routeContextField;
|
|
2391
|
+
let columnContextField = field.extras.customEditorConfig?.columnContextField;
|
|
2392
2392
|
if (codeContext.indexOf('record: ') >= 0 && routeIdContextField) {
|
|
2393
|
-
|
|
2393
|
+
let routeId = record[routeIdContextField]?.value; // this.metaInfo.tableMetadata.md_route_name.replaceAll(' ', '_');
|
|
2394
2394
|
if (routeId) {
|
|
2395
|
-
|
|
2396
|
-
|
|
2395
|
+
let metas = await metaSrv.getMetadatiById(routeId);
|
|
2396
|
+
let currentColumnMeta = null;
|
|
2397
2397
|
if (columnContextField) {
|
|
2398
2398
|
currentColumnMeta = metas.find(m => m.mc_id == record[columnContextField].value);
|
|
2399
2399
|
}
|
|
2400
2400
|
if (metas && metas.length) {
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
for (
|
|
2401
|
+
let routeName = metas[0]._Metadati_Tabelle.md_route_name.replaceAll(' ', '_');
|
|
2402
|
+
let classProperties = '';
|
|
2403
|
+
let classPropsArray = [];
|
|
2404
|
+
let compositeTypeDef = '';
|
|
2405
|
+
for (let c of metas) {
|
|
2406
2406
|
compositeTypeDef += `'${c.mc_nome_colonna}': BehaviorSubject<${MetadataProviderService.getTSTypeFromMetaColumn(c)}>;`;
|
|
2407
|
-
|
|
2407
|
+
let lookupRoute = '';
|
|
2408
2408
|
if (c.mc_ui_column_type == 'lookupByID') {
|
|
2409
|
-
|
|
2409
|
+
let lookupRoute = c.mc_ui_lookup_entity_name;
|
|
2410
2410
|
if (lookupRoute) {
|
|
2411
2411
|
compositeTypeDef += `'${c.mc_nome_colonna + '__lookup_obj'}': BehaviorSubject<${lookupRoute}>;`;
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2412
|
+
let lookupMetas = await metaSrv.getMetadati(lookupRoute);
|
|
2413
|
+
let nestedClassProperties = '';
|
|
2414
|
+
let nestedClassPropsArray = [];
|
|
2415
2415
|
if (lookupMetas && lookupMetas.length) {
|
|
2416
2416
|
lookupRoute = lookupRoute.replaceAll(' ', '_');
|
|
2417
|
-
for (
|
|
2417
|
+
for (let cLookup of lookupMetas) {
|
|
2418
2418
|
nestedClassPropsArray.push(`${cLookup.mc_nome_colonna}: ${MetadataProviderService.getTSTypeFromMetaColumn(cLookup)};`);
|
|
2419
2419
|
}
|
|
2420
2420
|
nestedClassProperties = nestedClassPropsArray.join('\n');
|
|
@@ -2452,8 +2452,8 @@ class TSProvider {
|
|
|
2452
2452
|
else {
|
|
2453
2453
|
codeContext = codeContext.replace('record: {[key: string]: BehaviorSubject<any>}', `record: {${compositeTypeDef}}`);
|
|
2454
2454
|
}
|
|
2455
|
-
if (currentColumnMeta && currentColumnMeta.mc_ui_column_type == 'lookupByID' && codeContext.indexOf('
|
|
2456
|
-
codeContext = codeContext.replace('
|
|
2455
|
+
if (currentColumnMeta && currentColumnMeta.mc_ui_column_type == 'lookupByID' && codeContext.indexOf('let newValue: any;') >= 0) {
|
|
2456
|
+
codeContext = codeContext.replace('let newValue: any;', `let newValue: ${currentColumnMeta.mc_ui_lookup_entity_name};`);
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
2459
|
}
|
|
@@ -2464,14 +2464,14 @@ class TSProvider {
|
|
|
2464
2464
|
combineLatest(libs).subscribe(libsContent => {
|
|
2465
2465
|
console.log('TypeScript provider extra libs loaded:', libsContent);
|
|
2466
2466
|
libsContent.forEach((data) => {
|
|
2467
|
-
|
|
2467
|
+
let lines = data.split('\n');
|
|
2468
2468
|
// da migliorare con regex !!!
|
|
2469
|
-
|
|
2469
|
+
let parsedLines = lines.filter(x => {
|
|
2470
2470
|
return x.indexOf('import ') < 0; // && x.indexOf('export interface ') < 0
|
|
2471
2471
|
}).map((line) => {
|
|
2472
2472
|
return line.replace('export declare', 'declare').replace('export interface', 'declare interface').replace('export class', 'declare class');
|
|
2473
2473
|
});
|
|
2474
|
-
|
|
2474
|
+
let newtext = parsedLines.join('\n');
|
|
2475
2475
|
extraLibs.push({ content: newtext });
|
|
2476
2476
|
});
|
|
2477
2477
|
monaco.languages.typescript.typescriptDefaults.setExtraLibs(extraLibs);
|
|
@@ -2494,9 +2494,9 @@ class DragDropInteractionEmitter extends Emitter {
|
|
|
2494
2494
|
* @param event Evento drop Monaco con posizione target.
|
|
2495
2495
|
*/
|
|
2496
2496
|
fire(event) {
|
|
2497
|
-
|
|
2497
|
+
let self = this;
|
|
2498
2498
|
self.position = event.position;
|
|
2499
|
-
|
|
2499
|
+
let de = {
|
|
2500
2500
|
event: {
|
|
2501
2501
|
dataTransfer: {
|
|
2502
2502
|
items: [
|
|
@@ -2505,14 +2505,14 @@ class DragDropInteractionEmitter extends Emitter {
|
|
|
2505
2505
|
type: 'text/plain',
|
|
2506
2506
|
getAsFile: () => { return null; },
|
|
2507
2507
|
getAsString: (callback) => {
|
|
2508
|
-
|
|
2508
|
+
let dataItem = JSON.parse(event.event.dataTransfer.getData('text/plain'));
|
|
2509
2509
|
if (dataItem) {
|
|
2510
2510
|
if (dataItem.sqlTable) {
|
|
2511
2511
|
callback(`${dataItem.sqlTable.schema}.${dataItem.sqlTable.table}`);
|
|
2512
2512
|
}
|
|
2513
2513
|
if (dataItem.parentTable) {
|
|
2514
|
-
//
|
|
2515
|
-
//
|
|
2514
|
+
// let suggestions = self.sqlProvider.getAutocompleteSuggestions(self.editor.getValue(), self.position);
|
|
2515
|
+
// let colSugg = suggestions.suggestions.find(x => x.label == '<All columns>');
|
|
2516
2516
|
// if (colSugg) {
|
|
2517
2517
|
// callback(colSugg.insertText);
|
|
2518
2518
|
// } else {
|
|
@@ -2520,8 +2520,8 @@ class DragDropInteractionEmitter extends Emitter {
|
|
|
2520
2520
|
// }
|
|
2521
2521
|
}
|
|
2522
2522
|
if (dataItem.sqlColumn) {
|
|
2523
|
-
//
|
|
2524
|
-
//
|
|
2523
|
+
// let suggestions = self.sqlProvider.getAutocompleteSuggestions(self.editor.getValue(), self.position);
|
|
2524
|
+
// let colSugg = suggestions.suggestions.find(x => x.insertText.indexOf(dataItem.sqlColumn.column) >= 0);
|
|
2525
2525
|
// if (colSugg) {
|
|
2526
2526
|
// callback(colSugg.insertText);
|
|
2527
2527
|
// } else {
|
|
@@ -2529,9 +2529,9 @@ class DragDropInteractionEmitter extends Emitter {
|
|
|
2529
2529
|
// }
|
|
2530
2530
|
}
|
|
2531
2531
|
if (dataItem.sqlRelation) {
|
|
2532
|
-
//
|
|
2532
|
+
// let suggestions = self.sqlProvider.getAutocompleteSuggestions(self.editor.getValue(), self.position);
|
|
2533
2533
|
// if (suggestions && suggestions.suggestions) {
|
|
2534
|
-
//
|
|
2534
|
+
// let relSugg = suggestions.suggestions.find(x => x.insertText.indexOf(`${dataItem.sqlRelation.schemaPK}.${dataItem.sqlRelation.tablePK}`) >= 0);
|
|
2535
2535
|
// if (relSugg) {
|
|
2536
2536
|
// callback(relSugg.insertText);
|
|
2537
2537
|
// } else {
|
|
@@ -3412,7 +3412,7 @@ class CodeEditorComponent {
|
|
|
3412
3412
|
$event.stopPropagation();
|
|
3413
3413
|
$event.preventDefault();
|
|
3414
3414
|
if (this.editorRef) {
|
|
3415
|
-
|
|
3415
|
+
let errors = await this.sqlProvider.testSql();
|
|
3416
3416
|
if (this.errors.length) {
|
|
3417
3417
|
WtoolboxService.messageNotificationService.add({ severity: 'error', summary: 'sql_parser_error', detail: errors.map(x => x.Message).join(' -- ') });
|
|
3418
3418
|
}
|
|
@@ -3453,7 +3453,7 @@ class CodeEditorComponent {
|
|
|
3453
3453
|
* Inizializza il componente preparando stato, sottoscrizioni e primi caricamenti richiesti.
|
|
3454
3454
|
*/
|
|
3455
3455
|
ngOnInit() {
|
|
3456
|
-
|
|
3456
|
+
let formFieldOptions = {};
|
|
3457
3457
|
if (this.field && this.field.extras.customEditorConfig) {
|
|
3458
3458
|
try {
|
|
3459
3459
|
formFieldOptions = this.field.extras.customEditorConfig;
|
|
@@ -3512,17 +3512,17 @@ class CodeEditorComponent {
|
|
|
3512
3512
|
// array.
|
|
3513
3513
|
// boolean.
|
|
3514
3514
|
// null.
|
|
3515
|
-
|
|
3515
|
+
let modelUriStr = `a://${this.field.mc_nome_colonna + '_' + this.field.mc_id.toString()}/contextual.schema.json`;
|
|
3516
3516
|
monaco.editor.getModels().forEach(model => {
|
|
3517
3517
|
if (model.uri.toString() == modelUriStr) {
|
|
3518
3518
|
model.dispose();
|
|
3519
3519
|
}
|
|
3520
3520
|
});
|
|
3521
|
-
|
|
3522
|
-
|
|
3521
|
+
let modelUri = monaco.Uri.parse(modelUriStr); // a made up unique URI for our model
|
|
3522
|
+
let model = monaco.editor.createModel("", "json", modelUri);
|
|
3523
3523
|
this.editorOptions.model = model;
|
|
3524
3524
|
if (formFieldOptions.schemas) {
|
|
3525
|
-
|
|
3525
|
+
let schemaStr = JSON.stringify(formFieldOptions.schemas);
|
|
3526
3526
|
schemaStr = schemaStr.replace('{0}', modelUriStr);
|
|
3527
3527
|
formFieldOptions.schemas = JSON.parse(schemaStr);
|
|
3528
3528
|
}
|
|
@@ -3545,8 +3545,8 @@ class CodeEditorComponent {
|
|
|
3545
3545
|
* Completa inizializzazione dopo il rendering della view e collega riferimenti UI.
|
|
3546
3546
|
*/
|
|
3547
3547
|
ngAfterViewInit() {
|
|
3548
|
-
|
|
3549
|
-
|
|
3548
|
+
let self = this;
|
|
3549
|
+
let intv = setInterval(() => {
|
|
3550
3550
|
if (!self.editorRef)
|
|
3551
3551
|
return;
|
|
3552
3552
|
this.editor = this.editorRef.editor;
|
|
@@ -3891,10 +3891,10 @@ class CodeEditorComponent {
|
|
|
3891
3891
|
children: this.mapToPrimeTreeNodes(node?.items || [])
|
|
3892
3892
|
}));
|
|
3893
3893
|
}
|
|
3894
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
3895
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
3894
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CodeEditorComponent, deps: [{ token: i1.MonacoEditorLoaderService }, { token: i1$1.HttpClient }, { token: MetadataProviderService }, { token: UserInfoService }, { token: DataProviderService }, { token: WtoolboxService }, { token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
3895
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: CodeEditorComponent, isStandalone: true, selector: "wuic-code-editor", inputs: { field: "field", record: "record", metaInfo: "metaInfo" }, host: { properties: { "style": "this.style" } }, viewQueries: [{ propertyName: "contextMenuAnchor", first: true, predicate: ["contextMenuAnchor"], descendants: true }, { propertyName: "editorRef", first: true, predicate: ["editorRef"], descendants: true }, { propertyName: "ctxs", first: true, predicate: ["ctxs"], descendants: true }], ngImport: i0, template: "@if (render) {\n<div [ngClass]=\"{'fullscreen': fullscreen, 'no-full-screen': !fullscreen }\">\n <div\n [ngStyle]=\"{width: sqlObjView ? '22%' : null, display: sqlObjView ? null : 'none', position: fullscreen ? 'absolute' : null, 'left': fullscreen ? '0px' : null, 'top': fullscreen ? '0px' : null }\"\n style=\"float: left; height: 100%; overflow: auto; background-color: #1e1e1e; z-index: 2000;\">\n <p-tree [value]=\"primeTreeNodes\">\n <ng-template let-node pTemplate=\"default\">\n <span style=\"-webkit-user-select: none; -ms-user-select: none; user-select: none;\" draggable=\"true\"\n (dragstart)=\"onTreeNodeDragStart($event, node.data)\" (click)=\"editorOptions.onNodeClick($event, node.data)\"\n (dragend)=\"onTreeNodeDragEnd($event, node.data)\">\n <span>\n {{ node.label }}\n </span>\n </span>\n </ng-template>\n </p-tree>\n </div>\n <div [ngStyle]=\"{width: sqlObjView ? '78%' : '100%', 'left': fullscreen ? (!sqlObjView ? '0px' : '22%') : null }\"\n style=\"height: 100%; float: left;\">\n <ul class=\"editor-btn\">\n <li>\n <div (click)=\"setFullScreen($event, this)\">\n <i\n [ngClass]=\"{'pi': true, 'pi-window-maximize': fullscreen == false, 'pi-window-minimize': fullscreen == true}\"></i>\n </div>\n </li>\n @if (editorOptions.language == 'sql') {\n <li>\n <div (click)=\"toggleSqlObjView($event, this)\">\n <i [ngClass]=\"{'pi': true, 'pi-server': true}\"></i>\n </div>\n </li>\n }\n @if (editorOptions.language == 'sql') {\n <li>\n <div (click)=\"testSql($event, this)\">\n <i [ngClass]=\"{'pi': true, 'pi-verified': true}\"></i>\n </div>\n </li>\n }\n @if (field.mc_suggest_value_callback) {\n <li>\n <div (click)=\"suggest($event, this)\">\n <i [ngClass]=\"{'pi': true, 'pi-question': true}\"></i>\n </div>\n </li>\n }\n @if (isHtmlEditor) {\n <li>\n <div (click)=\"formatHtmlNow($event)\" title=\"Format HTML\">\n <i [ngClass]=\"{'pi': true, 'pi-align-left': true}\"></i>\n </div>\n </li>\n <li>\n <div (click)=\"toggleHtmlPreview($event)\" title=\"Toggle HTML preview\">\n <i [ngClass]=\"{'pi': true, 'pi-eye': showHtmlPreview, 'pi-eye-slash': !showHtmlPreview}\"></i>\n </div>\n </li>\n }\n @if (isJsonEditor) {\n <li>\n <div (click)=\"formatJsonNow($event)\" title=\"Format JSON\">\n <i [ngClass]=\"{'pi': true, 'pi-code': true}\"></i>\n </div>\n </li>\n }\n </ul>\n <div class=\"editor-shell\">\n <div class=\"editor-pane\" [ngClass]=\"{'editor-pane--with-preview': isHtmlEditor && showHtmlPreview}\">\n <ngx-monaco-editor #editorRef [options]=\"editorOptions\" [ngModel]=\"editorModelValue\"\n (ngModelChange)=\"onEditorModelChange($event)\"\n [ngModelOptions]=\"{standalone: true}\"\n [ngStyle]=\"{'left': fullscreen ? (!sqlObjView ? '0px' : '22%') : null, width: '100%' }\"\n style=\"width: 100%; height: 100%;\"\n (onDropIntoEditor)=\"editorOptions.onDropIntoEditor($event)\"></ngx-monaco-editor>\n </div>\n @if (isHtmlEditor && showHtmlPreview) {\n <div class=\"html-preview-pane\">\n <div class=\"html-preview-pane__header\">HTML Pseudo-Preview (sanitized)</div>\n <div class=\"html-preview-pane__body\" [innerHTML]=\"sanitizedHtmlPreview\"></div>\n </div>\n }\n </div>\n </div>\n</div>\n}\n\n@if (editorRef?.editorContent?.nativeElement) {\n<p-contextMenu [target]=\"editorRef?.editorContent?.nativeElement\" [model]=\"editorOptions.contextMenuItems\"\n appendTo=\"body\" />\n}\n", styles: [".editor-btn{color:#fff;list-style-type:none;z-index:2001;visibility:visible;position:absolute;right:10px;top:10px;display:flex;gap:8px;margin:0;padding:0}.editor-btn li{list-style:none}.editor-btn li div{width:24px;height:24px;display:flex;align-items:center;justify-content:center;border:1px solid #334155;border-radius:4px;background:#0f172ad9;cursor:pointer}.fullscreen{position:fixed;inset:16px;z-index:3000;background:#1e1e1e;width:auto;height:auto}.fullscreen .editor-shell{position:absolute;inset:44px 0 0;height:auto}.fullscreen .editor-pane ngx-monaco-editor{position:relative;height:auto!important}.no-full-screen{width:100%;height:200px;position:relative}.editor-container{overflow:visible!important}.editor-shell{display:flex;width:100%;height:100%;min-height:0}.editor-pane{flex:1 1 auto;min-width:0;height:100%}.editor-pane--with-preview{flex:0 0 62%}.html-preview-pane{flex:0 0 38%;min-width:260px;border-left:1px solid #404040;background:#111827;color:#e5e7eb;display:flex;flex-direction:column}.html-preview-pane__header{font-size:12px;letter-spacing:.04em;text-transform:uppercase;padding:10px 12px;border-bottom:1px solid #374151;color:#9ca3af}.html-preview-pane__body{flex:1 1 auto;overflow:auto;padding:12px;background:#fff;color:#111827}:host ::ng-deep .html-preview-pane__body .wuic-preview-component{border:1px solid #cbd5e1;border-left:4px solid #2563eb;border-radius:6px;padding:8px 10px;margin-bottom:10px;background:#f8fafc}:host ::ng-deep .html-preview-pane__body .wuic-preview-component__title{font-weight:600;color:#0f172a;margin-bottom:4px}:host ::ng-deep .html-preview-pane__body .wuic-preview-component__content{margin-top:8px}:host ::ng-deep .html-preview-pane__body .wuic-preview-field__label{display:block;font-size:13px;font-weight:600;color:#0f172a;margin-bottom:6px}:host ::ng-deep .html-preview-pane__body .wuic-preview-field__input{display:block;width:100%;border:1px solid #3b82f6;border-radius:4px;min-height:36px;box-sizing:border-box;background:#fff}:host ::ng-deep .monaco-editor .suggest-widget,:host ::ng-deep .monaco-editor .parameter-hints-widget,:host ::ng-deep .monaco-editor .monaco-hover{z-index:4000!important}:host ::ng-deep .monaco-editor .suggest-widget{height:220px!important;margin-top:-30px!important}:host ::ng-deep .monaco-editor .suggest-widget .tree,:host ::ng-deep .monaco-editor .suggest-widget .monaco-list,:host ::ng-deep .monaco-editor .suggest-widget .monaco-list-rows,:host ::ng-deep .monaco-editor .suggest-widget .monaco-scrollable-element{height:186px!important;max-height:186px!important}:host ::ng-deep .monaco-editor .suggest-widget .monaco-list-rows{box-sizing:border-box;padding-bottom:20px!important}::-webkit-scrollbar{width:12px}::-webkit-scrollbar-track{box-shadow:inset 0 0 5px gray;border-radius:10px}::-webkit-scrollbar-thumb{background:#ffffff80;border-radius:10px;visibility:hidden}::-webkit-scrollbar-thumb:hover{visibility:visible}::-webkit-scrollbar-thumb:hover{background:#fffc}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MonacoEditorModule }, { kind: "component", type: i1.MonacoEditorComponent, selector: "ngx-monaco-editor", inputs: ["options", "uri"], outputs: ["init"] }, { kind: "ngmodule", type: ContextMenuModule }, { kind: "component", type: i13.ContextMenu, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: ["model", "triggerEvent", "target", "global", "style", "styleClass", "autoZIndex", "baseZIndex", "id", "breakpoint", "ariaLabel", "ariaLabelledBy", "pressDelay", "appendTo", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: TreeModule }, { kind: "component", type: i4.Tree, selector: "p-tree", inputs: ["value", "selectionMode", "loadingMode", "selection", "styleClass", "contextMenu", "contextMenuSelectionMode", "contextMenuSelection", "draggableScope", "droppableScope", "draggableNodes", "droppableNodes", "metaKeySelection", "propagateSelectionUp", "propagateSelectionDown", "loading", "loadingIcon", "emptyMessage", "ariaLabel", "togglerAriaLabel", "ariaLabelledBy", "validateDrop", "filter", "filterInputAutoFocus", "filterBy", "filterMode", "filterOptions", "filterPlaceholder", "filteredNodes", "filterLocale", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "indentation", "_templateMap", "trackBy", "highlightOnSelect"], outputs: ["selectionChange", "contextMenuSelectionChange", "onNodeSelect", "onNodeUnselect", "onNodeExpand", "onNodeCollapse", "onNodeContextMenuSelect", "onNodeDoubleClick", "onNodeDrop", "onLazyLoad", "onScroll", "onScrollIndexChange", "onFilter"] }] });
|
|
3896
3896
|
}
|
|
3897
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
3897
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: CodeEditorComponent, decorators: [{
|
|
3898
3898
|
type: Component,
|
|
3899
3899
|
args: [{ selector: 'wuic-code-editor', imports: [NgClass, NgStyle, FormsModule, MonacoEditorModule, ContextMenuModule, TreeModule], template: "@if (render) {\n<div [ngClass]=\"{'fullscreen': fullscreen, 'no-full-screen': !fullscreen }\">\n <div\n [ngStyle]=\"{width: sqlObjView ? '22%' : null, display: sqlObjView ? null : 'none', position: fullscreen ? 'absolute' : null, 'left': fullscreen ? '0px' : null, 'top': fullscreen ? '0px' : null }\"\n style=\"float: left; height: 100%; overflow: auto; background-color: #1e1e1e; z-index: 2000;\">\n <p-tree [value]=\"primeTreeNodes\">\n <ng-template let-node pTemplate=\"default\">\n <span style=\"-webkit-user-select: none; -ms-user-select: none; user-select: none;\" draggable=\"true\"\n (dragstart)=\"onTreeNodeDragStart($event, node.data)\" (click)=\"editorOptions.onNodeClick($event, node.data)\"\n (dragend)=\"onTreeNodeDragEnd($event, node.data)\">\n <span>\n {{ node.label }}\n </span>\n </span>\n </ng-template>\n </p-tree>\n </div>\n <div [ngStyle]=\"{width: sqlObjView ? '78%' : '100%', 'left': fullscreen ? (!sqlObjView ? '0px' : '22%') : null }\"\n style=\"height: 100%; float: left;\">\n <ul class=\"editor-btn\">\n <li>\n <div (click)=\"setFullScreen($event, this)\">\n <i\n [ngClass]=\"{'pi': true, 'pi-window-maximize': fullscreen == false, 'pi-window-minimize': fullscreen == true}\"></i>\n </div>\n </li>\n @if (editorOptions.language == 'sql') {\n <li>\n <div (click)=\"toggleSqlObjView($event, this)\">\n <i [ngClass]=\"{'pi': true, 'pi-server': true}\"></i>\n </div>\n </li>\n }\n @if (editorOptions.language == 'sql') {\n <li>\n <div (click)=\"testSql($event, this)\">\n <i [ngClass]=\"{'pi': true, 'pi-verified': true}\"></i>\n </div>\n </li>\n }\n @if (field.mc_suggest_value_callback) {\n <li>\n <div (click)=\"suggest($event, this)\">\n <i [ngClass]=\"{'pi': true, 'pi-question': true}\"></i>\n </div>\n </li>\n }\n @if (isHtmlEditor) {\n <li>\n <div (click)=\"formatHtmlNow($event)\" title=\"Format HTML\">\n <i [ngClass]=\"{'pi': true, 'pi-align-left': true}\"></i>\n </div>\n </li>\n <li>\n <div (click)=\"toggleHtmlPreview($event)\" title=\"Toggle HTML preview\">\n <i [ngClass]=\"{'pi': true, 'pi-eye': showHtmlPreview, 'pi-eye-slash': !showHtmlPreview}\"></i>\n </div>\n </li>\n }\n @if (isJsonEditor) {\n <li>\n <div (click)=\"formatJsonNow($event)\" title=\"Format JSON\">\n <i [ngClass]=\"{'pi': true, 'pi-code': true}\"></i>\n </div>\n </li>\n }\n </ul>\n <div class=\"editor-shell\">\n <div class=\"editor-pane\" [ngClass]=\"{'editor-pane--with-preview': isHtmlEditor && showHtmlPreview}\">\n <ngx-monaco-editor #editorRef [options]=\"editorOptions\" [ngModel]=\"editorModelValue\"\n (ngModelChange)=\"onEditorModelChange($event)\"\n [ngModelOptions]=\"{standalone: true}\"\n [ngStyle]=\"{'left': fullscreen ? (!sqlObjView ? '0px' : '22%') : null, width: '100%' }\"\n style=\"width: 100%; height: 100%;\"\n (onDropIntoEditor)=\"editorOptions.onDropIntoEditor($event)\"></ngx-monaco-editor>\n </div>\n @if (isHtmlEditor && showHtmlPreview) {\n <div class=\"html-preview-pane\">\n <div class=\"html-preview-pane__header\">HTML Pseudo-Preview (sanitized)</div>\n <div class=\"html-preview-pane__body\" [innerHTML]=\"sanitizedHtmlPreview\"></div>\n </div>\n }\n </div>\n </div>\n</div>\n}\n\n@if (editorRef?.editorContent?.nativeElement) {\n<p-contextMenu [target]=\"editorRef?.editorContent?.nativeElement\" [model]=\"editorOptions.contextMenuItems\"\n appendTo=\"body\" />\n}\n", styles: [".editor-btn{color:#fff;list-style-type:none;z-index:2001;visibility:visible;position:absolute;right:10px;top:10px;display:flex;gap:8px;margin:0;padding:0}.editor-btn li{list-style:none}.editor-btn li div{width:24px;height:24px;display:flex;align-items:center;justify-content:center;border:1px solid #334155;border-radius:4px;background:#0f172ad9;cursor:pointer}.fullscreen{position:fixed;inset:16px;z-index:3000;background:#1e1e1e;width:auto;height:auto}.fullscreen .editor-shell{position:absolute;inset:44px 0 0;height:auto}.fullscreen .editor-pane ngx-monaco-editor{position:relative;height:auto!important}.no-full-screen{width:100%;height:200px;position:relative}.editor-container{overflow:visible!important}.editor-shell{display:flex;width:100%;height:100%;min-height:0}.editor-pane{flex:1 1 auto;min-width:0;height:100%}.editor-pane--with-preview{flex:0 0 62%}.html-preview-pane{flex:0 0 38%;min-width:260px;border-left:1px solid #404040;background:#111827;color:#e5e7eb;display:flex;flex-direction:column}.html-preview-pane__header{font-size:12px;letter-spacing:.04em;text-transform:uppercase;padding:10px 12px;border-bottom:1px solid #374151;color:#9ca3af}.html-preview-pane__body{flex:1 1 auto;overflow:auto;padding:12px;background:#fff;color:#111827}:host ::ng-deep .html-preview-pane__body .wuic-preview-component{border:1px solid #cbd5e1;border-left:4px solid #2563eb;border-radius:6px;padding:8px 10px;margin-bottom:10px;background:#f8fafc}:host ::ng-deep .html-preview-pane__body .wuic-preview-component__title{font-weight:600;color:#0f172a;margin-bottom:4px}:host ::ng-deep .html-preview-pane__body .wuic-preview-component__content{margin-top:8px}:host ::ng-deep .html-preview-pane__body .wuic-preview-field__label{display:block;font-size:13px;font-weight:600;color:#0f172a;margin-bottom:6px}:host ::ng-deep .html-preview-pane__body .wuic-preview-field__input{display:block;width:100%;border:1px solid #3b82f6;border-radius:4px;min-height:36px;box-sizing:border-box;background:#fff}:host ::ng-deep .monaco-editor .suggest-widget,:host ::ng-deep .monaco-editor .parameter-hints-widget,:host ::ng-deep .monaco-editor .monaco-hover{z-index:4000!important}:host ::ng-deep .monaco-editor .suggest-widget{height:220px!important;margin-top:-30px!important}:host ::ng-deep .monaco-editor .suggest-widget .tree,:host ::ng-deep .monaco-editor .suggest-widget .monaco-list,:host ::ng-deep .monaco-editor .suggest-widget .monaco-list-rows,:host ::ng-deep .monaco-editor .suggest-widget .monaco-scrollable-element{height:186px!important;max-height:186px!important}:host ::ng-deep .monaco-editor .suggest-widget .monaco-list-rows{box-sizing:border-box;padding-bottom:20px!important}::-webkit-scrollbar{width:12px}::-webkit-scrollbar-track{box-shadow:inset 0 0 5px gray;border-radius:10px}::-webkit-scrollbar-thumb{background:#ffffff80;border-radius:10px;visibility:hidden}::-webkit-scrollbar-thumb:hover{visibility:visible}::-webkit-scrollbar-thumb:hover{background:#fffc}\n"] }]
|
|
3900
3900
|
}], ctorParameters: () => [{ type: i1.MonacoEditorLoaderService }, { type: i1$1.HttpClient }, { type: MetadataProviderService }, { type: UserInfoService }, { type: DataProviderService }, { type: WtoolboxService }, { type: i1$2.DomSanitizer }], propDecorators: { style: [{
|
|
@@ -3918,4 +3918,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
3918
3918
|
}] } });
|
|
3919
3919
|
|
|
3920
3920
|
export { CodeEditorComponent };
|
|
3921
|
-
//# sourceMappingURL=wuic-framework-lib-code-editor.component-
|
|
3921
|
+
//# sourceMappingURL=wuic-framework-lib-code-editor.component-D1dy4Dl9.mjs.map
|