@seniorsistemas/angular-components 14.10.0 → 14.10.1
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/bundles/seniorsistemas-angular-components.umd.js +39 -361
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/code-editor/core/facades/core-facade.d.ts +3 -1
- package/components/code-editor/infra/cores/codemirror-6/codemirror-6-core.d.ts +2 -1
- package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/index.d.ts +0 -1
- package/components/code-editor/infra/utils/index.d.ts +0 -1
- package/esm2015/components/code-editor/core/facades/core-facade.js +15 -10
- package/esm2015/components/code-editor/core/use-cases/core-linters.js +5 -8
- package/esm2015/components/code-editor/infra/cores/codemirror-6/codemirror-6-core.js +7 -4
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/editor-languages.js +6 -3
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/autocomplete/autocomplete.js +2 -3
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/tax-calculation.language.js +1 -3
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/index.js +1 -2
- package/esm2015/components/code-editor/infra/cores/codemirror-6/themes/editor-themes.js +6 -3
- package/esm2015/components/code-editor/infra/cores/codemirror-6/themes/sds-light/sds-light-highlight-style.js +4 -4
- package/esm2015/components/code-editor/infra/utils/index.js +1 -2
- package/esm2015/components/code-editor/presentation/code-editor-component.js +3 -2
- package/esm5/components/code-editor/core/facades/core-facade.js +15 -10
- package/esm5/components/code-editor/core/use-cases/core-linters.js +5 -8
- package/esm5/components/code-editor/infra/cores/codemirror-6/codemirror-6-core.js +7 -4
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/editor-languages.js +6 -3
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/autocomplete/autocomplete.js +2 -3
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/tax-calculation.language.js +1 -3
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/index.js +1 -2
- package/esm5/components/code-editor/infra/cores/codemirror-6/themes/editor-themes.js +6 -3
- package/esm5/components/code-editor/infra/cores/codemirror-6/themes/sds-light/sds-light-highlight-style.js +4 -4
- package/esm5/components/code-editor/infra/utils/index.js +1 -2
- package/esm5/components/code-editor/presentation/code-editor-component.js +3 -2
- package/fesm2015/seniorsistemas-angular-components.js +40 -283
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +40 -362
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
- package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/index.d.ts +0 -1
- package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/interfaces/request-extra-info.d.ts +0 -4
- package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/on-paste-completion-items-updater.d.ts +0 -6
- package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/update-core-completion-items.d.ts +0 -2
- package/components/code-editor/infra/linters/tax-calculation/models/index.d.ts +0 -1
- package/components/code-editor/infra/linters/tax-calculation/models/interfaces/validation.d.ts +0 -4
- package/components/code-editor/infra/linters/tax-calculation/tax-calculation-linter.d.ts +0 -11
- package/components/code-editor/infra/linters/tax-calculation/validation-compositors/index.d.ts +0 -2
- package/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-composite.d.ts +0 -6
- package/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-workers-compositor/validations-workers-composite.d.ts +0 -6
- package/components/code-editor/infra/utils/regex-index-of.d.ts +0 -8
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/index.js +0 -1
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/interfaces/request-extra-info.js +0 -1
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/on-paste-completion-items-updater.js +0 -164
- package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/update-core-completion-items.js +0 -30
- package/esm2015/components/code-editor/infra/linters/tax-calculation/models/index.js +0 -1
- package/esm2015/components/code-editor/infra/linters/tax-calculation/models/interfaces/validation.js +0 -1
- package/esm2015/components/code-editor/infra/linters/tax-calculation/tax-calculation-linter.js +0 -19
- package/esm2015/components/code-editor/infra/linters/tax-calculation/validation-compositors/index.js +0 -3
- package/esm2015/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-composite.js +0 -16
- package/esm2015/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-workers-compositor/validations-workers-composite.js +0 -25
- package/esm2015/components/code-editor/infra/utils/regex-index-of.js +0 -12
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/index.js +0 -1
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/interfaces/request-extra-info.js +0 -1
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/on-paste-completion-items-updater.js +0 -191
- package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/update-core-completion-items.js +0 -34
- package/esm5/components/code-editor/infra/linters/tax-calculation/models/index.js +0 -1
- package/esm5/components/code-editor/infra/linters/tax-calculation/models/interfaces/validation.js +0 -1
- package/esm5/components/code-editor/infra/linters/tax-calculation/tax-calculation-linter.js +0 -21
- package/esm5/components/code-editor/infra/linters/tax-calculation/validation-compositors/index.js +0 -3
- package/esm5/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-composite.js +0 -49
- package/esm5/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-workers-compositor/validations-workers-composite.js +0 -42
- package/esm5/components/code-editor/infra/utils/regex-index-of.js +0 -12
|
@@ -42,7 +42,7 @@ import * as elementResizeDetectorMaker_ from 'element-resize-detector';
|
|
|
42
42
|
import { FocusTrapFactory, A11yModule } from '@angular/cdk/a11y';
|
|
43
43
|
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
|
44
44
|
import { Sidebar, SidebarModule as SidebarModule$1 } from 'primeng/sidebar';
|
|
45
|
-
import { EditorView
|
|
45
|
+
import { EditorView } from '@codemirror/view';
|
|
46
46
|
import { StateField, StateEffect, EditorState } from '@codemirror/state';
|
|
47
47
|
import { setDiagnostics } from '@codemirror/lint';
|
|
48
48
|
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
@@ -6626,71 +6626,14 @@ var Themes;
|
|
|
6626
6626
|
|
|
6627
6627
|
/* Enums */
|
|
6628
6628
|
|
|
6629
|
-
class ValidationWorkersComposite {
|
|
6630
|
-
constructor() {
|
|
6631
|
-
this._validations = [];
|
|
6632
|
-
}
|
|
6633
|
-
validate(code, completionItems) {
|
|
6634
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6635
|
-
return new Promise(resolve => {
|
|
6636
|
-
const markers = [];
|
|
6637
|
-
let finishedWorkers = 0;
|
|
6638
|
-
for (const worker of this._validations) {
|
|
6639
|
-
worker.onmessage = ({ data }) => {
|
|
6640
|
-
markers.concat(data);
|
|
6641
|
-
finishedWorkers++;
|
|
6642
|
-
if (finishedWorkers === this._validations.length) {
|
|
6643
|
-
resolve(markers);
|
|
6644
|
-
}
|
|
6645
|
-
};
|
|
6646
|
-
worker.postMessage({ code, completionItems });
|
|
6647
|
-
}
|
|
6648
|
-
});
|
|
6649
|
-
});
|
|
6650
|
-
}
|
|
6651
|
-
}
|
|
6652
|
-
|
|
6653
|
-
class ValidationComposite {
|
|
6654
|
-
constructor() {
|
|
6655
|
-
this._validations = [];
|
|
6656
|
-
}
|
|
6657
|
-
validate(code, completionItems) {
|
|
6658
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6659
|
-
const markers = [];
|
|
6660
|
-
for (const validation of this._validations) {
|
|
6661
|
-
markers.concat(yield validation.validate(code, completionItems));
|
|
6662
|
-
}
|
|
6663
|
-
return markers;
|
|
6664
|
-
});
|
|
6665
|
-
}
|
|
6666
|
-
}
|
|
6667
|
-
|
|
6668
|
-
/**
|
|
6669
|
-
* Linter for the "TaxCalculation" Language
|
|
6670
|
-
*/
|
|
6671
|
-
class TaxCalculationLinter {
|
|
6672
|
-
constructor() {
|
|
6673
|
-
this.setValidation();
|
|
6674
|
-
}
|
|
6675
|
-
lint(code, completionItems) {
|
|
6676
|
-
return this._validation.validate(code, completionItems || []);
|
|
6677
|
-
}
|
|
6678
|
-
setValidation() {
|
|
6679
|
-
const browserSupportsWorkers = typeof Worker !== "undefined";
|
|
6680
|
-
this._validation = browserSupportsWorkers
|
|
6681
|
-
? new ValidationWorkersComposite()
|
|
6682
|
-
: new ValidationComposite();
|
|
6683
|
-
}
|
|
6684
|
-
}
|
|
6685
|
-
|
|
6686
6629
|
class CoreLinters {
|
|
6687
6630
|
static getLinter(language) {
|
|
6688
|
-
|
|
6631
|
+
const languageLinterFactory = CoreLinters._LINTERS.get(language);
|
|
6632
|
+
if (languageLinterFactory)
|
|
6633
|
+
return languageLinterFactory();
|
|
6689
6634
|
}
|
|
6690
6635
|
}
|
|
6691
|
-
CoreLinters._LINTERS = new Map([
|
|
6692
|
-
[Languages.TaxCalculation, new TaxCalculationLinter()]
|
|
6693
|
-
]);
|
|
6636
|
+
CoreLinters._LINTERS = new Map([]);
|
|
6694
6637
|
|
|
6695
6638
|
class CoreFacade {
|
|
6696
6639
|
constructor() {
|
|
@@ -6698,6 +6641,7 @@ class CoreFacade {
|
|
|
6698
6641
|
this.$onCodeChange = new Subject();
|
|
6699
6642
|
this.$onCodeValidityChange = new Subject();
|
|
6700
6643
|
this._completionItems = [];
|
|
6644
|
+
this._lastCodeEmitted = "";
|
|
6701
6645
|
}
|
|
6702
6646
|
changeEditorOptions(options) {
|
|
6703
6647
|
if (options) {
|
|
@@ -6710,11 +6654,11 @@ class CoreFacade {
|
|
|
6710
6654
|
}
|
|
6711
6655
|
}
|
|
6712
6656
|
changeCode(code) {
|
|
6713
|
-
|
|
6714
|
-
|
|
6657
|
+
const safeCode = this.getSafeCode(code);
|
|
6658
|
+
if (safeCode !== this._lastCodeEmitted) {
|
|
6659
|
+
this.setCode(safeCode);
|
|
6715
6660
|
}
|
|
6716
6661
|
}
|
|
6717
|
-
destroyObservables() { }
|
|
6718
6662
|
getOnCoreFinishLoadObservable() {
|
|
6719
6663
|
return this.$onCoreFinishLoad.asObservable();
|
|
6720
6664
|
}
|
|
@@ -6728,14 +6672,15 @@ class CoreFacade {
|
|
|
6728
6672
|
this.$onCoreFinishLoad.next();
|
|
6729
6673
|
}
|
|
6730
6674
|
notifyCodeChange(code) {
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
this
|
|
6734
|
-
this.
|
|
6675
|
+
const safeCode = this.getSafeCode(code);
|
|
6676
|
+
if (safeCode !== this._lastCodeEmitted) {
|
|
6677
|
+
this._lastCodeEmitted = safeCode;
|
|
6678
|
+
this.$onCodeChange.next(safeCode);
|
|
6679
|
+
this.validateCode(safeCode);
|
|
6735
6680
|
}
|
|
6736
6681
|
}
|
|
6737
6682
|
updateCompletionItems(items) {
|
|
6738
|
-
this._completionItems = items;
|
|
6683
|
+
this._completionItems = items || [];
|
|
6739
6684
|
this.validateCode(this._lastCodeEmitted);
|
|
6740
6685
|
}
|
|
6741
6686
|
setLinter(language) {
|
|
@@ -6746,7 +6691,7 @@ class CoreFacade {
|
|
|
6746
6691
|
if (this._linter) {
|
|
6747
6692
|
const markers = yield this._linter.lint(code, this._completionItems);
|
|
6748
6693
|
this.highlightCode(markers);
|
|
6749
|
-
this.notifyCodeValidityChange(
|
|
6694
|
+
this.notifyCodeValidityChange(!markers.length);
|
|
6750
6695
|
}
|
|
6751
6696
|
});
|
|
6752
6697
|
}
|
|
@@ -6766,6 +6711,9 @@ class CoreFacade {
|
|
|
6766
6711
|
if (theme && !themes.includes(theme))
|
|
6767
6712
|
throw new Error(`The informed theme "${theme}" is not supported`);
|
|
6768
6713
|
}
|
|
6714
|
+
getSafeCode(code) {
|
|
6715
|
+
return typeof code === "string" ? code : "";
|
|
6716
|
+
}
|
|
6769
6717
|
}
|
|
6770
6718
|
|
|
6771
6719
|
let CodeEditorComponent = class CodeEditorComponent {
|
|
@@ -6784,13 +6732,14 @@ let CodeEditorComponent = class CodeEditorComponent {
|
|
|
6784
6732
|
this.coreFacade.changeCode(code);
|
|
6785
6733
|
}
|
|
6786
6734
|
ngOnInit() {
|
|
6735
|
+
this.coreFacade.initCore();
|
|
6787
6736
|
this.setupCoreListeners();
|
|
6788
6737
|
}
|
|
6789
6738
|
ngAfterViewInit() {
|
|
6790
6739
|
this.setCoreWrapperElement();
|
|
6791
6740
|
}
|
|
6792
6741
|
ngOnDestroy() {
|
|
6793
|
-
this.coreFacade.
|
|
6742
|
+
this.coreFacade.destroyCore();
|
|
6794
6743
|
this._ngUnsubscribe.next();
|
|
6795
6744
|
this._ngUnsubscribe.complete();
|
|
6796
6745
|
}
|
|
@@ -7137,18 +7086,6 @@ CustomTranslationsModule = __decorate([
|
|
|
7137
7086
|
__param(1, Inject(HostProjectConfigsInjectionToken))
|
|
7138
7087
|
], CustomTranslationsModule);
|
|
7139
7088
|
|
|
7140
|
-
/**
|
|
7141
|
-
* Function to get the position of the first occurrence of a regex in a string
|
|
7142
|
-
* @param string The string to search into
|
|
7143
|
-
* @param regex The regex to search into the string
|
|
7144
|
-
* @param position The index at which to begin searching the string. If omitted, search starts at the index 0.
|
|
7145
|
-
* @returns the position of the first occurrence of the informed regex.
|
|
7146
|
-
*/
|
|
7147
|
-
function regexIndexOf(string, regex, position) {
|
|
7148
|
-
const indexOf = string.substring(position || 0).search(regex);
|
|
7149
|
-
return (indexOf >= 0) ? (indexOf + (position || 0)) : indexOf;
|
|
7150
|
-
}
|
|
7151
|
-
|
|
7152
7089
|
var MarkerSeverity;
|
|
7153
7090
|
(function (MarkerSeverity) {
|
|
7154
7091
|
MarkerSeverity[MarkerSeverity["Error"] = 0] = "Error";
|
|
@@ -7393,34 +7330,6 @@ function getSafeResponse(request) {
|
|
|
7393
7330
|
});
|
|
7394
7331
|
}
|
|
7395
7332
|
|
|
7396
|
-
const completionItemsMap = new Map();
|
|
7397
|
-
const usefulToCompletionItemsCompletionTypes = [
|
|
7398
|
-
CompletionTypes.Expression,
|
|
7399
|
-
CompletionTypes.UserExpression,
|
|
7400
|
-
CompletionTypes.FinalValue
|
|
7401
|
-
];
|
|
7402
|
-
/*
|
|
7403
|
-
* Updates the completionItems used by the core.
|
|
7404
|
-
* Utilizes the path and filter to create a key and store the results from the search to the given "path.filter" on a map.
|
|
7405
|
-
* Must save the results to each different filter for the search does not bring all the results, so the user must do a more
|
|
7406
|
-
* specific filter to achieve its objective
|
|
7407
|
-
*/
|
|
7408
|
-
function updateCoreCompletionItems(completionItem) {
|
|
7409
|
-
const { path, filter, completions } = completionItem;
|
|
7410
|
-
const mapPath = `${path}.${filter}`;
|
|
7411
|
-
const filteredCompletions = (completions || []).filter(completion => usefulToCompletionItemsCompletionTypes.includes(completion === null || completion === void 0 ? void 0 : completion.type));
|
|
7412
|
-
const formattedSearchResults = filteredCompletions.map(completion => path === "" ? completion === null || completion === void 0 ? void 0 : completion.label : `${path}.${completion === null || completion === void 0 ? void 0 : completion.label}`);
|
|
7413
|
-
completionItemsMap.delete(mapPath);
|
|
7414
|
-
if (formattedSearchResults.length) {
|
|
7415
|
-
completionItemsMap.set(mapPath, formattedSearchResults);
|
|
7416
|
-
}
|
|
7417
|
-
const allArraysFromMap = Array.from(completionItemsMap.values());
|
|
7418
|
-
const unrepeatedCompletionItems = new Set(allArraysFromMap.flat());
|
|
7419
|
-
CodeMirror6Core
|
|
7420
|
-
.$onCompletionItemsUpdate
|
|
7421
|
-
.next(Array.from(unrepeatedCompletionItems));
|
|
7422
|
-
}
|
|
7423
|
-
|
|
7424
7333
|
/**
|
|
7425
7334
|
* Adds style to the autocomplete
|
|
7426
7335
|
* @returns An extension containing the style
|
|
@@ -7549,7 +7458,6 @@ function searchCompletionResults(context, token) {
|
|
|
7549
7458
|
filter: false,
|
|
7550
7459
|
options: sortedCompletions
|
|
7551
7460
|
};
|
|
7552
|
-
updateCoreCompletionItems({ path, filter, completions: sortedCompletions });
|
|
7553
7461
|
startCompletion(CodeMirror6Core.getEditorView());
|
|
7554
7462
|
}
|
|
7555
7463
|
else {
|
|
@@ -7786,179 +7694,22 @@ function getSortedCompletions(completions) {
|
|
|
7786
7694
|
});
|
|
7787
7695
|
}
|
|
7788
7696
|
|
|
7789
|
-
/**
|
|
7790
|
-
* Adds an watcher to the paste command that updates the core's completions items
|
|
7791
|
-
* @returns An extension containing everything needed to create the the updater
|
|
7792
|
-
*/
|
|
7793
|
-
function onPasteCompletionItemsUpdater() {
|
|
7794
|
-
return [
|
|
7795
|
-
keymap.of([
|
|
7796
|
-
{
|
|
7797
|
-
key: "Ctrl-v",
|
|
7798
|
-
run: searchCompletionResultsCommand,
|
|
7799
|
-
}
|
|
7800
|
-
])
|
|
7801
|
-
];
|
|
7802
|
-
}
|
|
7803
|
-
let cancelLastCompletionSearch$1 = () => { };
|
|
7804
|
-
const ɵ0$1 = cancelLastCompletionSearch$1;
|
|
7805
|
-
/*
|
|
7806
|
-
* Must use the setTimeout for we does not have access to the code pasted on the current state, so we need to wait codemirror
|
|
7807
|
-
* remake the state, also it would be way more difficult to work with the clipboard
|
|
7808
|
-
*/
|
|
7809
|
-
function searchCompletionResultsCommand(view) {
|
|
7810
|
-
cancelLastCompletionSearch$1();
|
|
7811
|
-
const token = new AbortController();
|
|
7812
|
-
setTimeout(() => {
|
|
7813
|
-
if (!token.signal.aborted) {
|
|
7814
|
-
searchCompletionResults$1(view.state.doc.toString(), token);
|
|
7815
|
-
}
|
|
7816
|
-
}, 200);
|
|
7817
|
-
cancelLastCompletionSearch$1 = () => token.abort();
|
|
7818
|
-
return false;
|
|
7819
|
-
}
|
|
7820
|
-
/*
|
|
7821
|
-
* Requests the necessary items to update the core's completionItems when the user uses the ctrl+v
|
|
7822
|
-
*/
|
|
7823
|
-
function searchCompletionResults$1(code, token) {
|
|
7824
|
-
const codeWithoutStrings = getCodeWithoutStringedCode(code);
|
|
7825
|
-
const variablesToVerify = getVariablesToVerify(codeWithoutStrings);
|
|
7826
|
-
const requests = getRequestsBasedOnVariables(variablesToVerify, token.signal);
|
|
7827
|
-
Promise
|
|
7828
|
-
.all(requests)
|
|
7829
|
-
.then(responses => {
|
|
7830
|
-
if (!token.signal.aborted) {
|
|
7831
|
-
const expressionsCompletionItems = getExpressionsCompletionsItems(responses);
|
|
7832
|
-
const entitiesCompletionItems = getEntitiesCompletionsItems(responses);
|
|
7833
|
-
const completionItems = expressionsCompletionItems.concat(entitiesCompletionItems);
|
|
7834
|
-
updateCompletionItems(completionItems);
|
|
7835
|
-
}
|
|
7836
|
-
});
|
|
7837
|
-
}
|
|
7838
|
-
/*
|
|
7839
|
-
* Returns the code itself without its inside double quotes parts, e.g
|
|
7840
|
-
* on string `return this "here not" code`, the return value will be `return this code`;
|
|
7841
|
-
*/
|
|
7842
|
-
function getCodeWithoutStringedCode(code) {
|
|
7843
|
-
return (code !== null && code !== void 0 ? code : "").replace(/"([^"])*["]?/g, " ");
|
|
7844
|
-
}
|
|
7845
|
-
/*
|
|
7846
|
-
* Returns the code's parts that need to be verified by requests, excluding the keywords,
|
|
7847
|
-
* special character (except dot/`.` in middle of two regex's \w and at the end and hashtag in sentence's start)
|
|
7848
|
-
* e.g on string `SE (something.another OU expression E something.another.)`, the variables array would be
|
|
7849
|
-
* ["something.another", "expression", "something.another."]
|
|
7850
|
-
*/
|
|
7851
|
-
function getVariablesToVerify(code) {
|
|
7852
|
-
var _a;
|
|
7853
|
-
const keywordsRegex = Object
|
|
7854
|
-
.values(Keywords)
|
|
7855
|
-
.map(keyword => `(?!${keyword}\\b)`)
|
|
7856
|
-
.join("");
|
|
7857
|
-
return (_a = (code !== null && code !== void 0 ? code : "").match(new RegExp(`[#]?\\b(${keywordsRegex})(\\w+\\.)*\\w+[\\.]?`, "g"))) !== null && _a !== void 0 ? _a : [];
|
|
7858
|
-
}
|
|
7859
|
-
/*
|
|
7860
|
-
* Only needs to request the expressions and the fields from an entity;
|
|
7861
|
-
* Creates an request to every variable;
|
|
7862
|
-
* Uses the AutocompleteService for the requests needed here are Autocomplete's usage, so we are just
|
|
7863
|
-
* borrowing from it
|
|
7864
|
-
*/
|
|
7865
|
-
function getRequestsBasedOnVariables(variables, abortSignal) {
|
|
7866
|
-
var _a;
|
|
7867
|
-
const languageConfigs = getLanguageConfigs();
|
|
7868
|
-
const requests = [];
|
|
7869
|
-
for (const variable of variables) {
|
|
7870
|
-
const splittedVariable = variable.split(".");
|
|
7871
|
-
if (splittedVariable.length === 1) {
|
|
7872
|
-
const extraInfo = {
|
|
7873
|
-
path: "",
|
|
7874
|
-
filter: splittedVariable[0]
|
|
7875
|
-
};
|
|
7876
|
-
requests.push({
|
|
7877
|
-
requestType: RequestTypes.ListExpressionMetadata,
|
|
7878
|
-
request: AutocompleteService.listExpressionMetadata({
|
|
7879
|
-
context: languageConfigs.contexts,
|
|
7880
|
-
subcontext: (_a = languageConfigs.subContexts) !== null && _a !== void 0 ? _a : [],
|
|
7881
|
-
name: splittedVariable[0]
|
|
7882
|
-
}, abortSignal),
|
|
7883
|
-
extraInfo
|
|
7884
|
-
});
|
|
7885
|
-
}
|
|
7886
|
-
else if (splittedVariable.length > 2) {
|
|
7887
|
-
const extraInfo = {
|
|
7888
|
-
path: splittedVariable
|
|
7889
|
-
.slice(0, splittedVariable.length - 1)
|
|
7890
|
-
.join("."),
|
|
7891
|
-
filter: ""
|
|
7892
|
-
};
|
|
7893
|
-
requests.push({
|
|
7894
|
-
requestType: RequestTypes.GetFacadeMetadataByPath,
|
|
7895
|
-
request: AutocompleteService.getFacadeMetadataByPath({
|
|
7896
|
-
context: splittedVariable[0],
|
|
7897
|
-
entityName: splittedVariable[1],
|
|
7898
|
-
fields: splittedVariable.slice(2, splittedVariable.length - 1)
|
|
7899
|
-
}, abortSignal),
|
|
7900
|
-
extraInfo
|
|
7901
|
-
});
|
|
7902
|
-
}
|
|
7903
|
-
}
|
|
7904
|
-
return requests.map(request => getSafeResponse(request));
|
|
7905
|
-
}
|
|
7906
|
-
function getExpressionsCompletionsItems(responses) {
|
|
7907
|
-
const expressionsResponses = responses.filter(response => (response === null || response === void 0 ? void 0 : response.requestType) === RequestTypes.ListExpressionMetadata);
|
|
7908
|
-
return expressionsResponses
|
|
7909
|
-
.map(expressionsResponse => {
|
|
7910
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7911
|
-
return {
|
|
7912
|
-
path: (_b = (_a = expressionsResponse.extraInfo) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : "",
|
|
7913
|
-
filter: (_d = (_c = expressionsResponse.extraInfo) === null || _c === void 0 ? void 0 : _c.filter) !== null && _d !== void 0 ? _d : "",
|
|
7914
|
-
completions: ((_f = (_e = expressionsResponse.response) === null || _e === void 0 ? void 0 : _e.expressionMetadata) !== null && _f !== void 0 ? _f : [])
|
|
7915
|
-
.map(expressionMetadata => ({
|
|
7916
|
-
label: expressionMetadata.name,
|
|
7917
|
-
type: expressionMetadata.type === MetaType.PUBLIC_EXPRESSION
|
|
7918
|
-
? CompletionTypes.Expression
|
|
7919
|
-
: CompletionTypes.UserExpression
|
|
7920
|
-
}))
|
|
7921
|
-
};
|
|
7922
|
-
})
|
|
7923
|
-
.flat();
|
|
7924
|
-
}
|
|
7925
|
-
function getEntitiesCompletionsItems(responses) {
|
|
7926
|
-
const facadesResponsesFromGet = responses.filter(response => (response === null || response === void 0 ? void 0 : response.requestType) === RequestTypes.GetFacadeMetadataByPath);
|
|
7927
|
-
return facadesResponsesFromGet
|
|
7928
|
-
.map(facadesResponseFromGet => {
|
|
7929
|
-
var _a, _b, _c;
|
|
7930
|
-
return {
|
|
7931
|
-
path: facadesResponseFromGet.extraInfo.path,
|
|
7932
|
-
filter: facadesResponseFromGet.extraInfo.filter,
|
|
7933
|
-
completions: ((_c = (_b = (_a = facadesResponseFromGet.response) === null || _a === void 0 ? void 0 : _a.facadeMetadata) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : [])
|
|
7934
|
-
.map(facade => ({
|
|
7935
|
-
label: facade.name,
|
|
7936
|
-
type: facade.type === MetaType.ENTITY ? CompletionTypes.Entity : CompletionTypes.FinalValue
|
|
7937
|
-
}))
|
|
7938
|
-
};
|
|
7939
|
-
})
|
|
7940
|
-
.flat();
|
|
7941
|
-
}
|
|
7942
|
-
function updateCompletionItems(completionItems) {
|
|
7943
|
-
for (const completionItem of completionItems) {
|
|
7944
|
-
updateCoreCompletionItems(completionItem);
|
|
7945
|
-
}
|
|
7946
|
-
}
|
|
7947
|
-
|
|
7948
7697
|
function TaxCalculation() {
|
|
7949
7698
|
return new LanguageSupport(baseConfigs, [
|
|
7950
7699
|
autocomplete(),
|
|
7951
|
-
onPasteCompletionItemsUpdater(),
|
|
7952
7700
|
]);
|
|
7953
7701
|
}
|
|
7954
7702
|
|
|
7955
7703
|
class EditorLanguages {
|
|
7956
7704
|
static getLanguage(language) {
|
|
7957
|
-
|
|
7705
|
+
const languageSupportFactory = EditorLanguages._LANGUAGES.get(language);
|
|
7706
|
+
if (languageSupportFactory)
|
|
7707
|
+
return languageSupportFactory();
|
|
7708
|
+
return [];
|
|
7958
7709
|
}
|
|
7959
7710
|
}
|
|
7960
7711
|
EditorLanguages._LANGUAGES = new Map([
|
|
7961
|
-
[Languages.TaxCalculation, TaxCalculation
|
|
7712
|
+
[Languages.TaxCalculation, TaxCalculation]
|
|
7962
7713
|
]);
|
|
7963
7714
|
|
|
7964
7715
|
/**
|
|
@@ -7976,15 +7727,15 @@ function style$2() {
|
|
|
7976
7727
|
const SDSLightHighlightStyle = HighlightStyle.define([
|
|
7977
7728
|
{
|
|
7978
7729
|
tag: tags.keyword,
|
|
7979
|
-
color: "
|
|
7730
|
+
color: "#008080",
|
|
7980
7731
|
},
|
|
7981
7732
|
{
|
|
7982
7733
|
tag: tags.string,
|
|
7983
|
-
color: "
|
|
7734
|
+
color: "#9C3A3A",
|
|
7984
7735
|
},
|
|
7985
7736
|
{
|
|
7986
7737
|
tag: tags.number,
|
|
7987
|
-
color: "
|
|
7738
|
+
color: "#400753",
|
|
7988
7739
|
},
|
|
7989
7740
|
]);
|
|
7990
7741
|
|
|
@@ -8132,11 +7883,14 @@ function SDSLight() {
|
|
|
8132
7883
|
|
|
8133
7884
|
class EditorThemes {
|
|
8134
7885
|
static getTheme(theme) {
|
|
8135
|
-
|
|
7886
|
+
const EditorThemeFactory = EditorThemes._THEMES.get(theme);
|
|
7887
|
+
if (EditorThemeFactory)
|
|
7888
|
+
return EditorThemeFactory();
|
|
7889
|
+
return [];
|
|
8136
7890
|
}
|
|
8137
7891
|
}
|
|
8138
7892
|
EditorThemes._THEMES = new Map([
|
|
8139
|
-
[Themes.SDSLight, SDSLight
|
|
7893
|
+
[Themes.SDSLight, SDSLight]
|
|
8140
7894
|
]);
|
|
8141
7895
|
|
|
8142
7896
|
class CodeMirror6Core extends CoreFacade {
|
|
@@ -8145,7 +7899,6 @@ class CodeMirror6Core extends CoreFacade {
|
|
|
8145
7899
|
/* These are necessary for the setCode and setEditorOptions can be called before view has been created */
|
|
8146
7900
|
this._codeReceivedBeforeViewCreation = "";
|
|
8147
7901
|
this._editorOptionsReceivedBeforeViewCreation = [];
|
|
8148
|
-
this.setObservablesListeners();
|
|
8149
7902
|
}
|
|
8150
7903
|
static getEditorView() {
|
|
8151
7904
|
return CodeMirror6Core._editorView;
|
|
@@ -8159,8 +7912,12 @@ class CodeMirror6Core extends CoreFacade {
|
|
|
8159
7912
|
setCode(code) {
|
|
8160
7913
|
this.changeEditorContent(code);
|
|
8161
7914
|
}
|
|
8162
|
-
|
|
8163
|
-
|
|
7915
|
+
initCore() {
|
|
7916
|
+
this.setObservablesListeners();
|
|
7917
|
+
}
|
|
7918
|
+
destroyCore() {
|
|
7919
|
+
this._codeReceivedBeforeViewCreation = "";
|
|
7920
|
+
CodeMirror6Core._editorView = null;
|
|
8164
7921
|
CodeMirror6Core._ngUnsubscribe.next();
|
|
8165
7922
|
CodeMirror6Core._ngUnsubscribe.complete();
|
|
8166
7923
|
}
|