@senior-gestao-relacionamento/angular-components 1.7.0 → 1.7.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/senior-gestao-relacionamento-angular-components.umd.js +109 -25
- package/bundles/senior-gestao-relacionamento-angular-components.umd.js.map +1 -1
- package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js +2 -2
- package/bundles/senior-gestao-relacionamento-angular-components.umd.min.js.map +1 -1
- package/esm2015/services/current-collaborator/current-collaborator.module.js +2 -2
- package/esm2015/services/current-collaborator/current-collaborator.service.js +1 -14
- package/esm2015/services/current-collaborator/models/collaborator-e-070-fil-crmx.js +9 -3
- package/esm2015/services/current-collaborator/models/collaborator-squad.js +3 -2
- package/esm2015/services/current-collaborator/models/collaborator.js +8 -3
- package/esm2015/services/current-collaborator/models/e-070-emp.js +3 -2
- package/esm2015/services/current-collaborator/models/e-070-fil-crmx.js +3 -2
- package/esm2015/services/current-collaborator/models/e-070-fil.js +3 -2
- package/esm2015/services/current-collaborator/models/squad.js +3 -2
- package/esm2015/services/current-collaborator/models/user.js +3 -2
- package/esm2015/services/storage/storage.service.js +3 -2
- package/esm2015/utils/index.js +2 -1
- package/esm2015/utils/utils.js +80 -0
- package/esm5/services/current-collaborator/current-collaborator.module.js +2 -2
- package/esm5/services/current-collaborator/current-collaborator.service.js +1 -14
- package/esm5/services/current-collaborator/models/collaborator-e-070-fil-crmx.js +9 -3
- package/esm5/services/current-collaborator/models/collaborator-squad.js +3 -2
- package/esm5/services/current-collaborator/models/collaborator.js +8 -3
- package/esm5/services/current-collaborator/models/e-070-emp.js +3 -2
- package/esm5/services/current-collaborator/models/e-070-fil-crmx.js +3 -2
- package/esm5/services/current-collaborator/models/e-070-fil.js +3 -2
- package/esm5/services/current-collaborator/models/squad.js +3 -2
- package/esm5/services/current-collaborator/models/user.js +3 -2
- package/esm5/services/storage/storage.service.js +3 -2
- package/esm5/utils/index.js +2 -1
- package/esm5/utils/utils.js +82 -0
- package/fesm2015/senior-gestao-relacionamento-angular-components.js +101 -26
- package/fesm2015/senior-gestao-relacionamento-angular-components.js.map +1 -1
- package/fesm5/senior-gestao-relacionamento-angular-components.js +102 -26
- package/fesm5/senior-gestao-relacionamento-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/senior-gestao-relacionamento-angular-components.metadata.json +1 -1
- package/services/current-collaborator/current-collaborator.service.d.ts +0 -1
- package/services/current-collaborator/models/collaborator-e-070-fil-crmx.d.ts +1 -0
- package/services/current-collaborator/models/collaborator-squad.d.ts +1 -0
- package/services/current-collaborator/models/e-070-emp.d.ts +1 -0
- package/services/current-collaborator/models/e-070-fil-crmx.d.ts +1 -1
- package/services/current-collaborator/models/e-070-fil.d.ts +1 -0
- package/services/current-collaborator/models/squad.d.ts +1 -0
- package/services/current-collaborator/models/user.d.ts +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/utils.d.ts +12 -0
|
@@ -423,6 +423,86 @@ var fallback = {
|
|
|
423
423
|
"crmx.angular_components.refresh_websocket_alert_summary_default": "Atualização de dados"
|
|
424
424
|
};
|
|
425
425
|
|
|
426
|
+
var numberTypes = [FieldType.Integer, FieldType.Double];
|
|
427
|
+
var numberPattern = /^\d+\b$/;
|
|
428
|
+
var mergeUnique = function (array, otherArray) { return array.concat(otherArray.filter(function (item) { return !array.includes(item); })); };
|
|
429
|
+
var getTypeInformation = function (type, value) {
|
|
430
|
+
switch (type) {
|
|
431
|
+
case FieldType.Time:
|
|
432
|
+
case FieldType.Date:
|
|
433
|
+
case FieldType.LocalDateTime:
|
|
434
|
+
case FieldType.DateTime:
|
|
435
|
+
return { isValidValue: false, typeExists: true };
|
|
436
|
+
case FieldType.Integer:
|
|
437
|
+
case FieldType.Double:
|
|
438
|
+
return {
|
|
439
|
+
isValidValue: value.match(numberPattern),
|
|
440
|
+
typeExists: numberTypes.includes(type),
|
|
441
|
+
};
|
|
442
|
+
default:
|
|
443
|
+
return {
|
|
444
|
+
isValidValue: value.match(numberPattern),
|
|
445
|
+
typeExists: numberTypes.includes(type),
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
var isValidFilter = function (type, value) {
|
|
450
|
+
var _a = getTypeInformation(type, value), isValidValue = _a.isValidValue, typeExists = _a.typeExists;
|
|
451
|
+
return !(typeExists && !isValidValue);
|
|
452
|
+
};
|
|
453
|
+
var getProp = function (obj, path) {
|
|
454
|
+
return path.split('.').reduce(function (result, prop) { return (result[prop] === undefined ? '' : result[prop]); }, obj);
|
|
455
|
+
};
|
|
456
|
+
var getLabelValueRequest = function (contents, displayFields) {
|
|
457
|
+
return contents.map(function (item) { return (__assign(__assign({}, item), { label: displayFields.map(function (field) { return getProp(item, field); }).join(' - ') })); });
|
|
458
|
+
};
|
|
459
|
+
var getSuggestionValue = function (displayFields, ownerEntity, value, separator) {
|
|
460
|
+
return displayFields.map(function (field) { return getProp(value, ownerEntity + "." + field); }).reduce(function (acc, val) { return "" + acc + separator + val; }) + '';
|
|
461
|
+
};
|
|
462
|
+
var getEnumQuery = function (name, value, multiple) {
|
|
463
|
+
if (multiple === void 0) { multiple = false; }
|
|
464
|
+
if (multiple) {
|
|
465
|
+
return "(" + value.map(function (selected) { return name + " eq '" + selected + "'"; }).join(' or ') + ")";
|
|
466
|
+
}
|
|
467
|
+
return name + " eq '" + value + "'";
|
|
468
|
+
};
|
|
469
|
+
var resolveRefs = function (payload) {
|
|
470
|
+
var getDataFromRef = function (ref, rootObj) {
|
|
471
|
+
var regex = /\["(.*?)"\]/g;
|
|
472
|
+
var result = [];
|
|
473
|
+
var match;
|
|
474
|
+
while ((match = regex.exec(ref)) !== null) {
|
|
475
|
+
result.push(match[1]);
|
|
476
|
+
}
|
|
477
|
+
return result.reduce(function (acc, part) { return acc && acc[part]; }, rootObj);
|
|
478
|
+
};
|
|
479
|
+
var resolve = function (obj, rootObj) {
|
|
480
|
+
if (Array.isArray(obj)) {
|
|
481
|
+
obj.forEach(function (item) { return resolve(item, rootObj); });
|
|
482
|
+
}
|
|
483
|
+
else if (obj !== null && typeof obj === 'object') {
|
|
484
|
+
// Remove self-reference to root object
|
|
485
|
+
Object.keys(obj).forEach(function (key) {
|
|
486
|
+
if (obj[key] === rootObj) {
|
|
487
|
+
delete obj[key];
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
Object.keys(obj).forEach(function (key) {
|
|
491
|
+
if (key === '$ref' && obj[key]) {
|
|
492
|
+
var refPath = obj[key];
|
|
493
|
+
Object.assign(obj, getDataFromRef(refPath, rootObj));
|
|
494
|
+
delete obj[key];
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
resolve(obj[key], rootObj);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
resolve(payload, payload);
|
|
503
|
+
return payload;
|
|
504
|
+
};
|
|
505
|
+
|
|
426
506
|
var User = /** @class */ (function () {
|
|
427
507
|
function User() {
|
|
428
508
|
this.blocked = false;
|
|
@@ -431,7 +511,7 @@ var User = /** @class */ (function () {
|
|
|
431
511
|
var model = __assign({}, userDto);
|
|
432
512
|
var lookupSeparator = ' - ';
|
|
433
513
|
var displayFields = ['username', 'fullName'];
|
|
434
|
-
model.label = displayFields
|
|
514
|
+
model.label = getSuggestionValue(displayFields, 'user', { user: model }, lookupSeparator);
|
|
435
515
|
return model;
|
|
436
516
|
};
|
|
437
517
|
User.toDto = function (user, originEntity) {
|
|
@@ -449,7 +529,7 @@ var E070Emp = /** @class */ (function () {
|
|
|
449
529
|
var model = __assign({}, e070EmpDto);
|
|
450
530
|
var lookupSeparator = ' - ';
|
|
451
531
|
var displayFields = ['codEmp', 'nomEmp'];
|
|
452
|
-
model.label = displayFields
|
|
532
|
+
model.label = getSuggestionValue(displayFields, 'e070Emp', { e070Emp: model }, lookupSeparator);
|
|
453
533
|
return model;
|
|
454
534
|
};
|
|
455
535
|
E070Emp.toDto = function (e070Emp, originEntity) {
|
|
@@ -467,7 +547,7 @@ var E070Fil = /** @class */ (function () {
|
|
|
467
547
|
var model = __assign({}, e070FilDto);
|
|
468
548
|
var lookupSeparator = ' - ';
|
|
469
549
|
var displayFields = ['e070emp.codEmp', 'e070emp.nomEmp', 'codFil', 'nomFil'];
|
|
470
|
-
model.label = displayFields
|
|
550
|
+
model.label = getSuggestionValue(displayFields, 'e070Fil', { e070Fil: model }, lookupSeparator);
|
|
471
551
|
if (originEntity !== 'E070Emp' && model.e070emp) {
|
|
472
552
|
model.e070emp = E070Emp.fromDto(model.e070emp, 'E070Fil');
|
|
473
553
|
}
|
|
@@ -492,7 +572,7 @@ var E070FilCrmx = /** @class */ (function () {
|
|
|
492
572
|
var model = __assign({}, e070FilCrmxDto);
|
|
493
573
|
var lookupSeparator = ' - ';
|
|
494
574
|
var displayFields = ['e070fil.e070emp.codEmp', 'e070fil.e070emp.nomEmp', 'e070fil.codFil', 'e070fil.nomFil'];
|
|
495
|
-
model.label = displayFields
|
|
575
|
+
model.label = getSuggestionValue(displayFields, 'e070FilCrmx', { e070FilCrmx: model }, lookupSeparator);
|
|
496
576
|
if (originEntity !== 'E070Fil' && model.e070fil) {
|
|
497
577
|
model.e070fil = E070Fil.fromDto(model.e070fil, 'E070FilCrmx');
|
|
498
578
|
}
|
|
@@ -516,8 +596,13 @@ var CollaboratorE070FilCrmx = /** @class */ (function () {
|
|
|
516
596
|
CollaboratorE070FilCrmx.fromDto = function (collaboratorE070FilCrmxDto, originEntity) {
|
|
517
597
|
var model = __assign({}, collaboratorE070FilCrmxDto);
|
|
518
598
|
var lookupSeparator = ' - ';
|
|
519
|
-
var displayFields = [
|
|
520
|
-
|
|
599
|
+
var displayFields = [
|
|
600
|
+
'e070filCrmx.e070fil.e070emp.codEmp',
|
|
601
|
+
'e070filCrmx.e070fil.e070emp.nomEmp',
|
|
602
|
+
'e070filCrmx.e070fil.codFil',
|
|
603
|
+
'e070filCrmx.e070fil.nomFil'
|
|
604
|
+
];
|
|
605
|
+
model.label = getSuggestionValue(displayFields, 'collaboratorE070FilCrmx', { collaboratorE070FilCrmx: model }, lookupSeparator);
|
|
521
606
|
if (originEntity !== 'Collaborator' && model.collaborator) {
|
|
522
607
|
model.collaborator = Collaborator.fromDto(model.collaborator, 'CollaboratorE070FilCrmx');
|
|
523
608
|
}
|
|
@@ -547,7 +632,7 @@ var Squad = /** @class */ (function () {
|
|
|
547
632
|
var model = __assign({}, squadDto);
|
|
548
633
|
var lookupSeparator = ' - ';
|
|
549
634
|
var displayFields = ['name'];
|
|
550
|
-
model.label = displayFields
|
|
635
|
+
model.label = getSuggestionValue(displayFields, 'squad', { squad: model }, lookupSeparator);
|
|
551
636
|
return model;
|
|
552
637
|
};
|
|
553
638
|
Squad.toDto = function (squad, originEntity) {
|
|
@@ -565,7 +650,7 @@ var CollaboratorSquad = /** @class */ (function () {
|
|
|
565
650
|
var model = __assign({}, collaboratorSquadDto);
|
|
566
651
|
var lookupSeparator = ' - ';
|
|
567
652
|
var displayFields = ['squad.name'];
|
|
568
|
-
model.label = displayFields
|
|
653
|
+
model.label = getSuggestionValue(displayFields, 'collaboratorSquad', { collaboratorSquad: model }, lookupSeparator);
|
|
569
654
|
if (originEntity !== 'Collaborator' && model.collaborator) {
|
|
570
655
|
model.collaborator = Collaborator.fromDto(model.collaborator, 'CollaboratorSquad');
|
|
571
656
|
}
|
|
@@ -597,7 +682,7 @@ var Collaborator = /** @class */ (function () {
|
|
|
597
682
|
var model = __assign({}, collaboratorDto);
|
|
598
683
|
var lookupSeparator = ' - ';
|
|
599
684
|
var displayFields = ['code', 'name'];
|
|
600
|
-
model.label = displayFields
|
|
685
|
+
model.label = getSuggestionValue(displayFields, 'collaborator', { collaborator: model }, lookupSeparator);
|
|
601
686
|
if (originEntity !== 'User' && model.user) {
|
|
602
687
|
model.user = User.fromDto(model.user, 'Collaborator');
|
|
603
688
|
}
|
|
@@ -605,7 +690,11 @@ var Collaborator = /** @class */ (function () {
|
|
|
605
690
|
model.leader = Collaborator.fromDto(model.leader, 'Collaborator');
|
|
606
691
|
}
|
|
607
692
|
if (originEntity !== 'CollaboratorE070FilCrmx' && model.branches) {
|
|
608
|
-
model.branches = Object.values(model.branches).map(function (item) {
|
|
693
|
+
model.branches = Object.values(model.branches).map(function (item) {
|
|
694
|
+
item = CollaboratorE070FilCrmx.fromDto(item, 'Collaborator');
|
|
695
|
+
item.collaborator = model;
|
|
696
|
+
return item;
|
|
697
|
+
});
|
|
609
698
|
}
|
|
610
699
|
if (originEntity !== 'CollaboratorSquad' && model.squads) {
|
|
611
700
|
model.squads = Object.values(model.squads).map(function (item) { return CollaboratorSquad.fromDto(item, 'Collaborator'); });
|
|
@@ -648,7 +737,7 @@ var StorageService = /** @class */ (function () {
|
|
|
648
737
|
};
|
|
649
738
|
StorageService.prototype.store = function (key, value) {
|
|
650
739
|
var userId = this.getUserId();
|
|
651
|
-
localStorage.setItem(userId + "_" + key, JSON.stringify(value));
|
|
740
|
+
localStorage.setItem(userId + "_" + key, JSON.stringify(resolveRefs(value)));
|
|
652
741
|
};
|
|
653
742
|
StorageService.prototype.get = function (key) {
|
|
654
743
|
var userId = this.getUserId();
|
|
@@ -740,7 +829,6 @@ var CurrentCollaboratorService = /** @class */ (function () {
|
|
|
740
829
|
throw err;
|
|
741
830
|
}))
|
|
742
831
|
.subscribe(function (collaboratorDto) {
|
|
743
|
-
collaboratorDto = _this.removeCircularReferences(collaboratorDto);
|
|
744
832
|
_this.storageService.store(_this.COLLABORATOR_KEY, collaboratorDto);
|
|
745
833
|
observer.next(Collaborator.fromDto(collaboratorDto));
|
|
746
834
|
});
|
|
@@ -751,18 +839,6 @@ var CurrentCollaboratorService = /** @class */ (function () {
|
|
|
751
839
|
CurrentCollaboratorService.prototype.redirect = function (page) {
|
|
752
840
|
location.href = this.storageService.getBaseUrl() + "/gestao-relacionamento/crmx_collaborator/foundation/#/" + page;
|
|
753
841
|
};
|
|
754
|
-
CurrentCollaboratorService.prototype.removeCircularReferences = function (obj) {
|
|
755
|
-
var seen = new WeakSet();
|
|
756
|
-
return JSON.parse(JSON.stringify(obj, function (key, value) {
|
|
757
|
-
if (typeof value === 'object') {
|
|
758
|
-
if (seen.has(value)) {
|
|
759
|
-
return undefined;
|
|
760
|
-
}
|
|
761
|
-
seen.add(value);
|
|
762
|
-
}
|
|
763
|
-
return value;
|
|
764
|
-
}));
|
|
765
|
-
};
|
|
766
842
|
CurrentCollaboratorService.ctorParameters = function () { return [
|
|
767
843
|
{ type: HttpClient },
|
|
768
844
|
{ type: StorageService }
|
|
@@ -798,7 +874,7 @@ var CurrentCollaboratorModule = /** @class */ (function () {
|
|
|
798
874
|
StorageModule,
|
|
799
875
|
],
|
|
800
876
|
providers: [
|
|
801
|
-
CurrentCollaboratorService
|
|
877
|
+
CurrentCollaboratorService,
|
|
802
878
|
],
|
|
803
879
|
})
|
|
804
880
|
], CurrentCollaboratorModule);
|
|
@@ -1365,5 +1441,5 @@ var ValueChangesService = /** @class */ (function () {
|
|
|
1365
1441
|
* Generated bundle index. Do not edit.
|
|
1366
1442
|
*/
|
|
1367
1443
|
|
|
1368
|
-
export { Collaborator, CollaboratorE070FilCrmx, CollaboratorSquad, CurrentCollaboratorModule, CurrentCollaboratorService, CurrentTenantModule, CurrentTenantService, DateValidatorsService, E070Emp, E070Fil, E070FilCrmx, Event, FormGroupValidatorsService, FormatEnum, Modulo, MonthEnum, OrdinalWeekDayEnum, RecurrenceEnum, RefreshWebsocketAlertComponent, RefreshWebsocketAlertModule, RepeatWhenEnum, ReportsComponent, ReportsModule, ReportsService, ScheduleFormRulesModule, ScheduleFormRulesService, Squad, StandardFiltersModule, StandardFiltersService, StorageService, StringConverterService, Topic, User, ValueChangesService, ViewModeEnum, WebsocketModule, WebsocketService, WeekDayEnum, fallback, StorageModule as ɵa };
|
|
1444
|
+
export { Collaborator, CollaboratorE070FilCrmx, CollaboratorSquad, CurrentCollaboratorModule, CurrentCollaboratorService, CurrentTenantModule, CurrentTenantService, DateValidatorsService, E070Emp, E070Fil, E070FilCrmx, Event, FormGroupValidatorsService, FormatEnum, Modulo, MonthEnum, OrdinalWeekDayEnum, RecurrenceEnum, RefreshWebsocketAlertComponent, RefreshWebsocketAlertModule, RepeatWhenEnum, ReportsComponent, ReportsModule, ReportsService, ScheduleFormRulesModule, ScheduleFormRulesService, Squad, StandardFiltersModule, StandardFiltersService, StorageService, StringConverterService, Topic, User, ValueChangesService, ViewModeEnum, WebsocketModule, WebsocketService, WeekDayEnum, fallback, getEnumQuery, getLabelValueRequest, getProp, getSuggestionValue, getTypeInformation, isValidFilter, mergeUnique, resolveRefs, StorageModule as ɵa };
|
|
1369
1445
|
//# sourceMappingURL=senior-gestao-relacionamento-angular-components.js.map
|