@netgrif/components-core 6.0.2 → 6.0.4-rc.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 (50) hide show
  1. package/bundles/netgrif-components-core.umd.js +105 -34
  2. package/bundles/netgrif-components-core.umd.js.map +1 -1
  3. package/bundles/netgrif-components-core.umd.min.js +1 -1
  4. package/bundles/netgrif-components-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/authentication/components/abstract-authentication-overlay.js +2 -2
  6. package/esm2015/lib/configuration/configuration.service.js +7 -5
  7. package/esm2015/lib/data-fields/file-field/abstract-file-field.component.js +6 -3
  8. package/esm2015/lib/data-fields/file-list-field/abstract-file-list-field.component.js +6 -3
  9. package/esm2015/lib/data-fields/models/file-field-id-body.js +2 -0
  10. package/esm2015/lib/groups/services/next-group.service.js +2 -2
  11. package/esm2015/lib/process/process.service.js +3 -2
  12. package/esm2015/lib/resources/engine-endpoint/public/public-task-resource.service.js +1 -1
  13. package/esm2015/lib/search/models/category/case/case-dataset.js +3 -6
  14. package/esm2015/lib/search/models/category/case/case-simple-dataset.js +3 -3
  15. package/esm2015/lib/search/models/category/case/case-title.js +13 -3
  16. package/esm2015/lib/search/models/category/case/case-visual-id.js +13 -3
  17. package/esm2015/lib/search/models/category/category.js +10 -2
  18. package/esm2015/lib/search/models/operator/substring.js +3 -3
  19. package/esm2015/lib/search/search-keyword-resolver-service/search-index-resolver.service.js +18 -3
  20. package/esm2015/lib/search/search-service/search.service.js +3 -2
  21. package/esm5/lib/authentication/components/abstract-authentication-overlay.js +2 -2
  22. package/esm5/lib/configuration/configuration.service.js +23 -10
  23. package/esm5/lib/data-fields/file-field/abstract-file-field.component.js +6 -3
  24. package/esm5/lib/data-fields/file-list-field/abstract-file-list-field.component.js +6 -3
  25. package/esm5/lib/data-fields/models/file-field-id-body.js +2 -0
  26. package/esm5/lib/groups/services/next-group.service.js +2 -2
  27. package/esm5/lib/process/process.service.js +3 -2
  28. package/esm5/lib/resources/engine-endpoint/public/public-task-resource.service.js +1 -1
  29. package/esm5/lib/search/models/category/case/case-dataset.js +3 -6
  30. package/esm5/lib/search/models/category/case/case-simple-dataset.js +3 -3
  31. package/esm5/lib/search/models/category/case/case-title.js +19 -4
  32. package/esm5/lib/search/models/category/case/case-visual-id.js +19 -4
  33. package/esm5/lib/search/models/category/category.js +10 -2
  34. package/esm5/lib/search/models/operator/substring.js +3 -3
  35. package/esm5/lib/search/search-keyword-resolver-service/search-index-resolver.service.js +17 -2
  36. package/esm5/lib/search/search-service/search.service.js +3 -2
  37. package/fesm2015/netgrif-components-core.js +78 -28
  38. package/fesm2015/netgrif-components-core.js.map +1 -1
  39. package/fesm5/netgrif-components-core.js +106 -35
  40. package/fesm5/netgrif-components-core.js.map +1 -1
  41. package/lib/configuration/configuration.service.d.ts +1 -0
  42. package/lib/data-fields/models/file-field-id-body.d.ts +3 -0
  43. package/lib/process/process.service.d.ts +1 -0
  44. package/lib/search/models/category/case/case-dataset.d.ts +0 -2
  45. package/lib/search/models/category/case/case-title.d.ts +4 -1
  46. package/lib/search/models/category/case/case-visual-id.d.ts +4 -1
  47. package/lib/search/models/category/category.d.ts +7 -0
  48. package/lib/search/search-keyword-resolver-service/search-index-resolver.service.d.ts +12 -0
  49. package/netgrif-components-core.metadata.json +1 -1
  50. package/package.json +1 -1
