@sumaris-net/ngx-components 1.22.11-rc1 → 1.22.11-rc2

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.
@@ -33853,6 +33853,418 @@
33853
33853
  },] }
33854
33854
  ];
33855
33855
 
33856
+ var JobProgressionTestService = /** @class */ (function () {
33857
+ function JobProgressionTestService() {
33858
+ }
33859
+ JobProgressionTestService.prototype.listenChanges = function (id, options) {
33860
+ return rxjs.interval(100).pipe(operators.take(111), operators.map(function (value) {
33861
+ if (value <= 10) {
33862
+ return {
33863
+ id: id,
33864
+ name: "Job #" + id,
33865
+ current: 0,
33866
+ total: 0,
33867
+ message: "Progression pending"
33868
+ };
33869
+ }
33870
+ value = value - 10;
33871
+ return {
33872
+ id: id,
33873
+ name: "Job #" + id,
33874
+ current: value,
33875
+ total: 100,
33876
+ message: "Progression " + value + "/100"
33877
+ };
33878
+ }));
33879
+ };
33880
+ return JobProgressionTestService;
33881
+ }());
33882
+ JobProgressionTestService.decorators = [
33883
+ { type: i0.Injectable }
33884
+ ];
33885
+
33886
+ var JobProgressionTestingPage = /** @class */ (function () {
33887
+ function JobProgressionTestingPage() {
33888
+ this.nJob = 0;
33889
+ this.options = {
33890
+ autoHide: true
33891
+ };
33892
+ this.job = new exports.JobProgression();
33893
+ this.job.id = 0;
33894
+ this.job.name = 'test';
33895
+ this.job.current = 0;
33896
+ this.job.total = 100;
33897
+ }
33898
+ JobProgressionTestingPage.prototype.incrementJob = function (value) {
33899
+ this.job.current = Math.max(0, this.job.current + value);
33900
+ this.job.message = "Fake progression (very long message very long message very long message very long message) " + this.job.current + "/100";
33901
+ if (this.job.current > this.job.total) {
33902
+ this.jobProgression.removeJob(0);
33903
+ this.job.current = 0;
33904
+ }
33905
+ else if (!this.jobProgression.getProgression(0)) {
33906
+ this.jobProgression.jobProgressions.push(this.job);
33907
+ }
33908
+ this.jobProgression.updateValue();
33909
+ };
33910
+ JobProgressionTestingPage.prototype.addJob = function () {
33911
+ // Add fake job
33912
+ this.nJob++;
33913
+ this.jobProgression.addJob(this.nJob);
33914
+ };
33915
+ return JobProgressionTestingPage;
33916
+ }());
33917
+ JobProgressionTestingPage.decorators = [
33918
+ { type: i0.Component, args: [{
33919
+ selector: 'job-progression-testing',
33920
+ template: "<ion-toolbar color=\"primary\">\n <ion-title>Job progression</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-job-progression #jobProgression [debug]=\"true\" [options]=\"options\" ></app-job-progression>\n\n <p>\n <ion-button (click)=\"incrementJob(10)\">\n +10\n </ion-button>\n <ion-button (click)=\"incrementJob(-10)\">\n -10\n </ion-button>\n </p>\n <p>\n <ion-button (click)=\"addJob()\">Add Job</ion-button>\n </p>\n</ion-content>\n",
33921
+ providers: [
33922
+ { provide: JobProgressionServiceToken, useClass: JobProgressionTestService }
33923
+ ]
33924
+ },] }
33925
+ ];
33926
+ JobProgressionTestingPage.ctorParameters = function () { return []; };
33927
+ JobProgressionTestingPage.propDecorators = {
33928
+ jobProgression: [{ type: i0.ViewChild, args: ['jobProgression',] }]
33929
+ };
33930
+
33931
+ var JobTestingModule = /** @class */ (function () {
33932
+ function JobTestingModule() {
33933
+ }
33934
+ return JobTestingModule;
33935
+ }());
33936
+ JobTestingModule.decorators = [
33937
+ { type: i0.NgModule, args: [{
33938
+ imports: [
33939
+ i1$4.CommonModule,
33940
+ i1$2.TranslateModule.forChild(),
33941
+ SharedModule,
33942
+ JobModule
33943
+ ],
33944
+ declarations: [
33945
+ JobProgressionTestingPage
33946
+ ],
33947
+ exports: [
33948
+ JobProgressionTestingPage
33949
+ ]
33950
+ },] }
33951
+ ];
33952
+
33953
+ var UserEventTestService = /** @class */ (function (_super) {
33954
+ __extends(UserEventTestService, _super);
33955
+ function UserEventTestService(graphql, accountService, network, translate, environment) {
33956
+ var _this = _super.call(this, graphql, accountService, network, translate, {
33957
+ queries: {
33958
+ loadAll: null,
33959
+ loadAllWithContent: null
33960
+ },
33961
+ production: environment === null || environment === void 0 ? void 0 : environment.production
33962
+ }) || this;
33963
+ _this.graphql = graphql;
33964
+ _this.accountService = accountService;
33965
+ _this.network = network;
33966
+ _this.translate = translate;
33967
+ _this.environment = environment;
33968
+ _this.userEvents = [];
33969
+ return _this;
33970
+ }
33971
+ UserEventTestService.prototype.fromObject = function (source) {
33972
+ return exports.UserEvent.fromObject(source);
33973
+ };
33974
+ UserEventTestService.prototype.add = function (entity) {
33975
+ entity = this.processUserEvent(entity);
33976
+ entity.id = this.userEvents.length + 1;
33977
+ this.userEvents = __spread([
33978
+ entity
33979
+ ], this.userEvents);
33980
+ this._countSubject.next((this._countSubject.value || 0) + 1);
33981
+ };
33982
+ UserEventTestService.prototype.asFilter = function (filter) {
33983
+ return filter;
33984
+ };
33985
+ UserEventTestService.prototype.count = function (filter, options) {
33986
+ return Promise.resolve(this.userEvents.length);
33987
+ };
33988
+ UserEventTestService.prototype.delete = function (entity) {
33989
+ return Promise.resolve(undefined);
33990
+ };
33991
+ UserEventTestService.prototype.deleteAll = function (data, opts) {
33992
+ return Promise.resolve(undefined);
33993
+ };
33994
+ UserEventTestService.prototype.listenChanges = function (filter, options) {
33995
+ return rxjs.of();
33996
+ };
33997
+ UserEventTestService.prototype.save = function (entity, options) {
33998
+ var _a;
33999
+ var toSave = (_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id == (entity === null || entity === void 0 ? void 0 : entity.id); });
34000
+ Object.assign(toSave, entity);
34001
+ return entity;
34002
+ };
34003
+ UserEventTestService.prototype.saveAll = function (data, opts) {
34004
+ return __awaiter(this, void 0, void 0, function () {
34005
+ var _b, _c, entity, e_1_1;
34006
+ var e_1, _d;
34007
+ return __generator(this, function (_e) {
34008
+ switch (_e.label) {
34009
+ case 0:
34010
+ _e.trys.push([0, 5, 6, 7]);
34011
+ _b = __values((data || [])), _c = _b.next();
34012
+ _e.label = 1;
34013
+ case 1:
34014
+ if (!!_c.done) return [3 /*break*/, 4];
34015
+ entity = _c.value;
34016
+ return [4 /*yield*/, this.save(entity)];
34017
+ case 2:
34018
+ _e.sent();
34019
+ _e.label = 3;
34020
+ case 3:
34021
+ _c = _b.next();
34022
+ return [3 /*break*/, 1];
34023
+ case 4: return [3 /*break*/, 7];
34024
+ case 5:
34025
+ e_1_1 = _e.sent();
34026
+ e_1 = { error: e_1_1 };
34027
+ return [3 /*break*/, 7];
34028
+ case 6:
34029
+ try {
34030
+ if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
34031
+ }
34032
+ finally { if (e_1) throw e_1.error; }
34033
+ return [7 /*endfinally*/];
34034
+ case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
34035
+ }
34036
+ });
34037
+ });
34038
+ };
34039
+ UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
34040
+ return rxjs.of({ data: this.userEvents });
34041
+ };
34042
+ return UserEventTestService;
34043
+ }(AbstractUserEventService));
34044
+ UserEventTestService.decorators = [
34045
+ { type: i0.Injectable }
34046
+ ];
34047
+ UserEventTestService.ctorParameters = function () { return [
34048
+ { type: GraphqlService },
34049
+ { type: AccountService },
34050
+ { type: NetworkService },
34051
+ { type: i1$2.TranslateService },
34052
+ { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
34053
+ ]; };
34054
+
34055
+ var moment$a = momentImported__namespace;
34056
+ var UserEventTestingPage = /** @class */ (function () {
34057
+ function UserEventTestingPage(userEventService, router, alertController, translateService) {
34058
+ var _this = this;
34059
+ this.userEventService = userEventService;
34060
+ this.router = router;
34061
+ this.alertController = alertController;
34062
+ this.translateService = translateService;
34063
+ userEventService.registerListener({
34064
+ accept: function (userEvent) { return true; },
34065
+ onReceived: function (userEvent) {
34066
+ _this.customize(userEvent);
34067
+ return userEvent;
34068
+ }
34069
+ });
34070
+ userEventService.registerListener({
34071
+ accept: function (userEvent) { return userEvent.level == "DEBUG"; },
34072
+ onRead: function (userEvent) { _this.showMessage("debug message read "); }
34073
+ });
34074
+ }
34075
+ UserEventTestingPage.prototype.customize = function (userEvent) {
34076
+ // Choose avatarIcon
34077
+ switch (userEvent.level) {
34078
+ case 'ERROR':
34079
+ userEvent.avatarIcon = { icon: 'close-outline', color: 'danger' };
34080
+ break;
34081
+ case 'WARNING':
34082
+ userEvent.avatarIcon = { icon: 'warning-outline', color: 'warning' };
34083
+ break;
34084
+ case 'INFO':
34085
+ userEvent.avatarIcon = { icon: 'information-circle-outline' };
34086
+ break;
34087
+ case 'DEBUG':
34088
+ userEvent.avatarIcon = { icon: 'cog', color: "medium" };
34089
+ break;
34090
+ }
34091
+ // Choose icon
34092
+ switch (userEvent.type) {
34093
+ case 'message':
34094
+ userEvent.icon = { matIcon: 'inbox', color: 'accent' };
34095
+ break;
34096
+ case 'upload':
34097
+ userEvent.icon = { matIcon: 'file_upload' };
34098
+ break;
34099
+ case 'download':
34100
+ userEvent.icon = { matIcon: 'file_download' };
34101
+ break;
34102
+ }
34103
+ };
34104
+ UserEventTestingPage.prototype.addNotification = function () {
34105
+ this.userEventService.add(exports.UserEvent.fromObject({
34106
+ issuer: 'system',
34107
+ recipient: 'me',
34108
+ type: 'message',
34109
+ level: 'INFO',
34110
+ message: 'message test message test message test message test message test message test message test message test',
34111
+ creationDate: moment$a(),
34112
+ }));
34113
+ };
34114
+ UserEventTestingPage.prototype.addError = function () {
34115
+ this.userEventService.add(exports.UserEvent.fromObject({
34116
+ issuer: 'system',
34117
+ recipient: 'me',
34118
+ type: 'upload',
34119
+ level: 'ERROR',
34120
+ message: 'message error',
34121
+ creationDate: moment$a(),
34122
+ }));
34123
+ };
34124
+ UserEventTestingPage.prototype.addWarning = function () {
34125
+ this.userEventService.add(exports.UserEvent.fromObject({
34126
+ issuer: 'system',
34127
+ recipient: 'me',
34128
+ type: 'download',
34129
+ level: 'WARNING',
34130
+ message: 'message warning',
34131
+ creationDate: moment$a(),
34132
+ }));
34133
+ };
34134
+ UserEventTestingPage.prototype.addDebug = function () {
34135
+ this.userEventService.add(exports.UserEvent.fromObject({
34136
+ issuer: 'system',
34137
+ recipient: 'me',
34138
+ type: 'debug',
34139
+ level: 'DEBUG',
34140
+ message: 'message DEBUG',
34141
+ creationDate: moment$a(),
34142
+ }));
34143
+ };
34144
+ UserEventTestingPage.prototype.addNotificationWithLink = function () {
34145
+ var _this = this;
34146
+ this.userEventService.add(exports.UserEvent.fromObject({
34147
+ issuer: 'system',
34148
+ recipient: 'me',
34149
+ type: 'message',
34150
+ level: 'INFO',
34151
+ message: 'message with link',
34152
+ creationDate: moment$a(),
34153
+ actions: [{
34154
+ name: 'click here',
34155
+ iconRef: {
34156
+ icon: 'arrow-forward-outline'
34157
+ },
34158
+ executeAction: function (event) { _this.router.navigateByUrl('/'); }
34159
+ }]
34160
+ }));
34161
+ };
34162
+ UserEventTestingPage.prototype.addNotificationWithAction = function () {
34163
+ var _this = this;
34164
+ this.userEventService.add(exports.UserEvent.fromObject({
34165
+ issuer: 'system',
34166
+ recipient: 'me',
34167
+ type: 'message',
34168
+ level: 'INFO',
34169
+ message: 'message with action',
34170
+ creationDate: moment$a(),
34171
+ actions: [
34172
+ {
34173
+ name: 'click here',
34174
+ iconRef: {
34175
+ icon: 'arrow-forward-outline',
34176
+ color: 'warning'
34177
+ },
34178
+ executeAction: function (event) { _this.showMessage('action 1'); }
34179
+ },
34180
+ {
34181
+ name: 'click here 2',
34182
+ iconRef: {
34183
+ matIcon: 'settings_applications',
34184
+ color: 'secondary'
34185
+ },
34186
+ executeAction: function (event) { _this.showMessage('action 2'); }
34187
+ }
34188
+ ]
34189
+ }));
34190
+ };
34191
+ UserEventTestingPage.prototype.showMessage = function (text) {
34192
+ return Alerts.showError(text, this.alertController, this.translateService);
34193
+ };
34194
+ return UserEventTestingPage;
34195
+ }());
34196
+ UserEventTestingPage.decorators = [
34197
+ { type: i0.Component, args: [{
34198
+ selector: 'job-progression-testing',
34199
+ template: "<ion-toolbar color=\"primary\">\n <ion-title>User events</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-user-event-notification-icon #notification [debug]=\"true\"></app-user-event-notification-icon>\n\n <p>\n <ion-button (click)=\"addNotification()\">Add notification</ion-button>\n <ion-button (click)=\"addError()\">Add error</ion-button>\n <ion-button (click)=\"addWarning()\">Add warning</ion-button>\n <ion-button (click)=\"addDebug()\">Add debug</ion-button>\n </p>\n <p>\n <ion-button (click)=\"addNotificationWithLink()\">Add notification with link</ion-button>\n <ion-button (click)=\"addNotificationWithAction()\">Add notification with action</ion-button>\n </p>\n</ion-content>\n"
34200
+ },] }
34201
+ ];
34202
+ UserEventTestingPage.ctorParameters = function () { return [
34203
+ { type: UserEventTestService, decorators: [{ type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
34204
+ { type: i3.Router },
34205
+ { type: i1$5.AlertController },
34206
+ { type: i1$2.TranslateService }
34207
+ ]; };
34208
+ UserEventTestingPage.propDecorators = {
34209
+ notification: [{ type: i0.ViewChild, args: ['notification',] }]
34210
+ };
34211
+
34212
+ var UserEventTestingModule = /** @class */ (function () {
34213
+ function UserEventTestingModule() {
34214
+ }
34215
+ return UserEventTestingModule;
34216
+ }());
34217
+ UserEventTestingModule.decorators = [
34218
+ { type: i0.NgModule, args: [{
34219
+ imports: [
34220
+ i1$4.CommonModule,
34221
+ i1$2.TranslateModule.forChild(),
34222
+ SharedModule,
34223
+ UserEventModule
34224
+ ],
34225
+ declarations: [
34226
+ UserEventTestingPage
34227
+ ],
34228
+ exports: [
34229
+ UserEventTestingPage
34230
+ ]
34231
+ },] }
34232
+ ];
34233
+
34234
+ var SOCIAL_TESTING_PAGES = [
34235
+ { label: 'Social components', divider: true },
34236
+ { label: 'User event', page: '/testing/social/user-event' },
34237
+ { label: 'Job progression', page: '/testing/social/job-progression' }
34238
+ ];
34239
+ var routes$6 = [
34240
+ {
34241
+ path: 'job-progression',
34242
+ pathMatch: 'full',
34243
+ component: JobProgressionTestingPage
34244
+ },
34245
+ {
34246
+ path: 'user-event',
34247
+ pathMatch: 'full',
34248
+ component: UserEventTestingPage
34249
+ },
34250
+ ];
34251
+ var SocialTestingModule = /** @class */ (function () {
34252
+ function SocialTestingModule() {
34253
+ }
34254
+ return SocialTestingModule;
34255
+ }());
34256
+ SocialTestingModule.decorators = [
34257
+ { type: i0.NgModule, args: [{
34258
+ imports: [
34259
+ i1$4.CommonModule,
34260
+ i1$2.TranslateModule.forChild(),
34261
+ i3.RouterModule.forChild(routes$6),
34262
+ JobTestingModule,
34263
+ UserEventTestingModule
34264
+ ],
34265
+ },] }
34266
+ ];
34267
+
33856
34268
  // Environment
33857
34269
 
33858
34270
  /**
@@ -34008,6 +34420,9 @@
34008
34420
  exports.JobProgressionComponent = JobProgressionComponent;
34009
34421
  exports.JobProgressionService = JobProgressionService;
34010
34422
  exports.JobProgressionServiceToken = JobProgressionServiceToken;
34423
+ exports.JobProgressionTestService = JobProgressionTestService;
34424
+ exports.JobProgressionTestingPage = JobProgressionTestingPage;
34425
+ exports.JobTestingModule = JobTestingModule;
34011
34426
  exports.JobUtils = JobUtils;
34012
34427
  exports.KEYBOARD_HIDE_DELAY_MS = KEYBOARD_HIDE_DELAY_MS;
34013
34428
  exports.LAT_LONG_DEFAULT_MAX_DECIMALS = LAT_LONG_DEFAULT_MAX_DECIMALS;
@@ -34087,6 +34502,7 @@
34087
34502
  exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
34088
34503
  exports.SHARED_MATERIAL_TESTING_PAGES = SHARED_MATERIAL_TESTING_PAGES;
34089
34504
  exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
34505
+ exports.SOCIAL_TESTING_PAGES = SOCIAL_TESTING_PAGES;
34090
34506
  exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
34091
34507
  exports.SelectPeerModal = SelectPeerModal;
34092
34508
  exports.ServerErrorCodes = ServerErrorCodes;
@@ -34115,6 +34531,7 @@
34115
34531
  exports.SocialErrorCodes = SocialErrorCodes;
34116
34532
  exports.SocialModule = SocialModule;
34117
34533
  exports.SocialModuleOptionsToken = SocialModuleOptionsToken;
34534
+ exports.SocialTestingModule = SocialTestingModule;
34118
34535
  exports.StartableService = StartableService;
34119
34536
  exports.StatusById = StatusById;
34120
34537
  exports.StatusIds = StatusIds;
@@ -34145,6 +34562,9 @@
34145
34562
  exports.UriUtils = UriUtils;
34146
34563
  exports.UserEventFragments = UserEventFragments;
34147
34564
  exports.UserEventModule = UserEventModule;
34565
+ exports.UserEventTestService = UserEventTestService;
34566
+ exports.UserEventTestingModule = UserEventTestingModule;
34567
+ exports.UserEventTestingPage = UserEventTestingPage;
34148
34568
  exports.UserEventTypes = UserEventTypes;
34149
34569
  exports.UsersPage = UsersPage;
34150
34570
  exports.accountToString = accountToString;