@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.
Files changed (69) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +39 -361
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/code-editor/core/facades/core-facade.d.ts +3 -1
  6. package/components/code-editor/infra/cores/codemirror-6/codemirror-6-core.d.ts +2 -1
  7. package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/index.d.ts +0 -1
  8. package/components/code-editor/infra/utils/index.d.ts +0 -1
  9. package/esm2015/components/code-editor/core/facades/core-facade.js +15 -10
  10. package/esm2015/components/code-editor/core/use-cases/core-linters.js +5 -8
  11. package/esm2015/components/code-editor/infra/cores/codemirror-6/codemirror-6-core.js +7 -4
  12. package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/editor-languages.js +6 -3
  13. package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/autocomplete/autocomplete.js +2 -3
  14. package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/tax-calculation.language.js +1 -3
  15. package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/index.js +1 -2
  16. package/esm2015/components/code-editor/infra/cores/codemirror-6/themes/editor-themes.js +6 -3
  17. package/esm2015/components/code-editor/infra/cores/codemirror-6/themes/sds-light/sds-light-highlight-style.js +4 -4
  18. package/esm2015/components/code-editor/infra/utils/index.js +1 -2
  19. package/esm2015/components/code-editor/presentation/code-editor-component.js +3 -2
  20. package/esm5/components/code-editor/core/facades/core-facade.js +15 -10
  21. package/esm5/components/code-editor/core/use-cases/core-linters.js +5 -8
  22. package/esm5/components/code-editor/infra/cores/codemirror-6/codemirror-6-core.js +7 -4
  23. package/esm5/components/code-editor/infra/cores/codemirror-6/languages/editor-languages.js +6 -3
  24. package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/autocomplete/autocomplete.js +2 -3
  25. package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/tax-calculation.language.js +1 -3
  26. package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/index.js +1 -2
  27. package/esm5/components/code-editor/infra/cores/codemirror-6/themes/editor-themes.js +6 -3
  28. package/esm5/components/code-editor/infra/cores/codemirror-6/themes/sds-light/sds-light-highlight-style.js +4 -4
  29. package/esm5/components/code-editor/infra/utils/index.js +1 -2
  30. package/esm5/components/code-editor/presentation/code-editor-component.js +3 -2
  31. package/fesm2015/seniorsistemas-angular-components.js +40 -283
  32. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  33. package/fesm5/seniorsistemas-angular-components.js +40 -362
  34. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  35. package/package.json +1 -1
  36. package/seniorsistemas-angular-components.metadata.json +1 -1
  37. package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/index.d.ts +0 -1
  38. 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
  39. 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
  40. package/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/update-core-completion-items.d.ts +0 -2
  41. package/components/code-editor/infra/linters/tax-calculation/models/index.d.ts +0 -1
  42. package/components/code-editor/infra/linters/tax-calculation/models/interfaces/validation.d.ts +0 -4
  43. package/components/code-editor/infra/linters/tax-calculation/tax-calculation-linter.d.ts +0 -11
  44. package/components/code-editor/infra/linters/tax-calculation/validation-compositors/index.d.ts +0 -2
  45. package/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-composite.d.ts +0 -6
  46. package/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-workers-compositor/validations-workers-composite.d.ts +0 -6
  47. package/components/code-editor/infra/utils/regex-index-of.d.ts +0 -8
  48. package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/index.js +0 -1
  49. 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
  50. 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
  51. package/esm2015/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/update-core-completion-items.js +0 -30
  52. package/esm2015/components/code-editor/infra/linters/tax-calculation/models/index.js +0 -1
  53. package/esm2015/components/code-editor/infra/linters/tax-calculation/models/interfaces/validation.js +0 -1
  54. package/esm2015/components/code-editor/infra/linters/tax-calculation/tax-calculation-linter.js +0 -19
  55. package/esm2015/components/code-editor/infra/linters/tax-calculation/validation-compositors/index.js +0 -3
  56. package/esm2015/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-composite.js +0 -16
  57. package/esm2015/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-workers-compositor/validations-workers-composite.js +0 -25
  58. package/esm2015/components/code-editor/infra/utils/regex-index-of.js +0 -12
  59. package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/extensions/on-paste-completion-items-updater/models/index.js +0 -1
  60. 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
  61. 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
  62. package/esm5/components/code-editor/infra/cores/codemirror-6/languages/tax-calculation/utils/update-core-completion-items.js +0 -34
  63. package/esm5/components/code-editor/infra/linters/tax-calculation/models/index.js +0 -1
  64. package/esm5/components/code-editor/infra/linters/tax-calculation/models/interfaces/validation.js +0 -1
  65. package/esm5/components/code-editor/infra/linters/tax-calculation/tax-calculation-linter.js +0 -21
  66. package/esm5/components/code-editor/infra/linters/tax-calculation/validation-compositors/index.js +0 -3
  67. package/esm5/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-composite.js +0 -49
  68. package/esm5/components/code-editor/infra/linters/tax-calculation/validation-compositors/validation-workers-compositor/validations-workers-composite.js +0 -42
  69. 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, keymap } from '@codemirror/view';
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';
@@ -7088,121 +7088,15 @@ var Themes;
7088
7088
 