@@ -527,18 +527,28 @@
527
527
  * @return requested configuration if it exists. `undefined` otherwise.
528
528
  */
529
529
  ConfigurationService.prototype.getViewByUrl = function (url) {
530
- var config = this.createConfigurationCopy();
531
- var views = config.views;
530
+ var e_1, _a;
531
+ var views = this.getViewsCopy();
532
532
  if (!views) {
533
533
  return undefined;
534
534
  }
535
535
  var map = new Map();
536
536
  map = this.getChildren(views, map, '');
537
537
  if (map.get(url) === undefined) {
538
- map.forEach(function (value, key) {
539
- if (key.includes('/**') && url.includes(key.split('/**')[0]))
540
- return value;
541
- });
538
+ try {
539
+ for (var map_1 = __values(map), map_1_1 = map_1.next(); !map_1_1.done; map_1_1 = map_1.next()) {
540
+ var _b = __read(map_1_1.value, 2), key = _b[0], value = _b[1];
541
+ if (key.includes('/**') && url.includes(key.split('/**')[0]))
542
+ return value;
543
+ }
544
+ }
545
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
546
+ finally {
547
+ try {
548
+ if (map_1_1 && !map_1_1.done && (_a = map_1.return)) _a.call(map_1);
549
+ }
550
+ finally { if (e_1) throw e_1.error; }
551
+ }
542
552
  }
543
553
  return map.get(url);
544
554
  };
