@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
|
@@ -7262,121 +7262,15 @@
|
|
|
7262
7262
|
|
|
7263
7263
|
/* Enums */
|
|
7264
7264
|
|
|
7265
|
-
var ValidationWorkersComposite = /** @class */ (function () {
|
|
7266
|
-
function ValidationWorkersComposite() {
|
|
7267
|
-
this._validations = [];
|
|
7268
|
-
}
|
|
7269
|
-
ValidationWorkersComposite.prototype.validate = function (code, completionItems) {
|
|
7270
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
7271
|
-
var _this = this;
|
|
7272
|
-
return __generator(this, function (_a) {
|
|
7273
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
7274
|
-
var e_1, _a;
|
|
7275
|
-
var markers = [];
|
|
7276
|
-
var finishedWorkers = 0;
|
|
7277
|
-
try {
|
|
7278
|
-
for (var _b = __values(_this._validations), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7279
|
-
var worker = _c.value;
|
|
7280
|
-
worker.onmessage = function (_a) {
|
|
7281
|
-
var data = _a.data;
|
|
7282
|
-
markers.concat(data);
|
|
7283
|
-
finishedWorkers++;
|
|
7284
|
-
if (finishedWorkers === _this._validations.length) {
|
|
7285
|
-
resolve(markers);
|
|
7286
|
-
}
|
|
7287
|
-
};
|
|
7288
|
-
worker.postMessage({ code: code, completionItems: completionItems });
|
|
7289
|
-
}
|
|
7290
|
-
}
|
|
7291
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7292
|
-
finally {
|
|
7293
|
-
try {
|
|
7294
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7295
|
-
}
|
|
7296
|
-
finally { if (e_1) throw e_1.error; }
|
|
7297
|
-
}
|
|
7298
|
-
})];
|
|
7299
|
-
});
|
|
7300
|
-
});
|
|
7301
|
-
};
|
|
7302
|
-
return ValidationWorkersComposite;
|
|
7303
|
-
}());
|
|
7304
|
-
|
|
7305
|
-
var ValidationComposite = /** @class */ (function () {
|
|
7306
|
-
function ValidationComposite() {
|
|
7307
|
-
this._validations = [];
|
|
7308
|
-
}
|
|
7309
|
-
ValidationComposite.prototype.validate = function (code, completionItems) {
|
|
7310
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
7311
|
-
var markers, _a, _b, validation, _c, _d, e_1_1;
|
|
7312
|
-
var e_1, _e;
|
|
7313
|
-
return __generator(this, function (_f) {
|
|
7314
|
-
switch (_f.label) {
|
|
7315
|
-
case 0:
|
|
7316
|
-
markers = [];
|
|
7317
|
-
_f.label = 1;
|
|
7318
|
-
case 1:
|
|
7319
|
-
_f.trys.push([1, 6, 7, 8]);
|
|
7320
|
-
_a = __values(this._validations), _b = _a.next();
|
|
7321
|
-
_f.label = 2;
|
|
7322
|
-
case 2:
|
|
7323
|
-
if (!!_b.done) return [3 /*break*/, 5];
|
|
7324
|
-
validation = _b.value;
|
|
7325
|
-
_d = (_c = markers).concat;
|
|
7326
|
-
return [4 /*yield*/, validation.validate(code, completionItems)];
|
|
7327
|
-
case 3:
|
|
7328
|
-
_d.apply(_c, [_f.sent()]);
|
|
7329
|
-
_f.label = 4;
|
|
7330
|
-
case 4:
|
|
7331
|
-
_b = _a.next();
|
|
7332
|
-
return [3 /*break*/, 2];
|
|
7333
|
-
case 5: return [3 /*break*/, 8];
|
|
7334
|
-
case 6:
|
|
7335
|
-
e_1_1 = _f.sent();
|
|
7336
|
-
e_1 = { error: e_1_1 };
|
|
7337
|
-
return [3 /*break*/, 8];
|
|
7338
|
-
case 7:
|
|
7339
|
-
try {
|
|
7340
|
-
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
7341
|
-
}
|
|
7342
|
-
finally { if (e_1) throw e_1.error; }
|
|
7343
|
-
return [7 /*endfinally*/];
|
|
7344
|
-
case 8: return [2 /*return*/, markers];
|
|
7345
|
-
}
|
|
7346
|
-
});
|
|
7347
|
-
});
|
|
7348
|
-
};
|
|
7349
|
-
return ValidationComposite;
|
|
7350
|
-
}());
|
|
7351
|
-
|
|
7352
|
-
/**
|
|
7353
|
-
* Linter for the "TaxCalculation" Language
|
|
7354
|
-
*/
|
|
7355
|
-
var TaxCalculationLinter = /** @class */ (function () {
|
|
7356
|
-
function TaxCalculationLinter() {
|
|
7357
|
-
this.setValidation();
|
|
7358
|
-
}
|
|
7359
|
-
TaxCalculationLinter.prototype.lint = function (code, completionItems) {
|
|
7360
|
-
return this._validation.validate(code, completionItems || []);
|
|
7361
|
-
};
|
|
7362
|
-
TaxCalculationLinter.prototype.setValidation = function () {
|
|
7363
|
-
var browserSupportsWorkers = typeof Worker !== "undefined";
|
|
7364
|
-
this._validation = browserSupportsWorkers
|
|
7365
|
-
? new ValidationWorkersComposite()
|
|
7366
|
-
: new ValidationComposite();
|
|
7367
|
-
};
|
|
7368
|
-
return TaxCalculationLinter;
|
|
7369
|
-
}());
|
|
7370
|
-
|
|
7371
7265
|
var CoreLinters = /** @class */ (function () {
|
|
7372
7266
|
function CoreLinters() {
|
|
7373
7267
|
}
|
|
7374
7268
|
CoreLinters.getLinter = function (language) {
|
|
7375
|
-
|
|
7269
|
+
var languageLinterFactory = CoreLinters._LINTERS.get(language);
|
|
7270
|
+
if (languageLinterFactory)
|
|
7271
|
+
return languageLinterFactory();
|
|
7376
7272
|
};
|
|
7377
|
-
CoreLinters._LINTERS = new Map([
|
|
7378
|
-
[exports.Languages.TaxCalculation, new TaxCalculationLinter()]
|
|
7379
|
-
]);
|
|
7273
|
+
CoreLinters._LINTERS = new Map([]);
|
|
7380
7274
|
return CoreLinters;
|
|
7381
7275
|
}());
|
|
7382
7276
|
|
|
@@ -7386,6 +7280,7 @@
|
|
|
7386
7280
|
this.$onCodeChange = new rxjs.Subject();
|
|
7387
7281
|
this.$onCodeValidityChange = new rxjs.Subject();
|
|
7388
7282
|
this._completionItems = [];
|
|
7283
|
+
this._lastCodeEmitted = "";
|
|
7389
7284
|
}
|
|
7390
7285
|
CoreFacade.prototype.changeEditorOptions = function (options) {
|
|
7391
7286
|
if (options) {
|
|
@@ -7398,11 +7293,11 @@
|
|
|
7398
7293
|
}
|
|
7399
7294
|
};
|
|
7400
7295
|
CoreFacade.prototype.changeCode = function (code) {
|
|
7401
|
-
|
|
7402
|
-
|
|
7296
|
+
var safeCode = this.getSafeCode(code);
|
|
7297
|
+
if (safeCode !== this._lastCodeEmitted) {
|
|
7298
|
+
this.setCode(safeCode);
|
|
7403
7299
|
}
|
|
7404
7300
|
};
|
|
7405
|
-
CoreFacade.prototype.destroyObservables = function () { };
|
|
7406
7301
|
CoreFacade.prototype.getOnCoreFinishLoadObservable = function () {
|
|
7407
7302
|
return this.$onCoreFinishLoad.asObservable();
|
|
7408
7303
|
};
|
|
@@ -7416,14 +7311,15 @@
|
|
|
7416
7311
|
this.$onCoreFinishLoad.next();
|
|
7417
7312
|
};
|
|
7418
7313
|
CoreFacade.prototype.notifyCodeChange = function (code) {
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
this
|
|
7422
|
-
this.
|
|
7314
|
+
var safeCode = this.getSafeCode(code);
|
|
7315
|
+
if (safeCode !== this._lastCodeEmitted) {
|
|
7316
|
+
this._lastCodeEmitted = safeCode;
|
|
7317
|
+
this.$onCodeChange.next(safeCode);
|
|
7318
|
+
this.validateCode(safeCode);
|
|
7423
7319
|
}
|
|
7424
7320
|
};
|
|
7425
7321
|
CoreFacade.prototype.updateCompletionItems = function (items) {
|
|
7426
|
-
this._completionItems = items;
|
|
7322
|
+
this._completionItems = items || [];
|
|
7427
7323
|
this.validateCode(this._lastCodeEmitted);
|
|
7428
7324
|
};
|
|
7429
7325
|
CoreFacade.prototype.setLinter = function (language) {
|
|
@@ -7440,7 +7336,7 @@
|
|
|
7440
7336
|
case 1:
|
|
7441
7337
|
markers = _a.sent();
|
|
7442
7338
|
this.highlightCode(markers);
|
|
7443
|
-
this.notifyCodeValidityChange(
|
|
7339
|
+
this.notifyCodeValidityChange(!markers.length);
|
|
7444
7340
|
_a.label = 2;
|
|
7445
7341
|
case 2: return [2 /*return*/];
|
|
7446
7342
|
}
|
|
@@ -7463,6 +7359,9 @@
|
|
|
7463
7359
|
if (theme && !themes.includes(theme))
|
|
7464
7360
|
throw new Error("The informed theme \"" + theme + "\" is not supported");
|
|
7465
7361
|
};
|
|
7362
|
+
CoreFacade.prototype.getSafeCode = function (code) {
|
|
7363
|
+
return typeof code === "string" ? code : "";
|
|
7364
|
+
};
|
|
7466
7365
|
return CoreFacade;
|
|
7467
7366
|
}());
|
|
7468
7367
|
|
|
@@ -7490,13 +7389,14 @@
|
|
|
7490
7389
|
configurable: true
|
|
7491
7390
|
});
|
|
7492
7391
|
CodeEditorComponent.prototype.ngOnInit = function () {
|
|
7392
|
+
this.coreFacade.initCore();
|
|
7493
7393
|
this.setupCoreListeners();
|
|
7494
7394
|
};
|
|
7495
7395
|
CodeEditorComponent.prototype.ngAfterViewInit = function () {
|
|
7496
7396
|
this.setCoreWrapperElement();
|
|
7497
7397
|
};
|
|
7498
7398
|
CodeEditorComponent.prototype.ngOnDestroy = function () {
|
|
7499
|
-
this.coreFacade.
|
|
7399
|
+
this.coreFacade.destroyCore();
|
|
7500
7400
|
this._ngUnsubscribe.next();
|
|
7501
7401
|
this._ngUnsubscribe.complete();
|
|
7502
7402
|
};
|
|
@@ -7870,18 +7770,6 @@
|
|
|
7870
7770
|
return CustomTranslationsModule;
|
|
7871
7771
|
}());
|
|
7872
7772
|
|
|
7873
|
-
/**
|
|
7874
|
-
* Function to get the position of the first occurrence of a regex in a string
|
|
7875
|
-
* @param string The string to search into
|
|
7876
|
-
* @param regex The regex to search into the string
|
|
7877
|
-
* @param position The index at which to begin searching the string. If omitted, search starts at the index 0.
|
|
7878
|
-
* @returns the position of the first occurrence of the informed regex.
|
|
7879
|
-
*/
|
|
7880
|
-
function regexIndexOf(string, regex, position) {
|
|
7881
|
-
var indexOf = string.substring(position || 0).search(regex);
|
|
7882
|
-
return (indexOf >= 0) ? (indexOf + (position || 0)) : indexOf;
|
|
7883
|
-
}
|
|
7884
|
-
|
|
7885
7773
|
var MarkerSeverity;
|
|
7886
7774
|
(function (MarkerSeverity) {
|
|
7887
7775
|
MarkerSeverity[MarkerSeverity["Error"] = 0] = "Error";
|
|
@@ -8144,38 +8032,6 @@
|
|
|
8144
8032
|
});
|
|
8145
8033
|
}
|
|
8146
8034
|
|
|
8147
|
-
var completionItemsMap = new Map();
|
|
8148
|
-
var usefulToCompletionItemsCompletionTypes = [
|
|
8149
|
-
CompletionTypes.Expression,
|
|
8150
|
-
CompletionTypes.UserExpression,
|
|
8151
|
-
CompletionTypes.FinalValue
|
|
8152
|
-
];
|
|
8153
|
-
/*
|
|
8154
|
-
* Updates the completionItems used by the core.
|
|
8155
|
-
* Utilizes the path and filter to create a key and store the results from the search to the given "path.filter" on a map.
|
|
8156
|
-
* Must save the results to each different filter for the search does not bring all the results, so the user must do a more
|
|
8157
|
-
* specific filter to achieve its objective
|
|
8158
|
-
*/
|
|
8159
|
-
function updateCoreCompletionItems(completionItem) {
|
|
8160
|
-
var path = completionItem.path, filter = completionItem.filter, completions = completionItem.completions;
|
|
8161
|
-
var mapPath = path + "." + filter;
|
|
8162
|
-
var filteredCompletions = (completions || []).filter(function (completion) {
|
|
8163
|
-
return usefulToCompletionItemsCompletionTypes.includes(completion === null || completion === void 0 ? void 0 : completion.type);
|
|
8164
|
-
});
|
|
8165
|
-
var formattedSearchResults = filteredCompletions.map(function (completion) {
|
|
8166
|
-
return path === "" ? completion === null || completion === void 0 ? void 0 : completion.label : path + "." + (completion === null || completion === void 0 ? void 0 : completion.label);
|
|
8167
|
-
});
|
|
8168
|
-
completionItemsMap.delete(mapPath);
|
|
8169
|
-
if (formattedSearchResults.length) {
|
|
8170
|
-
completionItemsMap.set(mapPath, formattedSearchResults);
|
|
8171
|
-
}
|
|
8172
|
-
var allArraysFromMap = Array.from(completionItemsMap.values());
|
|
8173
|
-
var unrepeatedCompletionItems = new Set(allArraysFromMap.flat());
|
|
8174
|
-
CodeMirror6Core
|
|
8175
|
-
.$onCompletionItemsUpdate
|
|
8176
|
-
.next(Array.from(unrepeatedCompletionItems));
|
|
8177
|
-
}
|
|
8178
|
-
|
|
8179
8035
|
/**
|
|
8180
8036
|
* Adds style to the autocomplete
|
|
8181
8037
|
* @returns An extension containing the style
|
|
@@ -8306,7 +8162,6 @@
|
|
|
8306
8162
|
filter: false,
|
|
8307
8163
|
options: sortedCompletions
|
|
8308
8164
|
};
|
|
8309
|
-
updateCoreCompletionItems({ path: path, filter: filter, completions: sortedCompletions });
|
|
8310
8165
|
autocomplete$2.startCompletion(CodeMirror6Core.getEditorView());
|
|
8311
8166
|
}
|
|
8312
8167
|
else {
|
|
@@ -8555,195 +8410,9 @@
|
|
|
8555
8410
|
});
|
|
8556
8411
|
}
|
|
8557
8412
|
|
|
8558
|
-
/**
|
|
8559
|
-
* Adds an watcher to the paste command that updates the core's completions items
|
|
8560
|
-
* @returns An extension containing everything needed to create the the updater
|
|
8561
|
-
*/
|
|
8562
|
-
function onPasteCompletionItemsUpdater() {
|
|
8563
|
-
return [
|
|
8564
|
-
view.keymap.of([
|
|
8565
|
-
{
|
|
8566
|
-
key: "Ctrl-v",
|
|
8567
|
-
run: searchCompletionResultsCommand,
|
|
8568
|
-
}
|
|
8569
|
-
])
|
|
8570
|
-
];
|
|
8571
|
-
}
|
|
8572
|
-
var cancelLastCompletionSearch$1 = function () { };
|
|
8573
|
-
var ɵ0$1 = cancelLastCompletionSearch$1;
|
|
8574
|
-
/*
|
|
8575
|
-
* Must use the setTimeout for we does not have access to the code pasted on the current state, so we need to wait codemirror
|
|
8576
|
-
* remake the state, also it would be way more difficult to work with the clipboard
|
|
8577
|
-
*/
|
|
8578
|
-
function searchCompletionResultsCommand(view) {
|
|
8579
|
-
cancelLastCompletionSearch$1();
|
|
8580
|
-
var token = new AbortController();
|
|
8581
|
-
setTimeout(function () {
|
|
8582
|
-
if (!token.signal.aborted) {
|
|
8583
|
-
searchCompletionResults$1(view.state.doc.toString(), token);
|
|
8584
|
-
}
|
|
8585
|
-
}, 200);
|
|
8586
|
-
cancelLastCompletionSearch$1 = function () { return token.abort(); };
|
|
8587
|
-
return false;
|
|
8588
|
-
}
|
|
8589
|
-
/*
|
|
8590
|
-
* Requests the necessary items to update the core's completionItems when the user uses the ctrl+v
|
|
8591
|
-
*/
|
|
8592
|
-
function searchCompletionResults$1(code, token) {
|
|
8593
|
-
var codeWithoutStrings = getCodeWithoutStringedCode(code);
|
|
8594
|
-
var variablesToVerify = getVariablesToVerify(codeWithoutStrings);
|
|
8595
|
-
var requests = getRequestsBasedOnVariables(variablesToVerify, token.signal);
|
|
8596
|
-
Promise
|
|
8597
|
-
.all(requests)
|
|
8598
|
-
.then(function (responses) {
|
|
8599
|
-
if (!token.signal.aborted) {
|
|
8600
|
-
var expressionsCompletionItems = getExpressionsCompletionsItems(responses);
|
|
8601
|
-
var entitiesCompletionItems = getEntitiesCompletionsItems(responses);
|
|
8602
|
-
var completionItems = expressionsCompletionItems.concat(entitiesCompletionItems);
|
|
8603
|
-
updateCompletionItems(completionItems);
|
|
8604
|
-
}
|
|
8605
|
-
});
|
|
8606
|
-
}
|
|
8607
|
-
/*
|
|
8608
|
-
* Returns the code itself without its inside double quotes parts, e.g
|
|
8609
|
-
* on string `return this "here not" code`, the return value will be `return this code`;
|
|
8610
|
-
*/
|
|
8611
|
-
function getCodeWithoutStringedCode(code) {
|
|
8612
|
-
return (code !== null && code !== void 0 ? code : "").replace(/"([^"])*["]?/g, " ");
|
|
8613
|
-
}
|
|
8614
|
-
/*
|
|
8615
|
-
* Returns the code's parts that need to be verified by requests, excluding the keywords,
|
|
8616
|
-
* special character (except dot/`.` in middle of two regex's \w and at the end and hashtag in sentence's start)
|
|
8617
|
-
* e.g on string `SE (something.another OU expression E something.another.)`, the variables array would be
|
|
8618
|
-
* ["something.another", "expression", "something.another."]
|
|
8619
|
-
*/
|
|
8620
|
-
function getVariablesToVerify(code) {
|
|
8621
|
-
var _a;
|
|
8622
|
-
var keywordsRegex = Object
|
|
8623
|
-
.values(Keywords)
|
|
8624
|
-
.map(function (keyword) { return "(?!" + keyword + "\\b)"; })
|
|
8625
|
-
.join("");
|
|
8626
|
-
return (_a = (code !== null && code !== void 0 ? code : "").match(new RegExp("[#]?\\b(" + keywordsRegex + ")(\\w+\\.)*\\w+[\\.]?", "g"))) !== null && _a !== void 0 ? _a : [];
|
|
8627
|
-
}
|
|
8628
|
-
/*
|
|
8629
|
-
* Only needs to request the expressions and the fields from an entity;
|
|
8630
|
-
* Creates an request to every variable;
|
|
8631
|
-
* Uses the AutocompleteService for the requests needed here are Autocomplete's usage, so we are just
|
|
8632
|
-
* borrowing from it
|
|
8633
|
-
*/
|
|
8634
|
-
function getRequestsBasedOnVariables(variables, abortSignal) {
|
|
8635
|
-
var e_1, _a;
|
|
8636
|
-
var _b;
|
|
8637
|
-
var languageConfigs = getLanguageConfigs();
|
|
8638
|
-
var requests = [];
|
|
8639
|
-
try {
|
|
8640
|
-
for (var variables_1 = __values(variables), variables_1_1 = variables_1.next(); !variables_1_1.done; variables_1_1 = variables_1.next()) {
|
|
8641
|
-
var variable = variables_1_1.value;
|
|
8642
|
-
var splittedVariable = variable.split(".");
|
|
8643
|
-
if (splittedVariable.length === 1) {
|
|
8644
|
-
var extraInfo = {
|
|
8645
|
-
path: "",
|
|
8646
|
-
filter: splittedVariable[0]
|
|
8647
|
-
};
|
|
8648
|
-
requests.push({
|
|
8649
|
-
requestType: RequestTypes.ListExpressionMetadata,
|
|
8650
|
-
request: AutocompleteService.listExpressionMetadata({
|
|
8651
|
-
context: languageConfigs.contexts,
|
|
8652
|
-
subcontext: (_b = languageConfigs.subContexts) !== null && _b !== void 0 ? _b : [],
|
|
8653
|
-
name: splittedVariable[0]
|
|
8654
|
-
}, abortSignal),
|
|
8655
|
-
extraInfo: extraInfo
|
|
8656
|
-
});
|
|
8657
|
-
}
|
|
8658
|
-
else if (splittedVariable.length > 2) {
|
|
8659
|
-
var extraInfo = {
|
|
8660
|
-
path: splittedVariable
|
|
8661
|
-
.slice(0, splittedVariable.length - 1)
|
|
8662
|
-
.join("."),
|
|
8663
|
-
filter: ""
|
|
8664
|
-
};
|
|
8665
|
-
requests.push({
|
|
8666
|
-
requestType: RequestTypes.GetFacadeMetadataByPath,
|
|
8667
|
-
request: AutocompleteService.getFacadeMetadataByPath({
|
|
8668
|
-
context: splittedVariable[0],
|
|
8669
|
-
entityName: splittedVariable[1],
|
|
8670
|
-
fields: splittedVariable.slice(2, splittedVariable.length - 1)
|
|
8671
|
-
}, abortSignal),
|
|
8672
|
-
extraInfo: extraInfo
|
|
8673
|
-
});
|
|
8674
|
-
}
|
|
8675
|
-
}
|
|
8676
|
-
}
|
|
8677
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8678
|
-
finally {
|
|
8679
|
-
try {
|
|
8680
|
-
if (variables_1_1 && !variables_1_1.done && (_a = variables_1.return)) _a.call(variables_1);
|
|
8681
|
-
}
|
|
8682
|
-
finally { if (e_1) throw e_1.error; }
|
|
8683
|
-
}
|
|
8684
|
-
return requests.map(function (request) { return getSafeResponse(request); });
|
|
8685
|
-
}
|
|
8686
|
-
function getExpressionsCompletionsItems(responses) {
|
|
8687
|
-
var expressionsResponses = responses.filter(function (response) {
|
|
8688
|
-
return (response === null || response === void 0 ? void 0 : response.requestType) === RequestTypes.ListExpressionMetadata;
|
|
8689
|
-
});
|
|
8690
|
-
return expressionsResponses
|
|
8691
|
-
.map(function (expressionsResponse) {
|
|
8692
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8693
|
-
return {
|
|
8694
|
-
path: (_b = (_a = expressionsResponse.extraInfo) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : "",
|
|
8695
|
-
filter: (_d = (_c = expressionsResponse.extraInfo) === null || _c === void 0 ? void 0 : _c.filter) !== null && _d !== void 0 ? _d : "",
|
|
8696
|
-
completions: ((_f = (_e = expressionsResponse.response) === null || _e === void 0 ? void 0 : _e.expressionMetadata) !== null && _f !== void 0 ? _f : [])
|
|
8697
|
-
.map(function (expressionMetadata) { return ({
|
|
8698
|
-
label: expressionMetadata.name,
|
|
8699
|
-
type: expressionMetadata.type === MetaType.PUBLIC_EXPRESSION
|
|
8700
|
-
? CompletionTypes.Expression
|
|
8701
|
-
: CompletionTypes.UserExpression
|
|
8702
|
-
}); })
|
|
8703
|
-
};
|
|
8704
|
-
})
|
|
8705
|
-
.flat();
|
|
8706
|
-
}
|
|
8707
|
-
function getEntitiesCompletionsItems(responses) {
|
|
8708
|
-
var facadesResponsesFromGet = responses.filter(function (response) {
|
|
8709
|
-
return (response === null || response === void 0 ? void 0 : response.requestType) === RequestTypes.GetFacadeMetadataByPath;
|
|
8710
|
-
});
|
|
8711
|
-
return facadesResponsesFromGet
|
|
8712
|
-
.map(function (facadesResponseFromGet) {
|
|
8713
|
-
var _a, _b, _c;
|
|
8714
|
-
return {
|
|
8715
|
-
path: facadesResponseFromGet.extraInfo.path,
|
|
8716
|
-
filter: facadesResponseFromGet.extraInfo.filter,
|
|
8717
|
-
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 : [])
|
|
8718
|
-
.map(function (facade) { return ({
|
|
8719
|
-
label: facade.name,
|
|
8720
|
-
type: facade.type === MetaType.ENTITY ? CompletionTypes.Entity : CompletionTypes.FinalValue
|
|
8721
|
-
}); })
|
|
8722
|
-
};
|
|
8723
|
-
})
|
|
8724
|
-
.flat();
|
|
8725
|
-
}
|
|
8726
|
-
function updateCompletionItems(completionItems) {
|
|
8727
|
-
var e_2, _a;
|
|
8728
|
-
try {
|
|
8729
|
-
for (var completionItems_1 = __values(completionItems), completionItems_1_1 = completionItems_1.next(); !completionItems_1_1.done; completionItems_1_1 = completionItems_1.next()) {
|
|
8730
|
-
var completionItem = completionItems_1_1.value;
|
|
8731
|
-
updateCoreCompletionItems(completionItem);
|
|
8732
|
-
}
|
|
8733
|
-
}
|
|
8734
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
8735
|
-
finally {
|
|
8736
|
-
try {
|
|
8737
|
-
if (completionItems_1_1 && !completionItems_1_1.done && (_a = completionItems_1.return)) _a.call(completionItems_1);
|
|
8738
|
-
}
|
|
8739
|
-
finally { if (e_2) throw e_2.error; }
|
|
8740
|
-
}
|
|
8741
|
-
}
|
|
8742
|
-
|
|
8743
8413
|
function TaxCalculation() {
|
|
8744
8414
|
return new language.LanguageSupport(baseConfigs, [
|
|
8745
8415
|
autocomplete(),
|
|
8746
|
-
onPasteCompletionItemsUpdater(),
|
|
8747
8416
|
]);
|
|
8748
8417
|
}
|
|
8749
8418
|
|
|
@@ -8751,10 +8420,13 @@
|
|
|
8751
8420
|
function EditorLanguages() {
|
|
8752
8421
|
}
|
|
8753
8422
|
EditorLanguages.getLanguage = function (language) {
|
|
8754
|
-
|
|
8423
|
+
var languageSupportFactory = EditorLanguages._LANGUAGES.get(language);
|
|
8424
|
+
if (languageSupportFactory)
|
|
8425
|
+
return languageSupportFactory();
|
|
8426
|
+
return [];
|
|
8755
8427
|
};
|
|
8756
8428
|
EditorLanguages._LANGUAGES = new Map([
|
|
8757
|
-
[exports.Languages.TaxCalculation, TaxCalculation
|
|
8429
|
+
[exports.Languages.TaxCalculation, TaxCalculation]
|
|
8758
8430
|
]);
|
|
8759
8431
|
return EditorLanguages;
|
|
8760
8432
|
}());
|
|
@@ -8774,15 +8446,15 @@
|
|
|
8774
8446
|
var SDSLightHighlightStyle = highlight.HighlightStyle.define([
|
|
8775
8447
|
{
|
|
8776
8448
|
tag: highlight.tags.keyword,
|
|
8777
|
-
color: "
|
|
8449
|
+
color: "#008080",
|
|
8778
8450
|
},
|
|
8779
8451
|
{
|
|
8780
8452
|
tag: highlight.tags.string,
|
|
8781
|
-
color: "
|
|
8453
|
+
color: "#9C3A3A",
|
|
8782
8454
|
},
|
|
8783
8455
|
{
|
|
8784
8456
|
tag: highlight.tags.number,
|
|
8785
|
-
color: "
|
|
8457
|
+
color: "#400753",
|
|
8786
8458
|
},
|
|
8787
8459
|
]);
|
|
8788
8460
|
|
|
@@ -8932,10 +8604,13 @@
|
|
|
8932
8604
|
function EditorThemes() {
|
|
8933
8605
|
}
|
|
8934
8606
|
EditorThemes.getTheme = function (theme) {
|
|
8935
|
-
|
|
8607
|
+
var EditorThemeFactory = EditorThemes._THEMES.get(theme);
|
|
8608
|
+
if (EditorThemeFactory)
|
|
8609
|
+
return EditorThemeFactory();
|
|
8610
|
+
return [];
|
|
8936
8611
|
};
|
|
8937
8612
|
EditorThemes._THEMES = new Map([
|
|
8938
|
-
[exports.Themes.SDSLight, SDSLight
|
|
8613
|
+
[exports.Themes.SDSLight, SDSLight]
|
|
8939
8614
|
]);
|
|
8940
8615
|
return EditorThemes;
|
|
8941
8616
|
}());
|
|
@@ -8947,7 +8622,6 @@
|
|
|
8947
8622
|
/* These are necessary for the setCode and setEditorOptions can be called before view has been created */
|
|
8948
8623
|
_this._codeReceivedBeforeViewCreation = "";
|
|
8949
8624
|
_this._editorOptionsReceivedBeforeViewCreation = [];
|
|
8950
|
-
_this.setObservablesListeners();
|
|
8951
8625
|
return _this;
|
|
8952
8626
|
}
|
|
8953
8627
|
CodeMirror6Core.getEditorView = function () {
|
|
@@ -8967,8 +8641,12 @@
|
|
|
8967
8641
|
CodeMirror6Core.prototype.setCode = function (code) {
|
|
8968
8642
|
this.changeEditorContent(code);
|
|
8969
8643
|
};
|
|
8970
|
-
|
|
8971
|
-
|
|
8644
|
+
CodeMirror6Core.prototype.initCore = function () {
|
|
8645
|
+
this.setObservablesListeners();
|
|
8646
|
+
};
|
|
8647
|
+
CodeMirror6Core.prototype.destroyCore = function () {
|
|
8648
|
+
this._codeReceivedBeforeViewCreation = "";
|
|
8649
|
+
CodeMirror6Core._editorView = null;
|
|
8972
8650
|
CodeMirror6Core._ngUnsubscribe.next();
|
|
8973
8651
|
CodeMirror6Core._ngUnsubscribe.complete();
|
|
8974
8652
|
};
|