7089
7089
  /* Enums */
7090
7090
 
7091
- var ValidationWorkersComposite = /** @class */ (function () {
7092
- function ValidationWorkersComposite() {
7093
- this._validations = [];
7094
- }
7095
- ValidationWorkersComposite.prototype.validate = function (code, completionItems) {
7096
- return __awaiter(this, void 0, void 0, function () {
7097
- var _this = this;
7098
- return __generator(this, function (_a) {
7099
- return [2 /*return*/, new Promise(function (resolve) {
7100
- var e_1, _a;
7101
- var markers = [];
7102
- var finishedWorkers = 0;
7103
- try {
7104
- for (var _b = __values(_this._validations), _c = _b.next(); !_c.done; _c = _b.next()) {
7105
- var worker = _c.value;
7106
- worker.onmessage = function (_a) {
7107
- var data = _a.data;
7108
- markers.concat(data);
7109
- finishedWorkers++;
7110
- if (finishedWorkers === _this._validations.length) {
7111
- resolve(markers);
7112
- }
7113
- };
7114
- worker.postMessage({ code: code, completionItems: completionItems });
7115
- }
7116
- }
7117
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
7118
- finally {
7119
- try {
7120
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7121
- }
7122
- finally { if (e_1) throw e_1.error; }
7123
- }
7124
- })];
7125
- });
7126
- });
7127
- };
7128
- return ValidationWorkersComposite;
7129
- }());
7130
-
7131
- var ValidationComposite = /** @class */ (function () {
7132
- function ValidationComposite() {
7133
- this._validations = [];
7134
- }
7135
- ValidationComposite.prototype.validate = function (code, completionItems) {
7136
- return __awaiter(this, void 0, void 0, function () {
7137
- var markers, _a, _b, validation, _c, _d, e_1_1;
7138
- var e_1, _e;
7139
- return __generator(this, function (_f) {
7140
- switch (_f.label) {
7141
- case 0:
7142
- markers = [];
7143
- _f.label = 1;
7144
- case 1:
7145
- _f.trys.push([1, 6, 7, 8]);
7146
- _a = __values(this._validations), _b = _a.next();
7147
- _f.label = 2;
7148
- case 2:
7149
- if (!!_b.done) return [3 /*break*/, 5];
7150
- validation = _b.value;
7151
- _d = (_c = markers).concat;
7152
- return [4 /*yield*/, validation.validate(code, completionItems)];
7153
- case 3:
7154
- _d.apply(_c, [_f.sent()]);
7155
- _f.label = 4;
7156
- case 4:
7157
- _b = _a.next();
7158
- return [3 /*break*/, 2];
7159
- case 5: return [3 /*break*/, 8];
7160
- case 6:
7161
- e_1_1 = _f.sent();
7162
- e_1 = { error: e_1_1 };
7163
- return [3 /*break*/, 8];
7164
- case 7:
7165
- try {
7166
- if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
7167
- }
7168
- finally { if (e_1) throw e_1.error; }
7169
- return [7 /*endfinally*/];
7170
- case 8: return [2 /*return*/, markers];
7171
- }
7172
- });
7173
- });
7174
- };
7175
- return ValidationComposite;
7176
- }());
7177
-
7178
- /**
7179
- * Linter for the "TaxCalculation" Language
7180
- */
7181
- var TaxCalculationLinter = /** @class */ (function () {
7182
- function TaxCalculationLinter() {
7183
- this.setValidation();
7184
- }
7185
- TaxCalculationLinter.prototype.lint = function (code, completionItems) {
7186
- return this._validation.validate(code, completionItems || []);
7187
- };
7188
- TaxCalculationLinter.prototype.setValidation = function () {
7189
- var browserSupportsWorkers = typeof Worker !== "undefined";
7190
- this._validation = browserSupportsWorkers
7191
- ? new ValidationWorkersComposite()
7192
- : new ValidationComposite();
7193
- };
7194
- return TaxCalculationLinter;
7195
- }());
7196
-
7197
7091
  var CoreLinters = /** @class */ (function () {
7198
7092
  function CoreLinters() {
7199
7093
  }
7200
7094
  CoreLinters.getLinter = function (language) {
7201
- return CoreLinters._LINTERS.get(language);
7095
+ var languageLinterFactory = CoreLinters._LINTERS.get(language);
7096
+ if (languageLinterFactory)
7097
+ return languageLinterFactory();
7202
7098
  };
7203
- CoreLinters._LINTERS = new Map([
7204
- [Languages.TaxCalculation, new TaxCalculationLinter()]
7205
- ]);
7099
+ CoreLinters._LINTERS = new Map([]);
7206
7100
  return CoreLinters;
7207
7101
  }());