@@ -585,7 +595,7 @@
585
595
  * Calling this method with an empty array as argument is equivalent to calling the [get()]{@link ConfigurationService#get} method.
586
596
  */
587
597
  ConfigurationService.prototype.getConfigurationSubtree = function (pathSegments) {
588
- var e_1, _a;
598
+ var e_2, _a;
589
599
  var root = this.configuration;
590
600
  try {
591
601
  for (var pathSegments_1 = __values(pathSegments), pathSegments_1_1 = pathSegments_1.next(); !pathSegments_1_1.done; pathSegments_1_1 = pathSegments_1.next()) {
@@ -596,12 +606,12 @@
596
606
  root = root[segment];
597
607
  }
598
608
  }
599
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
609
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
600
610
  finally {
601
611
  try {
602
612
  if (pathSegments_1_1 && !pathSegments_1_1.done && (_a = pathSegments_1.return)) _a.call(pathSegments_1);
603
613
  }
604
- finally { if (e_1) throw e_1.error; }
614
+ finally { if (e_2) throw e_2.error; }
605
615
  }
606
616
  return this.deepCopy(root);
607
617
  };
@@ -689,6 +699,9 @@
689
699
  ConfigurationService.prototype.createConfigurationCopy = function () {
690
700
  return this.deepCopy(this.configuration);
691
701
  };
702
+ ConfigurationService.prototype.getViewsCopy = function () {
703
+ return this.getConfigurationSubtree(['views']);
704
+ };
692
705
  ConfigurationService.prototype.deepCopy = function (obj) {
693
706
  return JSON.parse(JSON.stringify(obj));
694
707
  };
@@ -6850,8 +6863,11 @@
6850
6863
  this.state.uploading = true;
6851
6864
  var fileFormData = new FormData();
6852
6865
  var fileToUpload = this.fileUploadEl.nativeElement.files.item(0);
6866
+ var data = {};
6867
+ data[this.resolveParentTaskId()] = this.dataField.stringId;
6853
6868
  fileFormData.append('file', fileToUpload);
6854
- this._taskResourceService.uploadFile(this.resolveParentTaskId(), this.dataField.stringId, fileFormData, false)
6869
+ fileFormData.append('data', new Blob([JSON.stringify(data)], { type: 'application/json' }));
6870
+ this._taskResourceService.uploadFile(this.taskId, this.dataField.stringId, fileFormData, false)
6855
6871
  .subscribe(function (response) {
6856
6872
  if (response.type && response.type === exports.ProgressType.UPLOAD) {
6857
6873
  _this.state.progress = response.progress;
@@ -6952,7 +6968,7 @@
6952
6968
  this._log.error('File cannot be deleted. No task is set to the field.');
6953
6969
  return;
6954
6970
  }
6955
- this._taskResourceService.deleteFile(this.resolveParentTaskId(), this.dataField.stringId).pipe(operators.take(1)).subscribe(function (response) {
6971
+ this._taskResourceService.deleteFile(this.taskId, this.dataField.stringId).pipe(operators.take(1)).subscribe(function (response) {
6956
6972
  if (response.success) {
6957
6973
  var filename = _this.dataField.value.name;
6958
6974
  _this.dataField.value = {};
@@ -7240,7 +7256,10 @@
7240
7256
  filesToUpload.forEach(function (fileToUpload) {
7241
7257
  fileFormData.append('files', fileToUpload);
7242
7258
  });
7243
- this._taskResourceService.uploadFile(this.resolveParentTaskId(), this.dataField.stringId, fileFormData, true)
7259
+ var data = {};
7260
+ data[this.resolveParentTaskId()] = this.dataField.stringId;
7261
+ fileFormData.append('data', new Blob([JSON.stringify(data)], { type: 'application/json' }));
7262
+ this._taskResourceService.uploadFile(this.taskId, this.dataField.stringId, fileFormData, true)
7244
7263
  .subscribe(function (response) {
7245
7264
  if (response.type && response.type === exports.ProgressType.UPLOAD) {
7246
7265
  _this.state.progress = response.progress;
@@ -7328,7 +7347,7 @@
7328
7347
  this._log.error('File cannot be deleted. No task is set to the field.');
7329
7348
  return;
7330
7349
  }
7331
- this._taskResourceService.deleteFile(this.resolveParentTaskId(), this.dataField.stringId, fileName).pipe(operators.take(1)).subscribe(function (response) {
7350
+ this._taskResourceService.deleteFile(this.taskId, this.dataField.stringId, fileName).pipe(operators.take(1)).subscribe(function (response) {
7332
7351
  if (response.success) {
7333
7352
  _this.uploadedFiles = _this.uploadedFiles.filter(function (uploadedFile) { return uploadedFile !== fileName; });
7334
7353
  if (_this.dataField.value.namesPaths) {
@@ -9707,8 +9726,8 @@
9707
9726
  // TODO IMPROVEMENT 27.4.2020 - we could use regular expressions to search for substrings which would solve the unintuitive
9708
9727
  // behavior that occurs when we search for strings that contain spaces. We need to escape the input string in a special way
9709
9728
  // if we choose to do this
9710
- var escapedValue = Operator.escapeInput(args[0]).value;
9711
- return Operator.forEachKeyword(elasticKeywords, function (keyword) { return new Query("(" + keyword + ":\\*" + escapedValue + "\\*)"); });
9729
+ var escapedValue = Operator.escapeInput(args[0]).value.replace(' ', '\\ ');
9730
+ return Operator.forEachKeyword(elasticKeywords, function (keyword) { return new Query("(" + keyword + ":*" + escapedValue + "*)"); });
9712
9731
  };
9713
9732
  Substring.prototype.getOperatorNameTemplate = function () {
9714
9733
  return ['search.operator.substring', Operator.INPUT_PLACEHOLDER];
@@ -10010,6 +10029,7 @@
10010
10029
  */
10011
10030
  var SearchIndexResolverService = /** @class */ (function () {
10012
10031
  function SearchIndexResolverService() {
10032
+ this.KEYWORD = '.keyword';
10013
10033
  }
10014
10034
  /**
10015
10035
  * Constructs the index name for the specified field.
@@ -10024,7 +10044,21 @@
10024
10044
  */
10025
10045
  SearchIndexResolverService.prototype.getIndex = function (dataFieldIdentifier, index, keyword) {
10026
10046
  if (keyword === void 0) { keyword = false; }
10027
- return "dataSet." + dataFieldIdentifier + "." + index + (keyword ? '.keyword' : '');
10047
+ return "dataSet." + dataFieldIdentifier + "." + index + (keyword ? this.KEYWORD : '');
10048
+ };
10049
+ /**
10050
+ * Constructs the index name for the specified core field.
10051
+ *
10052
+ * Note that almost all combinations are valid and will not throw an error when used to query the database, but not all combinations are
10053
+ * used by the application engine. The {@link SearchIndex} class has some information about which field types map to which indices, but
10054
+ * you should consult the backend documentation for more reliable information.
10055
+ * @param index the queried index
10056
+ * @param keyword whether the keyword of a TEXT index should be queried
10057
+ * @returns the full name of the specified index
10058
+ */
10059
+ SearchIndexResolverService.prototype.getCoreIndex = function (index, keyword) {
10060
+ if (keyword === void 0) { keyword = false; }
10061
+ return "" + index + (keyword ? this.KEYWORD : '');
10028
10062
  };
10029
10063
  SearchIndexResolverService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function SearchIndexResolverService_Factory() { return new SearchIndexResolverService(); }, token: SearchIndexResolverService, providedIn: "root" });
10030
10064
  SearchIndexResolverService.decorators = [
@@ -10519,7 +10553,7 @@
10519
10553
  if (!this.isOperatorSelected()) {
10520
10554
  throw new Error('Category cannot generate a Query if no Operator is selected');
10521
10555
  }
10522
- return this._operatorFormControl.value.createQuery(this._elasticKeywords, userInput);
10556
+ return this._operatorFormControl.value.createQuery(this.elasticKeywords, userInput);
10523
10557
  };
10524
10558
  /**
10525
10559
  * Calls the [generateQuery]{@link Category#generateQuery} method and creates an {@link ElementaryPredicate} with the result.
@@ -10820,6 +10854,14 @@
10820
10854
  }
10821
10855
  return { segment: segment, bold: true };
10822
10856
  };
10857
+ /**
10858
+ * Checks for selected operator
10859
+ * @param operatorClass the operator to be checked
10860
+ * @return boolean of the statement
10861
+ */
10862
+ Category.prototype.isSelectedOperator = function (operatorClass) {
10863
+ return this.selectedOperator === this._operatorService.getOperator(operatorClass);
10864
+ };
10823
10865
  /**
10824
10866
  * The {@link CategoryMetadataConfiguration} key for this Category's {@link Operator}
10825
10867
  */
@@ -11672,12 +11714,12 @@
11672
11714
  return resolver.getIndex(datafield.fieldId, exports.SearchIndex.BOOLEAN);
11673
11715
  case 'file':
11674
11716
  case 'fileList':
11675
- return resolver.getIndex(datafield.fieldId, exports.SearchIndex.FILE_NAME, this.isSelectedOperator(Equals) || this.isSelectedOperator(NotEquals));
11717
+ return resolver.getIndex(datafield.fieldId, exports.SearchIndex.FILE_NAME, this.isSelectedOperator(Equals) || this.isSelectedOperator(NotEquals) || this.isSelectedOperator(Substring));
11676
11718
  case 'user':
11677
11719
  case 'userList':
11678
11720
  return resolver.getIndex(datafield.fieldId, exports.SearchIndex.USER_ID);
11679
11721
  default:
11680
- return resolver.getIndex(datafield.fieldId, exports.SearchIndex.FULLTEXT, this.isSelectedOperator(Equals) || this.isSelectedOperator(NotEquals));
11722
+ return resolver.getIndex(datafield.fieldId, exports.SearchIndex.FULLTEXT, this.isSelectedOperator(Equals) || this.isSelectedOperator(NotEquals) || this.isSelectedOperator(Substring));
11681
11723
  }
11682
11724
  };
11683
11725
  Object.defineProperty(CaseDataset.prototype, "inputPlaceholder", {
@@ -11825,9 +11867,6 @@
11825
11867
  }
11826
11868
  return value;
11827
11869
  };
11828
- CaseDataset.prototype.isSelectedOperator = function (operatorClass) {
11829
- return this.selectedOperator === this._operatorService.getOperator(operatorClass);
11830
- };
11831
11870
  CaseDataset.prototype.serializeClass = function () {
11832
11871
  return exports.Categories.CASE_DATASET;
11833
11872
  };
@@ -12048,14 +12087,14 @@
12048
12087
  break;
12049
12088
  case 'file':
12050
12089
  case 'fileList':
12051
- this._elasticKeyword = resolver.getIndex(this._fieldId, exports.SearchIndex.FILE_NAME);
12090
+ this._elasticKeyword = resolver.getIndex(this._fieldId, exports.SearchIndex.FILE_NAME, this.isSelectedOperator(Substring));
12052
12091
  break;
12053
12092
  case 'user':
12054
12093
  case 'userList':
12055
12094
  this._elasticKeyword = resolver.getIndex(this._fieldId, exports.SearchIndex.USER_ID);
12056
12095
  break;
12057
12096
  default:
12058
- this._elasticKeyword = resolver.getIndex(this._fieldId, exports.SearchIndex.FULLTEXT);
12097
+ this._elasticKeyword = resolver.getIndex(this._fieldId, exports.SearchIndex.FULLTEXT, this.isSelectedOperator(Substring));
12059
12098
  }
12060
12099
  };
12061
12100
  Object.defineProperty(CaseSimpleDataset.prototype, "elasticKeywords", {
@@ -12160,13 +12199,15 @@
12160
12199
 
12161
12200
  var CaseTitle = /** @class */ (function (_super) {
12162
12201
  __extends(CaseTitle, _super);
12163
- function CaseTitle(operators, logger) {
12164
- return _super.call(this, [exports.CaseSearch.TITLE], [
12202
+ function CaseTitle(operators, logger, _optionalDependencies) {
12203
+ var _this = _super.call(this, [exports.CaseSearch.TITLE], [
12165
12204
  operators.getOperator(Substring),
12166
12205
  operators.getOperator(Equals),
12167
12206
  operators.getOperator(NotEquals),
12168
12207
  operators.getOperator(Like)
12169
12208
  ], CaseTitle._i18n + ".name", exports.SearchInputType.TEXT, logger, operators) || this;
12209
+ _this._optionalDependencies = _optionalDependencies;
12210
+ return _this;
12170
12211
  }
12171
12212
  Object.defineProperty(CaseTitle.prototype, "inputPlaceholder", {
12172
12213
  get: function () {
@@ -12176,19 +12217,34 @@
12176
12217
  configurable: true
12177
12218
  });
12178
12219
  CaseTitle.prototype.duplicate = function () {
12179
- return new CaseTitle(this._operatorService, this._log);
12220
+ return new CaseTitle(this._operatorService, this._log, this._optionalDependencies);
12180
12221
  };
12181
12222
  CaseTitle.prototype.serializeClass = function () {
12182
12223
  return exports.Categories.CASE_TITLE;
12183
12224
  };
12225
+ Object.defineProperty(CaseTitle.prototype, "elasticKeywords", {
12226
+ get: function () {
12227
+ if (!!this._optionalDependencies) {
12228
+ var resolver = this._optionalDependencies.searchIndexResolver;
12229
+ return [resolver.getCoreIndex(exports.CaseSearch.TITLE, this.isSelectedOperator(Substring))];
12230
+ }
12231
+ else {
12232
+ return this._elasticKeywords;
12233
+ }
12234
+ },
12235
+ enumerable: false,
12236
+ configurable: true
12237
+ });
12184
12238
  CaseTitle._i18n = 'search.category.case.title';
12185
12239
  return CaseTitle;
12186
12240
  }(NoConfigurationCategory));
12187
12241
 
12188
12242
  var CaseVisualId = /** @class */ (function (_super) {
12189
12243
  __extends(CaseVisualId, _super);
12190
- function CaseVisualId(operators, logger) {
12191
- return _super.call(this, [exports.CaseSearch.VISUAL_ID], [operators.getOperator(Substring), operators.getOperator(Equals), operators.getOperator(NotEquals)], CaseVisualId._i18n + ".name", exports.SearchInputType.TEXT, logger, operators) || this;
12244
+ function CaseVisualId(operators, logger, _optionalDependencies) {
12245
+ var _this = _super.call(this, [exports.CaseSearch.VISUAL_ID], [operators.getOperator(Substring), operators.getOperator(Equals), operators.getOperator(NotEquals)], CaseVisualId._i18n + ".name", exports.SearchInputType.TEXT, logger, operators) || this;
12246
+ _this._optionalDependencies = _optionalDependencies;
12247
+ return _this;
12192
12248
  }
12193
12249
  Object.defineProperty(CaseVisualId.prototype, "inputPlaceholder", {
12194
12250
  get: function () {
@@ -12198,11 +12254,24 @@
12198
12254
  configurable: true
12199
12255
  });
12200
12256
  CaseVisualId.prototype.duplicate = function () {
12201
- return new CaseVisualId(this._operatorService, this._log);
12257
+ return new CaseVisualId(this._operatorService, this._log, this._optionalDependencies);
12202
12258
  };
12203
12259
  CaseVisualId.prototype.serializeClass = function () {
12204
12260
  return exports.Categories.CASE_VISUAL_ID;
12205
12261
  };
12262
+ Object.defineProperty(CaseVisualId.prototype, "elasticKeywords", {
12263
+ get: function () {
12264
+ if (!!this._optionalDependencies) {
12265
+ var resolver = this._optionalDependencies.searchIndexResolver;
12266
+ return [resolver.getCoreIndex(exports.CaseSearch.VISUAL_ID, this.isSelectedOperator(Substring))];
12267
+ }
12268
+ else {
12269
+ return this._elasticKeywords;
12270
+ }
12271
+ },
12272
+ enumerable: false,
12273
+ configurable: true
12274
+ });
12206
12275
  CaseVisualId._i18n = 'search.category.case.visualId';
12207
12276
  return CaseVisualId;
12208
12277
  }(NoConfigurationCategory));
@@ -12889,6 +12958,7 @@
12889
12958
  function ProcessService(_petriNetResource, _log) {
12890
12959
  this._petriNetResource = _petriNetResource;
12891
12960
  this._log = _log;
12961
+ this.LATEST = 'latest';
12892
12962
  this._nets = {};
12893
12963
  this._netsSubject = new rxjs.Subject();
12894
12964
  this._netUpdate = new rxjs.Subject();
@@ -13119,7 +13189,7 @@
13119
13189
  ProcessService.prototype.loadNetReference = function (id) {
13120
13190
  var _this = this;
13121
13191
  var returnReference = new rxjs.ReplaySubject(1);
13122
- this._petriNetResource.getOne(id, '^').subscribe(function (reference) {
13192
+ this._petriNetResource.getOne(id, this.LATEST).subscribe(function (reference) {
13123
13193
  returnReference.next(!reference.stringId ? null : reference);
13124
13194
  returnReference.complete();
13125
13195
  return;
@@ -13626,7 +13696,8 @@
13626
13696
  * @param searchedSubstring value that should be searched on all full text fields
13627
13697
  */
13628
13698
  SearchService.prototype.setFullTextFilter = function (searchedSubstring) {
13629
- this._fullTextFilter = new SimpleFilter('', this._baseFilter.type, { fullText: searchedSubstring });
13699
+ var whiteSpacedSubstring = searchedSubstring.replace(' ', '\\ ');
13700
+ this._fullTextFilter = new SimpleFilter('', this._baseFilter.type, { fullText: whiteSpacedSubstring });
13630
13701
  this.updateActiveFilter();
13631
13702
  };
13632
13703
  /**
@@ -14368,7 +14439,7 @@
14368
14439
  this._spinnerOverlay.spin$.next(true);
14369
14440
  this.subSession = this._session.verifying.subscribe(function (active) {
14370
14441
  _this.userService.user$.subscribe(function (user) {
14371
- if (!!user.id && user.id.length > 0) {
14442
+ if (!!user && !!user.id && user.id.length > 0) {
14372
14443
  _this.redirect(!active);
14373
14444
  }
14374
14445
  });
@@ -29887,7 +29958,7 @@
29887
29958
  this._ownerGroups$ = new rxjs.BehaviorSubject([]);
29888
29959
  this._memberGroups$ = new rxjs.BehaviorSubject([]);
29889
29960
  this._userSub = this._userService.user$.pipe(operators.switchMap(function (user) {
29890
- if (user.id === '') {
29961
+ if (!user || user.id === '') {
29891
29962
  return rxjs.of([]);
29892
29963
  }
29893
29964
  var params = new http.HttpParams();