7208
7102
 
@@ -7212,6 +7106,7 @@ var CoreFacade = /** @class */ (function () {
7212
7106
  this.$onCodeChange = new Subject();
7213
7107
  this.$onCodeValidityChange = new Subject();
7214
7108
  this._completionItems = [];
7109
+ this._lastCodeEmitted = "";
7215
7110
  }
7216
7111
  CoreFacade.prototype.changeEditorOptions = function (options) {
7217
7112
  if (options) {
@@ -7224,11 +7119,11 @@ var CoreFacade = /** @class */ (function () {
7224
7119
  }
7225
7120
  };
7226
7121
  CoreFacade.prototype.changeCode = function (code) {
7227
- if (code !== this._lastCodeEmitted) {
7228
- this.setCode(code);
7122
+ var safeCode = this.getSafeCode(code);
7123
+ if (safeCode !== this._lastCodeEmitted) {
7124
+ this.setCode(safeCode);
7229
7125
  }
7230
7126
  };
7231
- CoreFacade.prototype.destroyObservables = function () { };
7232
7127
  CoreFacade.prototype.getOnCoreFinishLoadObservable = function () {
7233
7128
  return this.$onCoreFinishLoad.asObservable();
7234
7129
  };
@@ -7242,14 +7137,15 @@ var CoreFacade = /** @class */ (function () {
7242
7137
  this.$onCoreFinishLoad.next();
7243
7138
  };
7244
7139
  CoreFacade.prototype.notifyCodeChange = function (code) {
7245
- if (code !== this._lastCodeEmitted) {
7246
- this._lastCodeEmitted = code;
7247
- this.$onCodeChange.next(code);
7248
- this.validateCode(code);
7140
+ var safeCode = this.getSafeCode(code);
7141
+ if (safeCode !== this._lastCodeEmitted) {
7142
+ this._lastCodeEmitted = safeCode;
7143
+ this.$onCodeChange.next(safeCode);
7144
+ this.validateCode(safeCode);
7249
7145
  }
7250
7146
  };
7251
7147
  CoreFacade.prototype.updateCompletionItems = function (items) {
7252
- this._completionItems = items;
7148
+ this._completionItems = items || [];
7253
7149
  this.validateCode(this._lastCodeEmitted);
7254
7150
  };
7255
7151
  CoreFacade.prototype.setLinter = function (language) {
@@ -7266,7 +7162,7 @@ var CoreFacade = /** @class */ (function () {
7266
7162
  case 1:
7267
7163
  markers = _a.sent();
7268
7164
  this.highlightCode(markers);
7269
- this.notifyCodeValidityChange(!!markers.length);
7165
+ this.notifyCodeValidityChange(!markers.length);
7270
7166
  _a.label = 2;
7271
7167
  case 2: return [2 /*return*/];
7272
7168
  }
@@ -7289,6 +7185,9 @@ var CoreFacade = /** @class */ (function () {
7289
7185
  if (theme && !themes.includes(theme))
7290
7186
  throw new Error("The informed theme \"" + theme + "\" is not supported");
7291
7187
  };
7188
+ CoreFacade.prototype.getSafeCode = function (code) {
7189
+ return typeof code === "string" ? code : "";
7190
+ };
7292
7191
  return CoreFacade;
7293
7192
  }());
7294
7193
 
@@ -7316,13 +7215,14 @@ var CodeEditorComponent = /** @class */ (function () {
7316
7215
  configurable: true
7317
7216
  });
7318
7217
  CodeEditorComponent.prototype.ngOnInit = function () {
7218
+ this.coreFacade.initCore();
7319
7219
  this.setupCoreListeners();
7320
7220
  };
7321
7221
  CodeEditorComponent.prototype.ngAfterViewInit = function () {
7322
7222
  this.setCoreWrapperElement();
7323
7223
  };
7324
7224
  CodeEditorComponent.prototype.ngOnDestroy = function () {
7325
- this.coreFacade.destroyObservables();
7225
+ this.coreFacade.destroyCore();
7326
7226
  this._ngUnsubscribe.next();
7327
7227
  this._ngUnsubscribe.complete();
7328
7228
  };
@@ -7696,18 +7596,6 @@ var CustomTranslationsModule = /** @class */ (function () {
7696
7596
  return CustomTranslationsModule;
7697
7597
  }());
7698
7598
 
7699
- /**
7700
- * Function to get the position of the first occurrence of a regex in a string
7701
- * @param string The string to search into
7702
- * @param regex The regex to search into the string
7703
- * @param position The index at which to begin searching the string. If omitted, search starts at the index 0.
7704
- * @returns the position of the first occurrence of the informed regex.
7705
- */
7706
- function regexIndexOf(string, regex, position) {
7707
- var indexOf = string.substring(position || 0).search(regex);
7708
- return (indexOf >= 0) ? (indexOf + (position || 0)) : indexOf;
7709
- }
7710
-
7711
7599
  var MarkerSeverity;
7712
7600
  (function (MarkerSeverity) {
7713
7601
  MarkerSeverity[MarkerSeverity["Error"] = 0] = "Error";
@@ -7970,38 +7858,6 @@ function getSafeResponse(request) {
7970
7858
  });
7971
7859
  }
7972
7860
 
7973
- var completionItemsMap = new Map();
7974
- var usefulToCompletionItemsCompletionTypes = [
7975
- CompletionTypes.Expression,
7976
- CompletionTypes.UserExpression,
7977
- CompletionTypes.FinalValue
7978
- ];
7979
- /*
7980
- * Updates the completionItems used by the core.
7981
- * Utilizes the path and filter to create a key and store the results from the search to the given "path.filter" on a map.
7982
- * Must save the results to each different filter for the search does not bring all the results, so the user must do a more
7983
- * specific filter to achieve its objective
7984
- */
7985
- function updateCoreCompletionItems(completionItem) {
7986
- var path = completionItem.path, filter = completionItem.filter, completions = completionItem.completions;
7987
- var mapPath = path + "." + filter;
7988
- var filteredCompletions = (completions || []).filter(function (completion) {
7989
- return usefulToCompletionItemsCompletionTypes.includes(completion === null || completion === void 0 ? void 0 : completion.type);
7990
- });
7991
- var formattedSearchResults = filteredCompletions.map(function (completion) {
7992
- return path === "" ? completion === null || completion === void 0 ? void 0 : completion.label : path + "." + (completion === null || completion === void 0 ? void 0 : completion.label);
7993
- });
7994
- completionItemsMap.delete(mapPath);
7995
- if (formattedSearchResults.length) {
7996
- completionItemsMap.set(mapPath, formattedSearchResults);
7997
- }
7998
- var allArraysFromMap = Array.from(completionItemsMap.values());
7999
- var unrepeatedCompletionItems = new Set(allArraysFromMap.flat());
8000
- CodeMirror6Core
8001
- .$onCompletionItemsUpdate
8002
- .next(Array.from(unrepeatedCompletionItems));
8003
- }
8004
-
8005
7861
  /**
8006
7862
  * Adds style to the autocomplete
8007
7863
  * @returns An extension containing the style
@@ -8132,7 +7988,6 @@ function searchCompletionResults(context, token) {
8132
7988
  filter: false,
8133
7989
  options: sortedCompletions
8134
7990
  };
8135
- updateCoreCompletionItems({ path: path, filter: filter, completions: sortedCompletions });
8136
7991
  startCompletion(CodeMirror6Core.getEditorView());
8137
7992
  }
8138
7993
  else {
@@ -8381,195 +8236,9 @@ function getSortedCompletions(completions) {
8381
8236
  });
8382
8237
  }
8383
8238
 
8384
- /**
8385
- * Adds an watcher to the paste command that updates the core's completions items
8386
- * @returns An extension containing everything needed to create the the updater
8387
- */
8388
- function onPasteCompletionItemsUpdater() {
8389
- return [
8390
- keymap.of([
8391
- {
8392
- key: "Ctrl-v",
8393
- run: searchCompletionResultsCommand,
8394
- }
8395
- ])
8396
- ];
8397
- }
8398
- var cancelLastCompletionSearch$1 = function () { };
8399
- var ɵ0$1 = cancelLastCompletionSearch$1;
8400
- /*
8401
- * Must use the setTimeout for we does not have access to the code pasted on the current state, so we need to wait codemirror
8402
- * remake the state, also it would be way more difficult to work with the clipboard
8403
- */
8404
- function searchCompletionResultsCommand(view) {
8405
- cancelLastCompletionSearch$1();
8406
- var token = new AbortController();
8407
- setTimeout(function () {
8408
- if (!token.signal.aborted) {
8409
- searchCompletionResults$1(view.state.doc.toString(), token);
8410
- }
8411
- }, 200);
8412
- cancelLastCompletionSearch$1 = function () { return token.abort(); };
8413
- return false;
8414
- }
8415
- /*
8416
- * Requests the necessary items to update the core's completionItems when the user uses the ctrl+v
8417
- */
8418
- function searchCompletionResults$1(code, token) {
8419
- var codeWithoutStrings = getCodeWithoutStringedCode(code);
8420
- var variablesToVerify = getVariablesToVerify(codeWithoutStrings);
8421
- var requests = getRequestsBasedOnVariables(variablesToVerify, token.signal);
8422
- Promise
8423
- .all(requests)
8424
- .then(function (responses) {
8425
- if (!token.signal.aborted) {
8426
- var expressionsCompletionItems = getExpressionsCompletionsItems(responses);
8427
- var entitiesCompletionItems = getEntitiesCompletionsItems(responses);
8428
- var completionItems = expressionsCompletionItems.concat(entitiesCompletionItems);
8429
- updateCompletionItems(completionItems);
8430
- }
8431
- });
8432
- }
8433
- /*
8434
- * Returns the code itself without its inside double quotes parts, e.g
8435
- * on string `return this "here not" code`, the return value will be `return this code`;
8436
- */
8437
- function getCodeWithoutStringedCode(code) {
8438
- return (code !== null && code !== void 0 ? code : "").replace(/"([^"])*["]?/g, " ");
8439
- }
8440
- /*
8441
- * Returns the code's parts that need to be verified by requests, excluding the keywords,
8442
- * special character (except dot/`.` in middle of two regex's \w and at the end and hashtag in sentence's start)
8443
- * e.g on string `SE (something.another OU expression E something.another.)`, the variables array would be
8444
- * ["something.another", "expression", "something.another."]
8445
- */
8446
- function getVariablesToVerify(code) {
8447
- var _a;
8448
- var keywordsRegex = Object
8449
- .values(Keywords)
8450
- .map(function (keyword) { return "(?!" + keyword + "\\b)"; })
8451
- .join("");
8452
- return (_a = (code !== null && code !== void 0 ? code : "").match(new RegExp("[#]?\\b(" + keywordsRegex + ")(\\w+\\.)*\\w+[\\.]?", "g"))) !== null && _a !== void 0 ? _a : [];
8453
- }
8454
- /*
8455
- * Only needs to request the expressions and the fields from an entity;
8456
- * Creates an request to every variable;
8457
- * Uses the AutocompleteService for the requests needed here are Autocomplete's usage, so we are just
8458
- * borrowing from it
8459
- */
8460
- function getRequestsBasedOnVariables(variables, abortSignal) {
8461
- var e_1, _a;
8462
- var _b;
8463
- var languageConfigs = getLanguageConfigs();
8464
- var requests = [];
8465
- try {
8466
- for (var variables_1 = __values(variables), variables_1_1 = variables_1.next(); !variables_1_1.done; variables_1_1 = variables_1.next()) {
8467
- var variable = variables_1_1.value;
8468
- var splittedVariable = variable.split(".");
8469
- if (splittedVariable.length === 1) {
8470
- var extraInfo = {
8471
- path: "",
8472
- filter: splittedVariable[0]
8473
- };
8474
- requests.push({
8475
- requestType: RequestTypes.ListExpressionMetadata,
8476
- request: AutocompleteService.listExpressionMetadata({
8477
- context: languageConfigs.contexts,
8478
- subcontext: (_b = languageConfigs.subContexts) !== null && _b !== void 0 ? _b : [],
8479
- name: splittedVariable[0]
8480
- }, abortSignal),
8481
- extraInfo: extraInfo
8482
- });
8483
- }
8484
- else if (splittedVariable.length > 2) {
8485
- var extraInfo = {
8486
- path: splittedVariable
8487
- .slice(0, splittedVariable.length - 1)
8488
- .join("."),
8489
- filter: ""
8490
- };
8491
- requests.push({
8492
- requestType: RequestTypes.GetFacadeMetadataByPath,
8493
- request: AutocompleteService.getFacadeMetadataByPath({
8494
- context: splittedVariable[0],
8495
- entityName: splittedVariable[1],
8496
- fields: splittedVariable.slice(2, splittedVariable.length - 1)
8497
- }, abortSignal),
8498
- extraInfo: extraInfo
8499
- });
8500
- }
8501
- }
8502
- }
8503
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
8504
- finally {
8505
- try {
8506
- if (variables_1_1 && !variables_1_1.done && (_a = variables_1.return)) _a.call(variables_1);
8507
- }
8508
- finally { if (e_1) throw e_1.error; }
8509
- }
8510
- return requests.map(function (request) { return getSafeResponse(request); });
8511
- }
8512
- function getExpressionsCompletionsItems(responses) {
8513
- var expressionsResponses = responses.filter(function (response) {
8514
- return (response === null || response === void 0 ? void 0 : response.requestType) === RequestTypes.ListExpressionMetadata;
8515
- });
8516
- return expressionsResponses
8517
- .map(function (expressionsResponse) {
8518
- var _a, _b, _c, _d, _e, _f;
8519
- return {
8520
- path: (_b = (_a = expressionsResponse.extraInfo) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : "",
8521
- filter: (_d = (_c = expressionsResponse.extraInfo) === null || _c === void 0 ? void 0 : _c.filter) !== null && _d !== void 0 ? _d : "",
8522
- completions: ((_f = (_e = expressionsResponse.response) === null || _e === void 0 ? void 0 : _e.expressionMetadata) !== null && _f !== void 0 ? _f : [])
8523
- .map(function (expressionMetadata) { return ({
8524
- label: expressionMetadata.name,
8525
- type: expressionMetadata.type === MetaType.PUBLIC_EXPRESSION
8526
- ? CompletionTypes.Expression
8527
- : CompletionTypes.UserExpression
8528
- }); })
8529
- };
8530
- })
8531
- .flat();
8532
- }
8533
- function getEntitiesCompletionsItems(responses) {
8534
- var facadesResponsesFromGet = responses.filter(function (response) {
8535
- return (response === null || response === void 0 ? void 0 : response.requestType) === RequestTypes.GetFacadeMetadataByPath;
8536
- });
8537
- return facadesResponsesFromGet
8538
- .map(function (facadesResponseFromGet) {
8539
- var _a, _b, _c;
8540
- return {
8541
- path: facadesResponseFromGet.extraInfo.path,
8542
- filter: facadesResponseFromGet.extraInfo.filter,
8543
- 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 : [])
8544
- .map(function (facade) { return ({
8545
- label: facade.name,
8546
- type: facade.type === MetaType.ENTITY ? CompletionTypes.Entity : CompletionTypes.FinalValue
8547
- }); })
8548
- };
8549
- })
8550
- .flat();
8551
- }
8552
- function updateCompletionItems(completionItems) {
8553
- var e_2, _a;
8554
- try {
8555
- for (var completionItems_1 = __values(completionItems), completionItems_1_1 = completionItems_1.next(); !completionItems_1_1.done; completionItems_1_1 = completionItems_1.next()) {
8556
- var completionItem = completionItems_1_1.value;
8557
- updateCoreCompletionItems(completionItem);
8558
- }
8559
- }
8560
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
8561
- finally {
8562
- try {
8563
- if (completionItems_1_1 && !completionItems_1_1.done && (_a = completionItems_1.return)) _a.call(completionItems_1);
8564
- }
8565
- finally { if (e_2) throw e_2.error; }
8566
- }
8567
- }
8568
-
8569
8239
  function TaxCalculation() {
8570
8240
  return new LanguageSupport(baseConfigs, [
8571
8241
  autocomplete(),
8572
- onPasteCompletionItemsUpdater(),
8573
8242
  ]);
8574
8243
  }
8575
8244
 
@@ -8577,10 +8246,13 @@ var EditorLanguages = /** @class */ (function () {
8577
8246
  function EditorLanguages() {
8578
8247
  }
8579
8248
  EditorLanguages.getLanguage = function (language) {
8580
- return EditorLanguages._LANGUAGES.get(language) || [];
8249
+ var languageSupportFactory = EditorLanguages._LANGUAGES.get(language);
8250
+ if (languageSupportFactory)
8251
+ return languageSupportFactory();
8252
+ return [];
8581
8253
  };
8582
8254
  EditorLanguages._LANGUAGES = new Map([
8583
- [Languages.TaxCalculation, TaxCalculation()]
8255
+ [Languages.TaxCalculation, TaxCalculation]
8584
8256
  ]);
8585
8257
  return EditorLanguages;
8586
8258
  }());
@@ -8600,15 +8272,15 @@ function style$2() {
8600
8272
  var SDSLightHighlightStyle = HighlightStyle.define([
8601
8273
  {
8602
8274
  tag: tags.keyword,
8603
- color: "blue",
8275
+ color: "#008080",
8604
8276
  },
8605
8277
  {
8606
8278
  tag: tags.string,
8607
- color: "red",
8279
+ color: "#9C3A3A",
8608
8280
  },
8609
8281
  {
8610
8282
  tag: tags.number,
8611
- color: "green",
8283
+ color: "#400753",
8612
8284
  },
8613
8285
  ]);
8614
8286
 
@@ -8758,10 +8430,13 @@ var EditorThemes = /** @class */ (function () {
8758
8430
  function EditorThemes() {
8759
8431
  }
8760
8432
  EditorThemes.getTheme = function (theme) {
8761
- return EditorThemes._THEMES.get(theme) || [];
8433
+ var EditorThemeFactory = EditorThemes._THEMES.get(theme);
8434
+ if (EditorThemeFactory)
8435
+ return EditorThemeFactory();
8436
+ return [];
8762
8437
  };
8763
8438
  EditorThemes._THEMES = new Map([
8764
- [Themes.SDSLight, SDSLight()]
8439
+ [Themes.SDSLight, SDSLight]
8765
8440
  ]);
8766
8441
  return EditorThemes;
8767
8442
  }());
@@ -8773,7 +8448,6 @@ var CodeMirror6Core = /** @class */ (function (_super) {
8773
8448
  /* These are necessary for the setCode and setEditorOptions can be called before view has been created */
8774
8449
  _this._codeReceivedBeforeViewCreation = "";
8775
8450
  _this._editorOptionsReceivedBeforeViewCreation = [];
8776
- _this.setObservablesListeners();
8777
8451
  return _this;
8778
8452
  }
8779
8453
  CodeMirror6Core.getEditorView = function () {
@@ -8793,8 +8467,12 @@ var CodeMirror6Core = /** @class */ (function (_super) {
8793
8467
  CodeMirror6Core.prototype.setCode = function (code) {
8794
8468
  this.changeEditorContent(code);
8795
8469
  };
8796
- // @Override
8797
- CodeMirror6Core.prototype.destroyObservables = function () {
8470
+ CodeMirror6Core.prototype.initCore = function () {
8471
+ this.setObservablesListeners();
8472
+ };
8473
+ CodeMirror6Core.prototype.destroyCore = function () {
8474
+ this._codeReceivedBeforeViewCreation = "";
8475
+ CodeMirror6Core._editorView = null;
8798
8476
  CodeMirror6Core._ngUnsubscribe.next();
8799
8477
  CodeMirror6Core._ngUnsubscribe.complete();
8800
8478
  };