@sumaris-net/ngx-components 1.22.11-rc15 → 1.22.11-rc18

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 (48) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +1360 -652
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/doc/build.md +2 -2
  6. package/esm2015/public_api.js +10 -3
  7. package/esm2015/src/app/core/services/account.service.js +2 -2
  8. package/esm2015/src/app/core/table/entities-table-datasource.class.js +3 -2
  9. package/esm2015/src/app/shared/file/file.service.js +20 -19
  10. package/esm2015/src/app/shared/file/images.utils.js +166 -0
  11. package/esm2015/src/app/shared/image/gallery/image-gallery.component.js +160 -0
  12. package/esm2015/src/app/shared/image/gallery/image-gallery.module.js +29 -0
  13. package/esm2015/src/app/shared/image/gallery/testing/gallery.service.testing.js +92 -0
  14. package/esm2015/src/app/shared/image/gallery/testing/gallery.testing.js +31 -0
  15. package/esm2015/src/app/shared/image/gallery/testing/gallery.testing.module.js +38 -0
  16. package/esm2015/src/app/shared/image/image.module.js +32 -0
  17. package/esm2015/src/app/shared/image/image.service.js +208 -0
  18. package/esm2015/src/app/shared/shared.module.js +3 -1
  19. package/esm2015/src/app/shared/shared.testing.module.js +9 -3
  20. package/esm2015/src/app/social/job/job.service.js +2 -2
  21. package/esm2015/src/app/social/user-event/testing/user-event.testing.model.js +5 -1
  22. package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +7 -3
  23. package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
  24. package/esm2015/src/app/social/user-event/user-event.service.js +22 -16
  25. package/esm2015/src/environments/environment.js +5 -1
  26. package/esm2015/sumaris-net.ngx-components.js +15 -14
  27. package/fesm2015/sumaris-net.ngx-components.js +1859 -1287
  28. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  29. package/package.json +13 -6
  30. package/public_api.d.ts +9 -2
  31. package/src/app/shared/file/file.service.d.ts +5 -5
  32. package/src/app/shared/file/images.utils.d.ts +19 -0
  33. package/src/app/shared/image/gallery/image-gallery.component.d.ts +42 -0
  34. package/src/app/shared/image/gallery/image-gallery.module.d.ts +2 -0
  35. package/src/app/shared/image/gallery/testing/gallery.service.testing.d.ts +30 -0
  36. package/src/app/shared/image/gallery/testing/gallery.testing.d.ts +13 -0
  37. package/src/app/shared/image/gallery/testing/gallery.testing.module.d.ts +2 -0
  38. package/src/app/shared/image/image.module.d.ts +4 -0
  39. package/src/app/shared/image/image.service.d.ts +46 -0
  40. package/src/app/social/user-event/testing/user-event.testing.model.d.ts +1 -0
  41. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +2 -1
  42. package/src/app/social/user-event/user-event.model.d.ts +3 -2
  43. package/src/app/social/user-event/user-event.service.d.ts +13 -11
  44. package/src/assets/i18n/fr.json +7 -0
  45. package/sumaris-net.ngx-components.d.ts +14 -13
  46. package/sumaris-net.ngx-components.metadata.json +1 -1
  47. package/esm2015/src/app/shared/file/base64-image-reader.js +0 -141
  48. package/src/app/shared/file/base64-image-reader.d.ts +0 -18
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/table'), require('@angular/cdk/a11y'), require('@angular/cdk/overlay'), require('@angular/cdk/scrolling'), require('@angular/material/core'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/checkbox'), require('@angular/material/expansion'), require('@angular/material/toolbar'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/menu'), require('@angular/material/select'), require('@angular/material/card'), require('@angular/material/tabs'), require('@angular/material/stepper'), require('@angular/material/list'), require('@angular/material/button-toggle'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/radio'), require('@angular/material/badge'), require('@angular/material/slide-toggle'), require('@angular/material/dialog'), require('@angular/material/autocomplete'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/animations'), require('@ngx-translate/core'), require('@ionic/angular'), require('moment'), require('@angular/material-moment-adapter'), require('@ionic-native/keyboard/ngx'), require('angular2-text-mask'), require('ngx-material-timepicker'), require('@angular/material/datepicker'), require('@angular/material/divider'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/router'), require('@angular/platform-browser'), require('@angular/common/http'), require('ngx-color-picker'), require('@ionic-native/native-audio/ngx'), require('@ionic-native/vibration/ngx'), require('@ionic-native/audio-management/ngx'), require('@ionic-native/native-audio/ngx/index'), require('@ionic-native/vibration/ngx/index'), require('@ionic-native/audio-management/ngx/index'), require('uuid/v4'), require('@angular/cdk/drag-drop'), require('ngx-markdown'), require('tweetnacl'), require('@ionic/storage'), require('zone.js/dist/zone-error'), require('@ionic-native/splash-screen/ngx'), require('@ionic-native/network/ngx'), require('ionic-cache'), require('ionic-cache/dist/cache.service'), require('@ionic-native/network/ngx/index'), require('@ionic-native/splash-screen/ngx/index'), require('@ionic-native/status-bar/ngx'), require('@angular/cdk/platform'), require('@ionic-native/in-app-browser/ngx'), require('@apollo/client/core'), require('apollo-angular'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@apollo/client/link/retry'), require('apollo-link-queue'), require('apollo-link-serialize'), require('apollo-link-logger'), require('apollo-angular/http'), require('apollo3-cache-persist'), require('@ionic-native/downloader/ngx'), require('@ionic-native/status-bar/ngx/index'), require('@ionic-native/keyboard/ngx/index'), require('@ionic-native/in-app-browser/ngx/index'), require('@ionic-native/downloader/ngx/index'), require('@angular/cdk/text-field'), require('@e-is/ngx-material-table'), require('@angular/cdk/collections'), require('ngx-jdenticon'), require('tweetnacl-util'), require('scrypt-async'), require('hammerjs'), require('moment-timezone')) :
3
- typeof define === 'function' && define.amd ? define('@sumaris-net/ngx-components', ['exports', '@angular/core', '@angular/common', '@angular/cdk/table', '@angular/cdk/a11y', '@angular/cdk/overlay', '@angular/cdk/scrolling', '@angular/material/core', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/form-field', '@angular/material/input', '@angular/material/checkbox', '@angular/material/expansion', '@angular/material/toolbar', '@angular/material/icon', '@angular/material/button', '@angular/material/menu', '@angular/material/select', '@angular/material/card', '@angular/material/tabs', '@angular/material/stepper', '@angular/material/list', '@angular/material/button-toggle', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/radio', '@angular/material/badge', '@angular/material/slide-toggle', '@angular/material/dialog', '@angular/material/autocomplete', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/animations', '@ngx-translate/core', '@ionic/angular', 'moment', '@angular/material-moment-adapter', '@ionic-native/keyboard/ngx', 'angular2-text-mask', 'ngx-material-timepicker', '@angular/material/datepicker', '@angular/material/divider', '@angular/material/tooltip', '@angular/material/chips', '@angular/router', '@angular/platform-browser', '@angular/common/http', 'ngx-color-picker', '@ionic-native/native-audio/ngx', '@ionic-native/vibration/ngx', '@ionic-native/audio-management/ngx', '@ionic-native/native-audio/ngx/index', '@ionic-native/vibration/ngx/index', '@ionic-native/audio-management/ngx/index', 'uuid/v4', '@angular/cdk/drag-drop', 'ngx-markdown', 'tweetnacl', '@ionic/storage', 'zone.js/dist/zone-error', '@ionic-native/splash-screen/ngx', '@ionic-native/network/ngx', 'ionic-cache', 'ionic-cache/dist/cache.service', '@ionic-native/network/ngx/index', '@ionic-native/splash-screen/ngx/index', '@ionic-native/status-bar/ngx', '@angular/cdk/platform', '@ionic-native/in-app-browser/ngx', '@apollo/client/core', 'apollo-angular', '@apollo/client/link/ws', '@apollo/client/utilities', '@apollo/client/link/retry', 'apollo-link-queue', 'apollo-link-serialize', 'apollo-link-logger', 'apollo-angular/http', 'apollo3-cache-persist', '@ionic-native/downloader/ngx', '@ionic-native/status-bar/ngx/index', '@ionic-native/keyboard/ngx/index', '@ionic-native/in-app-browser/ngx/index', '@ionic-native/downloader/ngx/index', '@angular/cdk/text-field', '@e-is/ngx-material-table', '@angular/cdk/collections', 'ngx-jdenticon', 'tweetnacl-util', 'scrypt-async', 'hammerjs', 'moment-timezone'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sumaris-net'] = global['sumaris-net'] || {}, global['sumaris-net']['ngx-components'] = {}), global.ng.core, global.ng.common, global.ng.cdk.table, global.ng.cdk.a11y, global.ng.cdk.overlay, global.ng.cdk.scrolling, global.ng.material.core, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.formField, global.ng.material.input, global.ng.material.checkbox, global.ng.material.expansion, global.ng.material.toolbar, global.ng.material.icon, global.ng.material.button, global.ng.material.menu, global.ng.material.select, global.ng.material.card, global.ng.material.tabs, global.ng.material.stepper, global.ng.material.list, global.ng.material.buttonToggle, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.radio, global.ng.material.badge, global.ng.material.slideToggle, global.ng.material.dialog, global.ng.material.autocomplete, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.animations, global['ngx-translate'].core, global.ionic.angular, global.moment, global.ng.materialMomentAdapter, global['ionic-native'].keyboard.ngx, global['angular2-text-mask'], global['ngx-material-timepicker'], global.ng.material.datepicker, global.ng.material.divider, global.ng.material.tooltip, global.ng.material.chips, global.ng.router, global.ng.platformBrowser, global.ng.common.http, global['ngx-color-picker'], global['ionic-native']['native-audio'].ngx, global['ionic-native'].vibration.ngx, global['ionic-native']['audio-management'].ngx, global['ionic-native']['native-audio'].ngx.index, global['ionic-native'].vibration.ngx.index, global['ionic-native']['audio-management'].ngx.index, global.uuid.v4, global.ng.cdk.dragDrop, global['ngx-markdown'], global.tweetnacl, global.ionic.storage, null, global['ionic-native']['splash-screen'].ngx, global['ionic-native'].network.ngx, global['ionic-cache'], global['ionic-cache/dist/cache'].service, global['ionic-native'].network.ngx.index, global['ionic-native']['splash-screen'].ngx.index, global['ionic-native']['status-bar'].ngx, global.ng.cdk.platform, global['ionic-native']['in-app-browser'].ngx, global.apollo.client.core, global['apollo-angular'], global.apollo.client.link.ws, global.apollo.client.utilities, global.apollo.client.link.retry, global['apollo-link-queue'], global['apollo-link-serialize'], global['apollo-link-logger'], global['apollo-angular'].http, global['apollo3-cache-persist'], global['ionic-native'].downloader.ngx, global['ionic-native']['status-bar'].ngx.index, global['ionic-native'].keyboard.ngx.index, global['ionic-native']['in-app-browser'].ngx.index, global['ionic-native'].downloader.ngx.index, global.ng.cdk.textField, global['e-is']['ngx-material-table'], global.ng.cdk.collections, global['ngx-jdenticon'], null, null, null, global['moment-timezone']));
5
- }(this, (function (exports, i0, i1$4, table$1, a11y, overlay, scrolling, i1$3, table, sort$1, paginator, formField, input, checkbox, expansion, toolbar, icon, button, menu, select, card, tabs, stepper, list, buttonToggle, progressSpinner, progressBar, radio, badge, slideToggle, i2, autocomplete, i1, rxjs, operators, animations, i1$2, i1$5, momentImported, i1$1, ngx, angular2TextMask, ngxMaterialTimepicker, datepicker, divider, tooltip, chips, i3, i1$6, i2$1, ngxColorPicker, ngx$2, ngx$3, ngx$1, i2$2, i3$1, i4, uuidv4Imported, dragDrop, ngxMarkdown, tweetnacl, i3$2, zoneError, ngx$5, ngx$4, ionicCache, i6, i9, i10, ngx$7, i2$4, ngx$8, core, i2$3, ws, utilities, retry, QueueLink, SerializingLink, loggerLink, i3$3, apollo3CachePersist, ngx$6, i14, i15, i17, i18, textField, ngxMaterialTable, collections, ngxJdenticon, tweetnaclUtil, scryptAsync, hammerjs, momentTZImported) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/table'), require('@angular/cdk/a11y'), require('@angular/cdk/overlay'), require('@angular/cdk/scrolling'), require('@angular/material/core'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/checkbox'), require('@angular/material/expansion'), require('@angular/material/toolbar'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/menu'), require('@angular/material/select'), require('@angular/material/card'), require('@angular/material/tabs'), require('@angular/material/stepper'), require('@angular/material/list'), require('@angular/material/button-toggle'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/radio'), require('@angular/material/badge'), require('@angular/material/slide-toggle'), require('@angular/material/dialog'), require('@angular/material/autocomplete'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/animations'), require('@ngx-translate/core'), require('@ionic/angular'), require('moment'), require('@angular/material-moment-adapter'), require('@ionic-native/keyboard/ngx'), require('angular2-text-mask'), require('ngx-material-timepicker'), require('@angular/material/datepicker'), require('@angular/material/divider'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/router'), require('@angular/platform-browser'), require('@angular/common/http'), require('ngx-color-picker'), require('@ionic-native/native-audio/ngx'), require('@ionic-native/vibration/ngx'), require('@ionic-native/audio-management/ngx'), require('@ionic-native/native-audio/ngx/index'), require('@ionic-native/vibration/ngx/index'), require('@ionic-native/audio-management/ngx/index'), require('uuid/v4'), require('@angular/cdk/drag-drop'), require('ngx-markdown'), require('tweetnacl'), require('@ionic/storage'), require('zone.js/dist/zone-error'), require('@ionic-native/splash-screen/ngx'), require('@ionic-native/network/ngx'), require('ionic-cache'), require('ionic-cache/dist/cache.service'), require('@ionic-native/network/ngx/index'), require('@ionic-native/splash-screen/ngx/index'), require('@ionic-native/status-bar/ngx'), require('@angular/cdk/platform'), require('@ionic-native/in-app-browser/ngx'), require('@apollo/client/core'), require('apollo-angular'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@apollo/client/link/retry'), require('apollo-link-queue'), require('apollo-link-serialize'), require('apollo-link-logger'), require('apollo-angular/http'), require('apollo3-cache-persist'), require('@ionic-native/downloader/ngx'), require('@ionic-native/status-bar/ngx/index'), require('@ionic-native/keyboard/ngx/index'), require('@ionic-native/in-app-browser/ngx/index'), require('@ionic-native/downloader/ngx/index'), require('@ionic-native/image-picker/ngx'), require('@ionic-native/media-capture/ngx'), require('@ionic-native/photo-viewer/ngx'), require('@ionic-native/image-picker/ngx/index'), require('@ionic-native/photo-viewer/ngx/index'), require('@ionic-native/media-capture/ngx/index'), require('@angular/cdk/collections'), require('@e-is/ngx-material-table'), require('ngx-jdenticon'), require('@angular/cdk/text-field'), require('tweetnacl-util'), require('scrypt-async'), require('hammerjs'), require('moment-timezone')) :
3
+ typeof define === 'function' && define.amd ? define('@sumaris-net/ngx-components', ['exports', '@angular/core', '@angular/common', '@angular/cdk/table', '@angular/cdk/a11y', '@angular/cdk/overlay', '@angular/cdk/scrolling', '@angular/material/core', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/form-field', '@angular/material/input', '@angular/material/checkbox', '@angular/material/expansion', '@angular/material/toolbar', '@angular/material/icon', '@angular/material/button', '@angular/material/menu', '@angular/material/select', '@angular/material/card', '@angular/material/tabs', '@angular/material/stepper', '@angular/material/list', '@angular/material/button-toggle', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/radio', '@angular/material/badge', '@angular/material/slide-toggle', '@angular/material/dialog', '@angular/material/autocomplete', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/animations', '@ngx-translate/core', '@ionic/angular', 'moment', '@angular/material-moment-adapter', '@ionic-native/keyboard/ngx', 'angular2-text-mask', 'ngx-material-timepicker', '@angular/material/datepicker', '@angular/material/divider', '@angular/material/tooltip', '@angular/material/chips', '@angular/router', '@angular/platform-browser', '@angular/common/http', 'ngx-color-picker', '@ionic-native/native-audio/ngx', '@ionic-native/vibration/ngx', '@ionic-native/audio-management/ngx', '@ionic-native/native-audio/ngx/index', '@ionic-native/vibration/ngx/index', '@ionic-native/audio-management/ngx/index', 'uuid/v4', '@angular/cdk/drag-drop', 'ngx-markdown', 'tweetnacl', '@ionic/storage', 'zone.js/dist/zone-error', '@ionic-native/splash-screen/ngx', '@ionic-native/network/ngx', 'ionic-cache', 'ionic-cache/dist/cache.service', '@ionic-native/network/ngx/index', '@ionic-native/splash-screen/ngx/index', '@ionic-native/status-bar/ngx', '@angular/cdk/platform', '@ionic-native/in-app-browser/ngx', '@apollo/client/core', 'apollo-angular', '@apollo/client/link/ws', '@apollo/client/utilities', '@apollo/client/link/retry', 'apollo-link-queue', 'apollo-link-serialize', 'apollo-link-logger', 'apollo-angular/http', 'apollo3-cache-persist', '@ionic-native/downloader/ngx', '@ionic-native/status-bar/ngx/index', '@ionic-native/keyboard/ngx/index', '@ionic-native/in-app-browser/ngx/index', '@ionic-native/downloader/ngx/index', '@ionic-native/image-picker/ngx', '@ionic-native/media-capture/ngx', '@ionic-native/photo-viewer/ngx', '@ionic-native/image-picker/ngx/index', '@ionic-native/photo-viewer/ngx/index', '@ionic-native/media-capture/ngx/index', '@angular/cdk/collections', '@e-is/ngx-material-table', 'ngx-jdenticon', '@angular/cdk/text-field', 'tweetnacl-util', 'scrypt-async', 'hammerjs', 'moment-timezone'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sumaris-net'] = global['sumaris-net'] || {}, global['sumaris-net']['ngx-components'] = {}), global.ng.core, global.ng.common, global.ng.cdk.table, global.ng.cdk.a11y, global.ng.cdk.overlay, global.ng.cdk.scrolling, global.ng.material.core, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.formField, global.ng.material.input, global.ng.material.checkbox, global.ng.material.expansion, global.ng.material.toolbar, global.ng.material.icon, global.ng.material.button, global.ng.material.menu, global.ng.material.select, global.ng.material.card, global.ng.material.tabs, global.ng.material.stepper, global.ng.material.list, global.ng.material.buttonToggle, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.radio, global.ng.material.badge, global.ng.material.slideToggle, global.ng.material.dialog, global.ng.material.autocomplete, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.animations, global['ngx-translate'].core, global.ionic.angular, global.moment, global.ng.materialMomentAdapter, global['ionic-native'].keyboard.ngx, global['angular2-text-mask'], global['ngx-material-timepicker'], global.ng.material.datepicker, global.ng.material.divider, global.ng.material.tooltip, global.ng.material.chips, global.ng.router, global.ng.platformBrowser, global.ng.common.http, global['ngx-color-picker'], global['ionic-native']['native-audio'].ngx, global['ionic-native'].vibration.ngx, global['ionic-native']['audio-management'].ngx, global['ionic-native']['native-audio'].ngx.index, global['ionic-native'].vibration.ngx.index, global['ionic-native']['audio-management'].ngx.index, global.uuid.v4, global.ng.cdk.dragDrop, global['ngx-markdown'], global.tweetnacl, global.ionic.storage, null, global['ionic-native']['splash-screen'].ngx, global['ionic-native'].network.ngx, global['ionic-cache'], global['ionic-cache/dist/cache'].service, global['ionic-native'].network.ngx.index, global['ionic-native']['splash-screen'].ngx.index, global['ionic-native']['status-bar'].ngx, global.ng.cdk.platform, global['ionic-native']['in-app-browser'].ngx, global.apollo.client.core, global['apollo-angular'], global.apollo.client.link.ws, global.apollo.client.utilities, global.apollo.client.link.retry, global['apollo-link-queue'], global['apollo-link-serialize'], global['apollo-link-logger'], global['apollo-angular'].http, global['apollo3-cache-persist'], global['ionic-native'].downloader.ngx, global['ionic-native']['status-bar'].ngx.index, global['ionic-native'].keyboard.ngx.index, global['ionic-native']['in-app-browser'].ngx.index, global['ionic-native'].downloader.ngx.index, global.ngx$9, global.ngx$b, global.ngx$a, global.i5, global.i6$1, global.i7, global.ng.cdk.collections, global['e-is']['ngx-material-table'], global['ngx-jdenticon'], global.ng.cdk.textField, null, null, null, global['moment-timezone']));
5
+ }(this, (function (exports, i0, i1$4, table$1, a11y, overlay, scrolling, i1$3, table, sort$1, paginator, formField, input, checkbox, expansion, toolbar, icon, button, menu, select, card, tabs, stepper, list, buttonToggle, progressSpinner, progressBar, radio, badge, slideToggle, i2, autocomplete, i1, rxjs, operators, animations, i1$2, i1$5, momentImported, i1$1, ngx, angular2TextMask, ngxMaterialTimepicker, datepicker, divider, tooltip, chips, i3, i1$6, i2$1, ngxColorPicker, ngx$2, ngx$3, ngx$1, i2$2, i3$1, i4, uuidv4Imported, dragDrop, ngxMarkdown, tweetnacl, i3$2, zoneError, ngx$5, ngx$4, ionicCache, i6, i9, i10, ngx$7, i2$4, ngx$8, core, i2$3, ws, utilities, retry, QueueLink, SerializingLink, loggerLink, i3$3, apollo3CachePersist, ngx$6, i14, i15, i17, i18, ngx$9, ngx$b, ngx$a, i5, i6$1, i7, collections, ngxMaterialTable, ngxJdenticon, textField, tweetnaclUtil, scryptAsync, hammerjs, momentTZImported) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -10553,44 +10553,97 @@
10553
10553
  },] }
10554
10554
  ];
10555
10555
 
10556
+ var UploadFile = /** @class */ (function (_super) {
10557
+ __extends(UploadFile, _super);
10558
+ function UploadFile() {
10559
+ return _super !== null && _super.apply(this, arguments) || this;
10560
+ }
10561
+ return UploadFile;
10562
+ }(File));
10563
+ var FileResponse = /** @class */ (function () {
10564
+ function FileResponse(init) {
10565
+ this.type = i2$1.HttpEventType.Response;
10566
+ this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
10567
+ this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
10568
+ this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
10569
+ }
10570
+ return FileResponse;
10571
+ }());
10572
+ function isProgressEvent(event) {
10573
+ return event && (event.type === i2$1.HttpEventType.UploadProgress
10574
+ || event.type === i2$1.HttpEventType.DownloadProgress);
10575
+ }
10576
+ function isResponseEvent(event) {
10577
+ return event && event.type === i2$1.HttpEventType.Response;
10578
+ }
10579
+
10556
10580
  var IMAGE_DEFAULTS = {
10557
10581
  MAX_HEIGHT: 480,
10558
10582
  MAX_WIDTH: 640,
10559
10583
  THUMB_MAX_HEIGHT: 200,
10560
10584
  THUMB_MAX_WIDTH: 200
10561
10585
  };
10562
- var Base64ImageReader = /** @class */ (function () {
10563
- function Base64ImageReader() {
10586
+ // @dynamic
10587
+ var ImagesUtils = /** @class */ (function () {
10588
+ function ImagesUtils() {
10564
10589
  }
10565
- Base64ImageReader.prototype.readFromBlob = function (file) {
10566
- return __awaiter(this, void 0, void 0, function () {
10567
- var dataUrl;
10568
- return __generator(this, function (_a) {
10569
- switch (_a.label) {
10570
- case 0:
10571
- if (!file)
10572
- throw new Error('Illegal argument: missing file');
10573
- return [4 /*yield*/, new Promise(function (resolve, reject) {
10574
- var reader = new FileReader();
10575
- reader.addEventListener('load', function (event) { return resolve(reader.result); }, false);
10576
- reader.readAsDataURL(file);
10577
- })];
10578
- case 1:
10579
- dataUrl = _a.sent();
10580
- return [2 /*return*/, dataUrl];
10581
- }
10582
- });
10583
- });
10590
+ ImagesUtils.readAsDataURL = function (file, opts) {
10591
+ var _this = this;
10592
+ var $progress = new rxjs.Subject();
10593
+ var reader = new FileReader();
10594
+ // Listen progress
10595
+ reader.onprogress = function (e) {
10596
+ var total = e.total || 1;
10597
+ var loaded = e.total || 0;
10598
+ if (loaded < total)
10599
+ $progress.next({ type: i2$1.HttpEventType.UploadProgress, loaded: loaded, total: total });
10600
+ };
10601
+ // Listen end
10602
+ reader.onloadend = function (e) {
10603
+ var body = reader.result;
10604
+ if (typeof body === 'string') {
10605
+ $progress.next(new FileResponse({ body: body }));
10606
+ $progress.complete();
10607
+ }
10608
+ else {
10609
+ console.error("[image-utils] Cannot read file '" + file.name + "' as text");
10610
+ $progress.error("Cannot read file as text");
10611
+ }
10612
+ };
10613
+ // Listen error
10614
+ reader.onerror = function (event) {
10615
+ console.error('[image-utils] Error while reading file:', event);
10616
+ $progress.error(event);
10617
+ };
10618
+ // Start reading the file
10619
+ reader.readAsDataURL(file);
10620
+ // Resize image, if need
10621
+ if (opts) {
10622
+ return $progress.pipe(operators.mergeMap(function (event) { return __awaiter(_this, void 0, void 0, function () {
10623
+ var body;
10624
+ return __generator(this, function (_a) {
10625
+ switch (_a.label) {
10626
+ case 0:
10627
+ if (!(event instanceof FileResponse)) return [3 /*break*/, 2];
10628
+ return [4 /*yield*/, ImagesUtils.resizeBase64(event.body, opts)];
10629
+ case 1:
10630
+ body = _a.sent();
10631
+ return [2 /*return*/, new FileResponse({ body: body })];
10632
+ case 2: return [2 /*return*/, event];
10633
+ }
10634
+ });
10635
+ }); }));
10636
+ }
10637
+ return $progress.asObservable();
10584
10638
  };
10585
- Base64ImageReader.prototype.readAndResizeFromUrl = function (path, opts) {
10639
+ ImagesUtils.readAndResizeFromUrl = function (fileUrl, opts) {
10586
10640
  return __awaiter(this, void 0, void 0, function () {
10587
10641
  var img, err_1;
10588
- var _this = this;
10589
10642
  return __generator(this, function (_a) {
10590
10643
  switch (_a.label) {
10591
10644
  case 0:
10592
- if (isNilOrBlank(path))
10593
- throw new Error('Illegal argument: missing path');
10645
+ if (isNilOrBlank(fileUrl))
10646
+ throw new Error('Illegal argument: missing fileUrl');
10594
10647
  img = document.createElement('img');
10595
10648
  // Need to avoid CORS error
10596
10649
  // (see https://stackoverflow.com/questions/22710627/tainted-canvases-may-not-be-exported)
@@ -10599,14 +10652,14 @@
10599
10652
  case 1:
10600
10653
  _a.trys.push([1, 3, 4, 5]);
10601
10654
  return [4 /*yield*/, new Promise(function (resolve, reject) {
10602
- img.addEventListener('load', _this.createImageOnLoadResizeFn(resolve, reject, opts), false);
10655
+ img.addEventListener('load', ImagesUtils.createImageOnLoadResizeFn(resolve, reject, opts), false);
10603
10656
  img.addEventListener('error', reject);
10604
- img.src = path;
10657
+ img.src = fileUrl;
10605
10658
  })];
10606
10659
  case 2: return [2 /*return*/, _a.sent()];
10607
10660
  case 3:
10608
10661
  err_1 = _a.sent();
10609
- throw new Error("Failed to load and resize image {" + path + "}");
10662
+ throw new Error("Failed to load and resize image {" + fileUrl + "}");
10610
10663
  case 4:
10611
10664
  img.remove();
10612
10665
  return [7 /*endfinally*/];
@@ -10615,15 +10668,12 @@
10615
10668
  });
10616
10669
  });
10617
10670
  };
10618
- Base64ImageReader.prototype.readAndResizeFromBlob = function (file, opts) {
10671
+ ImagesUtils.resizeBase64 = function (dataUrl, opts) {
10619
10672
  return __awaiter(this, void 0, void 0, function () {
10620
10673
  var img;
10621
- var _this = this;
10622
10674
  return __generator(this, function (_a) {
10623
10675
  switch (_a.label) {
10624
10676
  case 0:
10625
- if (!file)
10626
- throw new Error('Illegal argument: missing file');
10627
10677
  img = document.createElement('img');
10628
10678
  // Need to avoid CORS error
10629
10679
  // (see https://stackoverflow.com/questions/22710627/tainted-canvases-may-not-be-exported)
@@ -10632,13 +10682,9 @@
10632
10682
  case 1:
10633
10683
  _a.trys.push([1, , 3, 4]);
10634
10684
  return [4 /*yield*/, new Promise(function (resolve, reject) {
10635
- var reader = new FileReader();
10636
- reader.addEventListener('load', function (event) {
10637
- // Resize image
10638
- img.onload = _this.createImageOnLoadResizeFn(resolve, reject, opts);
10639
- img.src = reader.result;
10640
- }, false);
10641
- reader.readAsDataURL(file);
10685
+ img.addEventListener('load', ImagesUtils.createImageOnLoadResizeFn(resolve, reject, opts), false);
10686
+ img.addEventListener('error', reject);
10687
+ img.src = dataUrl;
10642
10688
  })];
10643
10689
  case 2: return [2 /*return*/, _a.sent()];
10644
10690
  case 3:
@@ -10649,8 +10695,7 @@
10649
10695
  });
10650
10696
  });
10651
10697
  };
10652
- /* -- protected methods -- */
10653
- Base64ImageReader.prototype.createImageOnLoadResizeFn = function (resolve, reject, opts) {
10698
+ ImagesUtils.createImageOnLoadResizeFn = function (resolve, reject, opts) {
10654
10699
  return function (event) {
10655
10700
  var maxWidth = (opts && opts.thumbnail ? IMAGE_DEFAULTS.THUMB_MAX_WIDTH : (opts && opts.maxWidth || IMAGE_DEFAULTS.MAX_WIDTH));
10656
10701
  var maxHeight = (opts && opts.thumbnail ? IMAGE_DEFAULTS.THUMB_MAX_HEIGHT : (opts && opts.maxHeight || IMAGE_DEFAULTS.MAX_HEIGHT));
@@ -10716,7 +10761,7 @@
10716
10761
  }
10717
10762
  };
10718
10763
  };
10719
- return Base64ImageReader;
10764
+ return ImagesUtils;
10720
10765
  }());
10721
10766
 
10722
10767
  var uuidv4 = uuidv4Imported__namespace;
@@ -10751,28 +10796,28 @@
10751
10796
  var jobsFactories = (sources || []).map(function (source) { return function () { return _this.getImage(source, Object.assign({}, opts)); }; });
10752
10797
  return chainPromises(jobsFactories);
10753
10798
  };
10754
- FileService.prototype.getImage = function (source, opts) {
10799
+ FileService.prototype.getImage = function (fileUrl, opts) {
10755
10800
  return __awaiter(this, void 0, void 0, function () {
10756
- var responseType, debug, now, lastSlashIndex, fileName, targetFilePath, blob, err_1, dataUrl;
10801
+ var outputType, debug, now, lastSlashIndex, fileName, targetFilePath, blob, err_1, dataUrl;
10757
10802
  return __generator(this, function (_a) {
10758
10803
  switch (_a.label) {
10759
10804
  case 0:
10760
- responseType = opts && opts.responseType || (this.canUseFileSystem ? 'file' : 'dataUrl');
10805
+ outputType = opts && opts.outputType || (this.canUseFileSystem ? 'fileUrl' : 'dataUrl');
10761
10806
  debug = this._debug /*&& (!opts || !opts.fileTransfer)*/;
10762
10807
  now = debug && Date.now();
10763
10808
  if (debug)
10764
- console.debug("[file] Fetching image {" + source + "} into " + responseType + "...");
10765
- lastSlashIndex = source.lastIndexOf('/');
10809
+ console.debug("[file] Fetching image {" + fileUrl + "} into " + outputType + "...");
10810
+ lastSlashIndex = fileUrl.lastIndexOf('/');
10766
10811
  if (lastSlashIndex === -1)
10767
- throw new Error('Invalid URL: ' + source);
10768
- fileName = lastSlashIndex < (source.length - 1) && source.substring(lastSlashIndex + 1) || uuidv4();
10769
- if (!(responseType === 'file' && this.canUseFileSystem)) return [3 /*break*/, 4];
10770
- console.warn("WARN: [file] Fetching image {" + source + "} in local file...");
10812
+ throw new Error('Invalid URL: ' + fileUrl);
10813
+ fileName = lastSlashIndex < (fileUrl.length - 1) && fileUrl.substring(lastSlashIndex + 1) || uuidv4();
10814
+ if (!(outputType === 'fileUrl' && this.canUseFileSystem)) return [3 /*break*/, 4];
10815
+ console.warn("WARN: [file] Downloading image {" + fileUrl + "} in local filesystem...");
10771
10816
  targetFilePath = this._imageDirectory + fileName;
10772
10817
  _a.label = 1;
10773
10818
  case 1:
10774
10819
  _a.trys.push([1, 3, , 4]);
10775
- return [4 /*yield*/, firstNotNilPromise(this.http.get(source, {
10820
+ return [4 /*yield*/, firstNotNilPromise(this.http.get(fileUrl, {
10776
10821
  observe: 'body',
10777
10822
  responseType: 'blob',
10778
10823
  reportProgress: false
@@ -10784,25 +10829,25 @@
10784
10829
  //const fileTransfer = (opts && opts.fileTransfer) || this.transfer.create();
10785
10830
  //await fileTransfer.download(source, targetFilePath);
10786
10831
  if (debug)
10787
- console.debug("[file] Fetching image {" + source + "} into " + responseType + " [OK] in " + (Date.now() - now) + "ms");
10832
+ console.debug("[file] Fetching image {" + fileUrl + "} into " + outputType + " [OK] in " + (Date.now() - now) + "ms");
10788
10833
  return [2 /*return*/, targetFilePath];
10789
10834
  case 3:
10790
10835
  err_1 = _a.sent();
10791
- console.error("[file] Error while download " + source + ": " + (err_1 && err_1.message || err_1));
10836
+ console.error("[file] Error while download " + fileUrl + ": " + (err_1 && err_1.message || err_1));
10792
10837
  // Continue (fallback to data Url)
10793
- responseType = 'dataUrl';
10838
+ outputType = 'dataUrl';
10794
10839
  return [3 /*break*/, 4];
10795
10840
  case 4:
10796
- if (!(responseType === 'dataUrl')) return [3 /*break*/, 6];
10797
- return [4 /*yield*/, new Base64ImageReader().readAndResizeFromUrl(source, opts)];
10841
+ if (!(outputType === 'dataUrl')) return [3 /*break*/, 6];
10842
+ return [4 /*yield*/, ImagesUtils.readAndResizeFromUrl(fileUrl, opts)];
10798
10843
  case 5:
10799
10844
  dataUrl = _a.sent();
10800
10845
  if (debug)
10801
- console.debug("[file] Fetching image {" + source + "} into " + responseType + " [OK] in " + (Date.now() - now) + "ms");
10846
+ console.debug("[file] Fetching image {" + fileUrl + "} into " + outputType + " [OK] in " + (Date.now() - now) + "ms");
10802
10847
  return [2 /*return*/, dataUrl];
10803
10848
  case 6:
10804
10849
  // Keep original URL
10805
- return [2 /*return*/, source];
10850
+ return [2 /*return*/, fileUrl];
10806
10851
  }
10807
10852
  });
10808
10853
  });
@@ -10834,7 +10879,8 @@
10834
10879
  providedIn: 'root',
10835
10880
  deps: [
10836
10881
  i1$5.Platform,
10837
- i2$1.HttpClient
10882
+ i2$1.HttpClient,
10883
+ ENVIRONMENT
10838
10884
  ]
10839
10885
  },] }
10840
10886
  ];
@@ -11421,6 +11467,10 @@
11421
11467
  {
11422
11468
  host: 'test.sumaris.net',
11423
11469
  port: 443
11470
+ },
11471
+ {
11472
+ host: 'server.e-is.pro',
11473
+ port: 443
11424
11474
  }
11425
11475
  ],
11426
11476
  defaultAppName: 'SUMARiS',
@@ -17184,7 +17234,7 @@
17184
17234
  if (!(hasAvatarUrl && this.network.online)) return [3 /*break*/, 2];
17185
17235
  return [4 /*yield*/, this.file.getImage(json.avatar, {
17186
17236
  thumbnail: true,
17187
- responseType: 'dataUrl'
17237
+ outputType: 'dataUrl'
17188
17238
  })
17189
17239
  .then(function (dataUrl) {
17190
17240
  if (dataUrl && _this._debug)
@@ -18159,30 +18209,6 @@
18159
18209
  ]; };
18160
18210
  var templateObject_1$1, templateObject_2$1, templateObject_3$1, templateObject_4$1, templateObject_5$1;
18161
18211
 
18162
- var UploadFile = /** @class */ (function (_super) {
18163
- __extends(UploadFile, _super);
18164
- function UploadFile() {
18165
- return _super !== null && _super.apply(this, arguments) || this;
18166
- }
18167
- return UploadFile;
18168
- }(File));
18169
- var FileResponse = /** @class */ (function () {
18170
- function FileResponse(init) {
18171
- this.type = i2$1.HttpEventType.Response;
18172
- this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
18173
- this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
18174
- this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
18175
- }
18176
- return FileResponse;
18177
- }());
18178
- function isProgressEvent(event) {
18179
- return event && (event.type === i2$1.HttpEventType.UploadProgress
18180
- || event.type === i2$1.HttpEventType.DownloadProgress);
18181
- }
18182
- function isResponseEvent(event) {
18183
- return event && event.type === i2$1.HttpEventType.Response;
18184
- }
18185
-
18186
18212
  var UploadFilePopover = /** @class */ (function () {
18187
18213
  function UploadFilePopover(popoverController, translate, cd) {
18188
18214
  this.popoverController = popoverController;
@@ -19379,6 +19405,253 @@
19379
19405
  { type: Array, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [APP_TESTING_PAGES,] }] }
19380
19406
  ]; };
19381
19407
 
19408
+ var ImageService = /** @class */ (function (_super) {
19409
+ __extends(ImageService, _super);
19410
+ function ImageService(platform, settings, translate, popoverController, imagePicker, photoViewer, mediaCapture, actionSheetController, environment) {
19411
+ var _this = _super.call(this, platform) || this;
19412
+ _this.platform = platform;
19413
+ _this.settings = settings;
19414
+ _this.translate = translate;
19415
+ _this.popoverController = popoverController;
19416
+ _this.imagePicker = imagePicker;
19417
+ _this.photoViewer = photoViewer;
19418
+ _this.mediaCapture = mediaCapture;
19419
+ _this.actionSheetController = actionSheetController;
19420
+ _this.environment = environment;
19421
+ _this.defaultMaxHeight = 1024;
19422
+ _this.defaultMaxWidth = 1024;
19423
+ _this._debug = !environment.production;
19424
+ if (_this._debug)
19425
+ console.debug('[image] Creating service');
19426
+ return _this;
19427
+ }
19428
+ ImageService.prototype.ngOnStart = function () {
19429
+ return __awaiter(this, void 0, void 0, function () {
19430
+ return __generator(this, function (_a) {
19431
+ console.info('[image] Starting...');
19432
+ return [2 /*return*/];
19433
+ });
19434
+ });
19435
+ };
19436
+ ImageService.prototype.show = function (url, title, opts) {
19437
+ if (!url)
19438
+ return;
19439
+ // If desktop: open upload popover
19440
+ if (!this.platform.isCordova()) {
19441
+ console.warn('TODO: implement photo viewer fallback, when no cordova');
19442
+ return;
19443
+ }
19444
+ this.photoViewer.show(url, title, Object.assign({ share: true, closeButton: true }, opts));
19445
+ };
19446
+ ImageService.prototype.add = function (event, opts) {
19447
+ return __awaiter(this, void 0, void 0, function () {
19448
+ var sheet, role, _a, image;
19449
+ return __generator(this, function (_b) {
19450
+ switch (_b.label) {
19451
+ case 0:
19452
+ // If desktop: open upload popover
19453
+ if (!this.platform.isCordova()) {
19454
+ return [2 /*return*/, this.addUploadedImages(event, opts)];
19455
+ }
19456
+ return [4 /*yield*/, this.actionSheetController.create({
19457
+ backdropDismiss: true,
19458
+ buttons: [
19459
+ {
19460
+ role: 'camera',
19461
+ text: this.translate.instant('IMAGE.BTN_CAMERA_SOURCE'),
19462
+ icon: 'camera'
19463
+ },
19464
+ {
19465
+ role: 'gallery',
19466
+ text: this.translate.instant('IMAGE.BTN_GALLERY_SOURCE'),
19467
+ icon: 'images'
19468
+ }
19469
+ ]
19470
+ })];
19471
+ case 1:
19472
+ sheet = _b.sent();
19473
+ return [4 /*yield*/, sheet.present()];
19474
+ case 2:
19475
+ _b.sent();
19476
+ return [4 /*yield*/, sheet.onDidDismiss()];
19477
+ case 3:
19478
+ role = (_b.sent()).role;
19479
+ if (!role)
19480
+ return [2 /*return*/]; // User cancelled
19481
+ _a = role;
19482
+ switch (_a) {
19483
+ case 'camera': return [3 /*break*/, 4];
19484
+ case 'gallery': return [3 /*break*/, 6];
19485
+ }
19486
+ return [3 /*break*/, 8];
19487
+ case 4: return [4 /*yield*/, this.addImageFromCamera()];
19488
+ case 5:
19489
+ image = _b.sent();
19490
+ return [2 /*return*/, image ? [image] : undefined];
19491
+ case 6: return [4 /*yield*/, this.addImagesFromGallery()];
19492
+ case 7: return [2 /*return*/, _b.sent()];
19493
+ case 8: return [2 /*return*/]; // User cancelled (e.g. backdrop click)
19494
+ }
19495
+ });
19496
+ });
19497
+ };
19498
+ ImageService.prototype.addUploadedImages = function (event, opts) {
19499
+ return __awaiter(this, void 0, void 0, function () {
19500
+ var data;
19501
+ var _this = this;
19502
+ return __generator(this, function (_a) {
19503
+ switch (_a.label) {
19504
+ case 0: return [4 /*yield*/, FilesUtils.showUploadPopover(this.popoverController, event, {
19505
+ uniqueFile: true,
19506
+ fileExtension: '.png, .jpg',
19507
+ instantUpload: true,
19508
+ uploadFn: function (file) { return ImagesUtils.readAsDataURL(file, Object.assign({ maxWidth: _this.defaultMaxWidth, maxHeight: _this.defaultMaxHeight }, opts)); }
19509
+ })];
19510
+ case 1:
19511
+ data = (_a.sent()).data;
19512
+ if (isEmptyArray(data))
19513
+ return [2 /*return*/]; // No files uploaded: skip
19514
+ return [2 /*return*/, (data || [])
19515
+ .map(function (file) { return file.response.body; }) // Get response body = data as base64
19516
+ .map(function (dataUrl) { return ({ dataUrl: dataUrl }); })];
19517
+ }
19518
+ });
19519
+ });
19520
+ };
19521
+ ImageService.prototype.addImageFromCamera = function (opts) {
19522
+ return __awaiter(this, void 0, void 0, function () {
19523
+ var outputType, file, _a, dataUrl, err_1;
19524
+ return __generator(this, function (_b) {
19525
+ switch (_b.label) {
19526
+ case 0:
19527
+ console.info('[image-service] Capturing new image from camera...');
19528
+ outputType = toNumber(opts === null || opts === void 0 ? void 0 : opts.outputType, ngx$9.OutputType.DATA_URL);
19529
+ return [4 /*yield*/, this.mediaCapture.captureImage({
19530
+ limit: 1
19531
+ }).then(function (data) {
19532
+ return data && data[0];
19533
+ }, function (err) {
19534
+ console.error("[image-service] Failed to capture new image - Error code: " + ((err === null || err === void 0 ? void 0 : err.code) || 'unknown'));
19535
+ return undefined;
19536
+ })];
19537
+ case 1:
19538
+ file = _b.sent();
19539
+ if (!(file === null || file === void 0 ? void 0 : file.fullPath))
19540
+ return [2 /*return*/]; // Skip
19541
+ console.info('[image-service] new picture path:' + file.fullPath);
19542
+ _b.label = 2;
19543
+ case 2:
19544
+ _b.trys.push([2, 8, , 9]);
19545
+ _a = outputType;
19546
+ switch (_a) {
19547
+ case ngx$9.OutputType.FILE_URL: return [3 /*break*/, 3];
19548
+ case ngx$9.OutputType.DATA_URL: return [3 /*break*/, 4];
19549
+ }
19550
+ return [3 /*break*/, 6];
19551
+ case 3: return [2 /*return*/, { url: file.fullPath }];
19552
+ case 4:
19553
+ console.info("[image-service] Converting file " + file.fullPath + " into dataUrl...");
19554
+ return [4 /*yield*/, ImagesUtils.readAndResizeFromUrl(file.fullPath, {
19555
+ maxWidth: this.defaultMaxWidth,
19556
+ maxHeight: this.defaultMaxHeight
19557
+ })];
19558
+ case 5:
19559
+ dataUrl = _b.sent();
19560
+ return [2 /*return*/, { dataUrl: dataUrl }];
19561
+ case 6: throw new Error("Unknown outputType: " + outputType);
19562
+ case 7: return [3 /*break*/, 9];
19563
+ case 8:
19564
+ err_1 = _b.sent();
19565
+ console.error('[image-service] Failed while processing image', err_1);
19566
+ return [2 /*return*/, undefined];
19567
+ case 9: return [2 /*return*/];
19568
+ }
19569
+ });
19570
+ });
19571
+ };
19572
+ ImageService.prototype.addImagesFromGallery = function (opts) {
19573
+ return __awaiter(this, void 0, void 0, function () {
19574
+ var outputType, canReadPictures, err_2, data, items, err_3;
19575
+ return __generator(this, function (_a) {
19576
+ switch (_a.label) {
19577
+ case 0:
19578
+ console.debug('[image-service] Adding images from gallery...');
19579
+ outputType = toNumber(opts === null || opts === void 0 ? void 0 : opts.outputType, ngx$9.OutputType.DATA_URL);
19580
+ _a.label = 1;
19581
+ case 1:
19582
+ _a.trys.push([1, 6, , 7]);
19583
+ return [4 /*yield*/, this.imagePicker.hasReadPermission()];
19584
+ case 2:
19585
+ canReadPictures = _a.sent();
19586
+ if (!!canReadPictures) return [3 /*break*/, 5];
19587
+ return [4 /*yield*/, this.imagePicker.requestReadPermission()];
19588
+ case 3:
19589
+ _a.sent();
19590
+ return [4 /*yield*/, this.imagePicker.hasReadPermission()];
19591
+ case 4:
19592
+ canReadPictures = _a.sent();
19593
+ if (!canReadPictures) {
19594
+ console.error('No read permission, after calling requestReadPermission() without error!! skip');
19595
+ return [2 /*return*/];
19596
+ }
19597
+ _a.label = 5;
19598
+ case 5: return [3 /*break*/, 7];
19599
+ case 6:
19600
+ err_2 = _a.sent();
19601
+ console.error(err_2);
19602
+ return [2 /*return*/]; // Cancelled
19603
+ case 7:
19604
+ _a.trys.push([7, 9, , 10]);
19605
+ return [4 /*yield*/, this.imagePicker.getPictures({
19606
+ maximumImagesCount: 1,
19607
+ //height: this._maxImageHeight
19608
+ allow_video: false,
19609
+ outputType: outputType
19610
+ })];
19611
+ case 8:
19612
+ data = _a.sent();
19613
+ items = !data || Array.isArray(data) ? data : [data];
19614
+ if (isEmptyArray(items))
19615
+ return [2 /*return*/]; // No images selected: skip
19616
+ console.info("[image-service] User select " + items.length + " image(s)");
19617
+ console.debug("[image-service] Selected image: " + JSON.stringify(items));
19618
+ // Convert to entity
19619
+ switch (outputType) {
19620
+ case ngx$9.OutputType.FILE_URL:
19621
+ return [2 /*return*/, items.map(function (url) { return ({ url: url }); })];
19622
+ case ngx$9.OutputType.DATA_URL:
19623
+ return [2 /*return*/, items.map(function (dataUrl) { return ({ dataUrl: dataUrl }); })];
19624
+ default:
19625
+ throw new Error("Unknown outputType: " + outputType);
19626
+ }
19627
+ return [3 /*break*/, 10];
19628
+ case 9:
19629
+ err_3 = _a.sent();
19630
+ console.error('[image-service] Failed to get image from gallery', err_3);
19631
+ return [2 /*return*/, undefined];
19632
+ case 10: return [2 /*return*/];
19633
+ }
19634
+ });
19635
+ });
19636
+ };
19637
+ return ImageService;
19638
+ }(StartableService));
19639
+ ImageService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ImageService_Factory() { return new ImageService(i0.ɵɵinject(PlatformService), i0.ɵɵinject(LocalSettingsService), i0.ɵɵinject(i1$2.TranslateService), i0.ɵɵinject(i1$5.PopoverController), i0.ɵɵinject(i5.ImagePicker), i0.ɵɵinject(i6$1.PhotoViewer), i0.ɵɵinject(i7.MediaCapture), i0.ɵɵinject(i1$5.ActionSheetController), i0.ɵɵinject(ENVIRONMENT)); }, token: ImageService, providedIn: "root" });
19640
+ ImageService.decorators = [
19641
+ { type: i0.Injectable, args: [{ providedIn: 'root', deps: [ENVIRONMENT] },] }
19642
+ ];
19643
+ ImageService.ctorParameters = function () { return [
19644
+ { type: PlatformService },
19645
+ { type: LocalSettingsService },
19646
+ { type: i1$2.TranslateService },
19647
+ { type: i1$5.PopoverController },
19648
+ { type: ngx$9.ImagePicker },
19649
+ { type: ngx$a.PhotoViewer },
19650
+ { type: ngx$b.MediaCapture },
19651
+ { type: i1$5.ActionSheetController },
19652
+ { type: Environment, decorators: [{ type: i0.Inject, args: [ENVIRONMENT,] }] }
19653
+ ]; };
19654
+
19382
19655
  function scrollFactory(overlay) {
19383
19656
  return function () { return overlay.scrollStrategies.close(); };
19384
19657
  }
@@ -19394,6 +19667,7 @@
19394
19667
  ProgressBarService,
19395
19668
  AudioProvider,
19396
19669
  FileService,
19670
+ ImageService,
19397
19671
  TranslateContextService,
19398
19672
  // Export Pipes as providers
19399
19673
  DateFormatPipe,
@@ -19945,592 +20219,247 @@
19945
20219
  return FormFieldValuesHolder;
19946
20220
  }());
19947
20221
 
19948
- // eslint-disable-next-line @angular-eslint/directive-class-suffix
19949
- var AppForm = /** @class */ (function () {
19950
- function AppForm(injector, form) {
19951
- var _this = this;
20222
+ var AppImageGalleryComponent = /** @class */ (function () {
20223
+ function AppImageGalleryComponent(image, platform, cd, environment) {
20224
+ this.image = image;
20225
+ this.platform = platform;
20226
+ this.cd = cd;
20227
+ this._onDestroy = new rxjs.Subject();
19952
20228
  this._subscription = new rxjs.Subscription();
19953
- this._enable = false;
19954
- this.i18nFieldPrefix = null;
19955
- this.readySubject = new rxjs.BehaviorSubject(false);
19956
- this.loadingSubject = new rxjs.BehaviorSubject(true);
19957
- this.errorSubject = new rxjs.BehaviorSubject(undefined);
19958
- this.debug = false;
19959
- this.onCancel = new i0.EventEmitter();
19960
- this.onSubmit = new i0.EventEmitter();
19961
- if (form)
19962
- this.setForm(form);
19963
- this.translate = injector.get(i1$2.TranslateService);
19964
- this.settings = injector.get(LocalSettingsService);
19965
- this.errorTranslator = injector.get(FormErrorTranslator);
19966
- this.autocompleteHelper = new MatAutocompleteConfigHolder(this.settings && {
19967
- getUserAttributes: function (a, b) { return _this.settings.getFieldDisplayAttributes(a, b); }
19968
- });
19969
- this.autocompleteFields = this.autocompleteHelper.fields;
20229
+ this.showToolbar = true;
20230
+ this.colSize = 4;
20231
+ this.autoLoad = true;
20232
+ this.viewChange = new rxjs.BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
20233
+ // DEV log
20234
+ this.debug = environment && !environment.production;
19970
20235
  }
19971
- Object.defineProperty(AppForm.prototype, "_loading", {
19972
- /**
19973
- * @deprecated
19974
- */
19975
- get: function () {
19976
- return this.loadingSubject.value;
19977
- },
19978
- /**
19979
- * @deprecated
19980
- */
19981
- set: function (value) {
19982
- this.loadingSubject.next(value);
19983
- },
19984
- enumerable: false,
19985
- configurable: true
19986
- });
19987
- Object.defineProperty(AppForm.prototype, "_$ready", {
19988
- /**
19989
- * @deprecated
19990
- */
19991
- get: function () {
19992
- return this.readySubject;
19993
- },
19994
- enumerable: false,
19995
- configurable: true
19996
- });
19997
- Object.defineProperty(AppForm.prototype, "_$loading", {
19998
- /**
19999
- * @deprecated
20000
- */
20001
- get: function () {
20002
- return this.loadingSubject;
20003
- },
20004
- enumerable: false,
20005
- configurable: true
20006
- });
20007
- Object.defineProperty(AppForm.prototype, "error", {
20008
- get: function () {
20009
- return this.errorSubject.value;
20010
- },
20011
- set: function (error) {
20012
- this.setError(error);
20013
- },
20014
- enumerable: false,
20015
- configurable: true
20016
- });
20017
- Object.defineProperty(AppForm.prototype, "loading", {
20018
- get: function () {
20019
- return this.loadingSubject.value;
20020
- },
20021
- enumerable: false,
20022
- configurable: true
20023
- });
20024
- Object.defineProperty(AppForm.prototype, "loaded", {
20025
- get: function () {
20026
- return !this.loadingSubject.value;
20027
- },
20028
- enumerable: false,
20029
- configurable: true
20030
- });
20031
- Object.defineProperty(AppForm.prototype, "value", {
20236
+ Object.defineProperty(AppImageGalleryComponent.prototype, "dataSource", {
20032
20237
  get: function () {
20033
- return this.form.value;
20034
- },
20035
- set: function (data) {
20036
- this.setValue(data);
20037
- },
20038
- enumerable: false,
20039
- configurable: true
20040
- });
20041
- Object.defineProperty(AppForm.prototype, "dirty", {
20042
- get: function () {
20043
- var _a;
20044
- return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.dirty) || false;
20045
- },
20046
- enumerable: false,
20047
- configurable: true
20048
- });
20049
- Object.defineProperty(AppForm.prototype, "invalid", {
20050
- get: function () {
20051
- return !this.form || this.form.invalid;
20052
- },
20053
- enumerable: false,
20054
- configurable: true
20055
- });
20056
- Object.defineProperty(AppForm.prototype, "pending", {
20057
- get: function () {
20058
- return !this.form || (this.form.dirty && this.form.pending);
20059
- },
20060
- enumerable: false,
20061
- configurable: true
20062
- });
20063
- Object.defineProperty(AppForm.prototype, "valid", {
20064
- get: function () {
20065
- var _a;
20066
- return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.valid) || false;
20238
+ return this._dataSource;
20067
20239
  },
20068
- enumerable: false,
20069
- configurable: true
20070
- });
20071
- Object.defineProperty(AppForm.prototype, "empty", {
20072
- get: function () {
20073
- return !this.form || (!this.form.dirty && !this.form.touched);
20240
+ set: function (dataSource) {
20241
+ if (this._dataSource !== dataSource) {
20242
+ this._switchDataSource(dataSource);
20243
+ }
20074
20244
  },
20075
20245
  enumerable: false,
20076
20246
  configurable: true
20077
20247
  });
20078
- Object.defineProperty(AppForm.prototype, "untouched", {
20248
+ Object.defineProperty(AppImageGalleryComponent.prototype, "enabled", {
20079
20249
  get: function () {
20080
- return !this.form || this.form.untouched;
20250
+ return !this.disabled;
20081
20251
  },
20082
20252
  enumerable: false,
20083
20253
  configurable: true
20084
20254
  });
20085
- Object.defineProperty(AppForm.prototype, "enabled", {
20255
+ Object.defineProperty(AppImageGalleryComponent.prototype, "rows", {
20086
20256
  get: function () {
20087
- return this._enable;
20088
- },
20089
- enumerable: false,
20090
- configurable: true
20091
- });
20092
- Object.defineProperty(AppForm.prototype, "disabled", {
20093
- get: function () {
20094
- return !this._enable;
20257
+ return this._data;
20095
20258
  },
20096
20259
  enumerable: false,
20097
20260
  configurable: true
20098
20261
  });
20099
- AppForm.prototype.disable = function (opts) {
20100
- var _a;
20101
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.disable(opts);
20102
- if (this._enable) {
20103
- this._enable = false;
20104
- if (!opts || opts.emitEvent !== true)
20105
- this.markForCheck();
20106
- }
20262
+ AppImageGalleryComponent.prototype.ngOnInit = function () {
20263
+ this.mobile = toBoolean(this.mobile, isMobile(window));
20264
+ this.readOnly = toBoolean(this.readOnly, false);
20107
20265
  };
20108
- AppForm.prototype.enable = function (opts) {
20109
- var _a;
20110
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.enable(opts);
20111
- if (!this._enable) {
20112
- this._enable = true;
20113
- if (!opts || opts.emitEvent !== true)
20114
- this.markForCheck();
20266
+ AppImageGalleryComponent.prototype.ngAfterContentChecked = function () {
20267
+ if (this.dataSource && !this._renderChangeSubscription) {
20268
+ this._observeRenderChanges();
20115
20269
  }
20116
20270
  };
20117
- Object.defineProperty(AppForm.prototype, "form", {
20118
- get: function () {
20119
- return this._form;
20120
- },
20121
- set: function (value) {
20122
- this.setForm(value);
20123
- },
20124
- enumerable: false,
20125
- configurable: true
20126
- });
20127
- AppForm.prototype.ngOnInit = function () {
20128
- this._enable ? this.enable() : this.disable();
20129
- this.errorTranslatorOptions = this.errorTranslatorOptions || {
20130
- controlPathTranslator: this
20131
- };
20132
- };
20133
- AppForm.prototype.ngOnDestroy = function () {
20271
+ AppImageGalleryComponent.prototype.ngOnDestroy = function () {
20272
+ this._onDestroy.next();
20273
+ this._onDestroy.complete();
20134
20274
  this._subscription.unsubscribe();
20135
- this.readySubject.unsubscribe();
20136
- this.loadingSubject.unsubscribe();
20137
- this.errorSubject.unsubscribe();
20138
- this.onCancel.unsubscribe();
20139
- this.onSubmit.unsubscribe();
20275
+ if (collections.isDataSource(this.dataSource)) {
20276
+ this.dataSource.disconnect(this);
20277
+ }
20140
20278
  };
20141
- AppForm.prototype.cancel = function () {
20279
+ AppImageGalleryComponent.prototype.show = function (event, image) {
20142
20280
  return __awaiter(this, void 0, void 0, function () {
20143
- return __generator(this, function (_b) {
20144
- this.onCancel.emit();
20281
+ return __generator(this, function (_a) {
20282
+ if (!image || (event === null || event === void 0 ? void 0 : event.defaultPrevented))
20283
+ return [2 /*return*/];
20284
+ this.image.show(image.url || image.dataUrl, image.title || '', { share: true, closeButton: true });
20145
20285
  return [2 /*return*/];
20146
20286
  });
20147
20287
  });
20148
20288
  };
20149
- /**
20150
- *
20151
- * @param event
20152
- * @param opts allow to skip validation check, using {checkValid: false}
20153
- */
20154
- AppForm.prototype.doSubmit = function (event, opts) {
20289
+ AppImageGalleryComponent.prototype.add = function (event) {
20155
20290
  return __awaiter(this, void 0, void 0, function () {
20291
+ var images, images_1, images_1_1, image, row, added;
20292
+ var e_1, _a;
20156
20293
  return __generator(this, function (_b) {
20157
20294
  switch (_b.label) {
20158
- case 0:
20159
- if (!this._form) {
20160
- this.markAllAsTouched({ emitEvent: true });
20161
- return [2 /*return*/];
20162
- }
20163
- if (!((!opts || opts.checkValid !== false) && !this._form.valid)) return [3 /*break*/, 2];
20164
- // Wait validation end
20165
- return [4 /*yield*/, AppFormUtils.waitWhilePending(this._form)];
20295
+ case 0: return [4 /*yield*/, this.image.add(event)];
20166
20296
  case 1:
20167
- // Wait validation end
20168
- _b.sent();
20169
- // Form is invalid: exit (+ log if debug)
20170
- if (this._form.invalid) {
20171
- this.markAllAsTouched({ emitEvent: true });
20172
- if (this.debug)
20173
- AppFormUtils.logFormErrors(this._form);
20297
+ images = _b.sent();
20298
+ if (isEmptyArray(images))
20174
20299
  return [2 /*return*/];
20300
+ console.info("[image-gallery] Adding new " + images.length + " image(s)", images);
20301
+ try {
20302
+ for (images_1 = __values(images), images_1_1 = images_1.next(); !images_1_1.done; images_1_1 = images_1.next()) {
20303
+ image = images_1_1.value;
20304
+ this._dataSource.createNew(0);
20305
+ row = this._dataSource.getRow(-1);
20306
+ row.currentData = image;
20307
+ added = row.confirmEditCreate();
20308
+ if (!added) {
20309
+ console.warn('Cannot confirmEditCreate new image!');
20310
+ break;
20311
+ }
20312
+ }
20313
+ }
20314
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
20315
+ finally {
20316
+ try {
20317
+ if (images_1_1 && !images_1_1.done && (_a = images_1.return)) _a.call(images_1);
20318
+ }
20319
+ finally { if (e_1) throw e_1.error; }
20175
20320
  }
20176
- _b.label = 2;
20177
- case 2:
20178
- // Emit event
20179
- this.onSubmit.emit(event);
20180
20321
  return [2 /*return*/];
20181
20322
  }
20182
20323
  });
20183
20324
  });
20184
20325
  };
20185
- AppForm.prototype.setForm = function (form) {
20186
- var _this = this;
20187
- if (this._form !== form) {
20188
- this._form = form;
20189
- this._subscription.add(this._form.statusChanges.subscribe(function (status) { return _this.markForCheck(); }));
20190
- }
20191
- };
20192
- AppForm.prototype.setValue = function (data, opts) {
20193
- if (!data) {
20194
- console.warn('[form] Trying to set an empty value to form. Skipping');
20195
- return;
20196
- }
20197
- // DEBUG
20198
- //if (this.debug) console.debug('[form] Updating form (using entity)', data);
20199
- // Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
20200
- AppFormUtils.copyEntity2Form(data, this.form, Object.assign({ emitEvent: false, onlySelf: true }, opts));
20201
- if (!opts || opts.emitEvent !== true) {
20202
- this.markForCheck();
20203
- }
20326
+ AppImageGalleryComponent.prototype.remove = function (event, row) {
20327
+ return __awaiter(this, void 0, void 0, function () {
20328
+ return __generator(this, function (_a) {
20329
+ if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
20330
+ return [2 /*return*/];
20331
+ event === null || event === void 0 ? void 0 : event.preventDefault();
20332
+ if (row.id === -1) {
20333
+ console.info('[image-gallery] Removing new image');
20334
+ row.cancelOrDelete();
20335
+ }
20336
+ else {
20337
+ console.info('[image-gallery] Removing image (at #' + row.id + ')');
20338
+ row.delete();
20339
+ }
20340
+ return [2 /*return*/];
20341
+ });
20342
+ });
20204
20343
  };
20205
- AppForm.prototype.reset = function (data, opts) {
20206
- if (data) {
20207
- if (this.debug)
20208
- console.debug('[form] Resetting form (using entity)', data);
20209
- // Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
20210
- var json = AppFormUtils.getFormValueFromEntity(data, this.form);
20211
- this.form.reset(json, { emitEvent: false, onlySelf: true });
20344
+ AppImageGalleryComponent.prototype.toggleViewMode = function (event) {
20345
+ console.log(event);
20346
+ if (this.colSize === 12) {
20347
+ this.colSize = 4;
20212
20348
  }
20213
20349
  else {
20214
- this.form.reset(null, { emitEvent: false, onlySelf: true });
20350
+ this.colSize = 12;
20215
20351
  }
20216
- if (!opts || opts.emitEvent !== true)
20217
- this.markForCheck();
20218
- };
20219
- AppForm.prototype.markAsPristine = function (opts) {
20220
- this.form.markAsPristine(opts);
20221
- if (!opts || opts.emitEvent !== false)
20222
- this.markForCheck();
20223
- };
20224
- AppForm.prototype.markAsUntouched = function (opts) {
20225
- this.form.markAsUntouched(opts);
20226
- if (!opts || opts.emitEvent !== false)
20227
- this.markForCheck();
20228
- };
20229
- /**
20230
- * @deprecated prefer to use markAllAsTouched()
20231
- * @param opts
20232
- */
20233
- AppForm.prototype.markAsTouched = function (opts) {
20234
- // this.form.markAllAsTouched() // This is not working well (e.g. in TripForm)
20235
- console.warn('TODO: Replace this call by markAllAsTouched() - because of changes in ngx-components >= 0.16.0');
20236
- AppFormUtils.markAsTouched(this.form, opts);
20237
- if (!opts || opts.emitEvent !== false)
20238
- this.markForCheck();
20239
- };
20240
- AppForm.prototype.markAllAsTouched = function (opts) {
20241
- // this.form.markAllAsTouched() // This is not working well (e.g. in TripForm)
20242
- AppFormUtils.markAllAsTouched(this.form, opts);
20243
- if (!opts || opts.emitEvent !== false)
20244
- this.markForCheck();
20245
- };
20246
- AppForm.prototype.markAsDirty = function (opts) {
20247
- this.form.markAsDirty(opts);
20248
- if (!opts || opts.emitEvent !== false)
20249
- this.markForCheck();
20250
- };
20251
- AppForm.prototype.markAsLoading = function (opts) {
20252
- this.setLoading(true, opts);
20253
- };
20254
- AppForm.prototype.markAsLoaded = function (opts) {
20255
- this.setLoading(false, opts);
20352
+ this.cd.markForCheck();
20256
20353
  };
20257
- AppForm.prototype.markAsReady = function (opts) {
20258
- if (this.readySubject.value !== true) {
20259
- this.readySubject.next(true);
20260
- // If subclasses implements OnReady
20261
- if (typeof this['ngOnReady'] === 'function') {
20262
- this.ngOnReady();
20263
- }
20354
+ AppImageGalleryComponent.prototype._switchDataSource = function (dataSource) {
20355
+ if (collections.isDataSource(this._dataSource)) {
20356
+ this._dataSource.disconnect(this);
20264
20357
  }
20358
+ this._dataSource = dataSource;
20265
20359
  };
20266
- /**
20267
- * Wait form is ready
20268
- * @param opts
20269
- */
20270
- AppForm.prototype.ready = function (opts) {
20271
- if (this.readySubject.value)
20272
- return Promise.resolve();
20273
- return waitForTrue(this.readySubject, opts);
20274
- };
20275
- /**
20276
- * Wait form is not busy (=loaded)
20277
- * @param opts
20278
- */
20279
- AppForm.prototype.waitIdle = function (opts) {
20280
- if (!this.loadingSubject.value)
20281
- return Promise.resolve();
20282
- return waitForFalse(this.loadingSubject, opts);
20283
- };
20284
- AppForm.prototype.updateValueAndValidity = function (opts) {
20285
- AppFormUtils.updateValueAndValidity(this.form, opts);
20286
- if (!opts || opts.emitEvent !== false)
20287
- this.markForCheck();
20288
- };
20289
- AppForm.prototype.translateControlPath = function (path) {
20290
- var _a;
20291
- var i18nFieldName = this.getI18nFieldName(path);
20292
- return ((_a = this.translate) === null || _a === void 0 ? void 0 : _a.instant(i18nFieldName)) || i18nFieldName;
20293
- };
20294
- /* -- protected methods -- */
20295
- AppForm.prototype.getFormError = function (form, opts) {
20296
- if (!form || !this.errorTranslator)
20297
- return undefined;
20298
- return this.errorTranslator.translateFormErrors(this.form, Object.assign({ controlPathTranslator: this }, opts));
20299
- };
20300
- AppForm.prototype.getI18nFieldName = function (path) {
20301
- return (this.i18nFieldPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
20302
- };
20303
- AppForm.prototype.registerSubscription = function (sub) {
20304
- return this._subscription.add(sub);
20305
- };
20306
- AppForm.prototype.unregisterSubscription = function (sub) {
20307
- this._subscription.remove(sub);
20308
- };
20309
- AppForm.prototype.registerAutocompleteField = function (fieldName, opts) {
20310
- return this.autocompleteHelper.add(fieldName, opts);
20311
- };
20312
- AppForm.prototype.setError = function (value, opts) {
20313
- if (this.errorSubject.value !== value) {
20314
- this.errorSubject.next(value);
20315
- if (!opts || opts.emitEvent !== false) {
20316
- this.markForCheck();
20317
- }
20360
+ AppImageGalleryComponent.prototype._observeRenderChanges = function () {
20361
+ var _this = this;
20362
+ // If no data source has been set, there is nothing to observe for changes.
20363
+ if (!this.dataSource) {
20364
+ return;
20318
20365
  }
20319
- };
20320
- AppForm.prototype.markForCheck = function () {
20321
- // Should be overwritten by subclasses
20322
- console.warn('markForCheck() has been called, but is not overwritten by component ' + this.constructor.name);
20323
- };
20324
- /* -- private function -- */
20325
- AppForm.prototype.setLoading = function (value, opts) {
20326
- if (this.loadingSubject.value !== value) {
20327
- this.loadingSubject.next(value);
20328
- if (!opts || opts.emitEvent !== false) {
20329
- this.markForCheck();
20330
- }
20366
+ var dataStream;
20367
+ if (collections.isDataSource(this.dataSource)) {
20368
+ dataStream = this.dataSource.connect(this);
20331
20369
  }
20370
+ if (dataStream === undefined) {
20371
+ throw this.getTableUnknownDataSourceError();
20372
+ }
20373
+ this._renderChangeSubscription = dataStream.pipe(operators.takeUntil(this._onDestroy))
20374
+ .subscribe(function (data) {
20375
+ _this._data = data || [];
20376
+ _this.cd.markForCheck();
20377
+ });
20332
20378
  };
20333
- return AppForm;
20379
+ AppImageGalleryComponent.prototype.getTableUnknownDataSourceError = function () {
20380
+ return Error("Provided data source did not match an array, Observable, or DataSource");
20381
+ };
20382
+ return AppImageGalleryComponent;
20334
20383
  }());
20335
- AppForm.decorators = [
20336
- { type: i0.Directive }
20384
+ AppImageGalleryComponent.decorators = [
20385
+ { type: i0.Component, args: [{
20386
+ selector: 'app-image-gallery',
20387
+ template: "\n<ion-toolbar color=\"light\" *ngIf=\"showToolbar\">\n <!-- Add -->\n <button mat-icon-button\n *ngIf=\"!readOnly && !mobile && enabled\"\n [title]=\"'COMMON.BTN_ADD'|translate\"\n (click)=\"add($event)\">\n <mat-icon>add</mat-icon>\n </button>\n\n <ion-buttons slot=\"end\">\n <!-- Toggle view mode -->\n <ion-segment (ionChange)=\"toggleViewMode($event)\" color=\"accent\" [value]=\"colSize\">\n <ion-segment-button value=\"4\">\n <mat-icon>view_module</mat-icon>\n </ion-segment-button>\n <ion-segment-button value=\"12\">\n <mat-icon>view_list</mat-icon>\n </ion-segment-button>\n </ion-segment>\n </ion-buttons>\n</ion-toolbar>\n\n<ion-grid>\n <ion-row>\n <ion-col *ngFor=\"let row of rows\" [size]=\"colSize\">\n <ion-card *ngIf=\"row|propertyGet:'currentData'; let image\"\n (click)=\"show($event, image)\"\n tappable\n @fadeInAnimation>\n\n <!-- debug -->\n <ion-card-header class=\"ion-no-padding\" color=\"light\">\n <mat-toolbar>\n <ion-label class=\"ion-padding-start\" *ngIf=\"image.title; else addTitleButton\">{{image.title}}</ion-label>\n <ng-template #addTitleButton>\n <!-- <a class=\"button-text\"-->\n <!-- *ngIf=\"showImageTitle && !readOnly\"-->\n <!-- (click)=\"editTitle($event)\" translate>IMAGE.GALLERY.BTN_ADD_TITLE</a>-->\n </ng-template>\n\n <div class=\"toolbar-spacer\"></div>\n\n <button mat-icon-button *ngIf=\"!readOnly\"\n [title]=\"'COMMON.BTN_DELETE'|translate\"\n [disabled]=\"disabled\"\n (click)=\"remove($event, row)\">\n <mat-icon>delete</mat-icon>\n </button>\n </mat-toolbar>\n\n </ion-card-header>\n\n\n <img [src]=\"image.url||image.dataUrl\">\n\n <ion-card-content *ngIf=\"debug\">\n <ion-text >{{image.url}}</ion-text>\n </ion-card-content>\n </ion-card>\n </ion-col>\n </ion-row>\n</ion-grid>\n\n<!-- FAB button: add -->\n<ion-fab slot=\"fixed\" vertical=\"bottom\" horizontal=\"end\"\n *ngIf=\"showToolbar && mobile\"\n [class.cdk-visually-hidden]=\"disabled\"\n @fadeInOutAnimation>\n\n <ion-fab-button color=\"tertiary\" (click)=\"add($event)\">\n <ion-icon name=\"camera\"></ion-icon>\n <ion-icon name=\"add\" class=\"icon-secondary\" style=\"left: 33px; top: 9px; font-size: 20px;\"></ion-icon>\n </ion-fab-button>\n</ion-fab>\n\n\n\n\n",
20388
+ animations: [fadeInAnimation, fadeInOutAnimation],
20389
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
20390
+ styles: [".mat-toolbar-single-row,mat-toolbar{padding:0;height:42px}"]
20391
+ },] }
20337
20392
  ];
20338
- AppForm.ctorParameters = function () { return [
20339
- { type: i0.Injector },
20340
- { type: i1.FormGroup }
20393
+ AppImageGalleryComponent.ctorParameters = function () { return [
20394
+ { type: ImageService },
20395
+ { type: i1$5.Platform },
20396
+ { type: i0.ChangeDetectorRef },
20397
+ { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
20341
20398
  ]; };
20342
- AppForm.propDecorators = {
20399
+ AppImageGalleryComponent.propDecorators = {
20343
20400
  debug: [{ type: i0.Input }],
20344
- tabindex: [{ type: i0.Input }],
20345
- errorTranslatorOptions: [{ type: i0.Input }],
20346
- form: [{ type: i0.Input }],
20347
- onCancel: [{ type: i0.Output }],
20348
- onSubmit: [{ type: i0.Output }]
20401
+ readOnly: [{ type: i0.Input }],
20402
+ disabled: [{ type: i0.Input }],
20403
+ showToolbar: [{ type: i0.Input }],
20404
+ mobile: [{ type: i0.Input }],
20405
+ colSize: [{ type: i0.Input }],
20406
+ autoLoad: [{ type: i0.Input }],
20407
+ dataSource: [{ type: i0.Input }]
20349
20408
  };
20350
20409
 
20351
- var TextForm = /** @class */ (function (_super) {
20352
- __extends(TextForm, _super);
20353
- function TextForm(injector, cd, formBuilder) {
20354
- var _this = _super.call(this, injector) || this;
20355
- _this.injector = injector;
20356
- _this.cd = cd;
20357
- _this.formBuilder = formBuilder;
20358
- _this.showError = true;
20359
- _this.multiline = true;
20360
- _this.autoHeight = false;
20361
- _this.maxLength = 2000;
20362
- _this.autofocus = false;
20363
- _this.textAreaChanges = new i0.EventEmitter();
20364
- return _this;
20410
+ var ImageGalleryModule = /** @class */ (function () {
20411
+ function ImageGalleryModule() {
20365
20412
  }
20366
- TextForm.prototype.ngOnInit = function () {
20367
- var form = this.formBuilder.group({
20368
- text: [null, isNotNil(this.maxLength)
20369
- ? i1.Validators.maxLength(this.maxLength)
20370
- : undefined
20371
- ]
20372
- });
20373
- this.control = form.get('text');
20374
- this.setForm(form);
20375
- _super.prototype.ngOnInit.call(this);
20376
- };
20377
- TextForm.prototype.textAreaChanged = function (event) {
20378
- this.textAreaChanges.emit(this.control.value);
20379
- };
20380
- TextForm.prototype.containerResize = function () {
20381
- var _a;
20382
- (_a = this.autosizeDirective) === null || _a === void 0 ? void 0 : _a.resizeToFitContent(true);
20383
- };
20384
- TextForm.prototype.focusInput = function () {
20385
- if (this.textArea)
20386
- focusInput(this.textArea);
20387
- if (this.textInput)
20388
- focusInput(this.textInput);
20389
- };
20390
- TextForm.prototype.markForCheck = function () {
20391
- this.cd.markForCheck();
20392
- };
20393
- return TextForm;
20394
- }(AppForm));
20395
- TextForm.decorators = [
20396
- { type: i0.Component, args: [{
20397
- selector: 'app-text-form',
20398
- template: "<form class=\"form-container\" [formGroup]=\"form\" (ngSubmit)=\"doSubmit($event)\">\n <mat-form-field *ngIf=\"multiline; else monoline\">\n <textarea\n #textArea\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"control.disabled\"\n [class.fixed-height]=\"!autoHeight\"\n [cdkTextareaAutosize]=\"autoHeight\"\n (keyup)=\"textAreaChanged($event)\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n [autofocus]=\"autofocus\"\n ></textarea>\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textArea.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n <ng-template #monoline>\n <mat-form-field>\n <input\n #textInput\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"disabled\"\n [appAutofocus]=\"autofocus\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n />\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textInput.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n </ng-template>\n</form>\n",
20399
- styles: ["textarea.fixed-height{height:11.5em}"]
20413
+ return ImageGalleryModule;
20414
+ }());
20415
+ ImageGalleryModule.decorators = [
20416
+ { type: i0.NgModule, args: [{
20417
+ imports: [
20418
+ i1$4.CommonModule,
20419
+ i1$5.IonicModule,
20420
+ SharedMaterialModule,
20421
+ SharedPipesModule,
20422
+ i1$2.TranslateModule.forChild(),
20423
+ ],
20424
+ declarations: [
20425
+ // Components
20426
+ AppImageGalleryComponent
20427
+ ],
20428
+ exports: [
20429
+ // Components
20430
+ AppImageGalleryComponent
20431
+ ]
20400
20432
  },] }
20401
20433
  ];
20402
- TextForm.ctorParameters = function () { return [
20403
- { type: i0.Injector },
20404
- { type: i0.ChangeDetectorRef },
20405
- { type: i1.FormBuilder }
20406
- ]; };
20407
- TextForm.propDecorators = {
20408
- showError: [{ type: i0.Input }],
20409
- placeholder: [{ type: i0.Input }],
20410
- multiline: [{ type: i0.Input }],
20411
- autoHeight: [{ type: i0.Input }],
20412
- maxLength: [{ type: i0.Input }],
20413
- autofocus: [{ type: i0.Input }],
20414
- textAreaChanges: [{ type: i0.Output }],
20415
- textArea: [{ type: i0.ViewChild, args: ['textArea',] }],
20416
- textInput: [{ type: i0.ViewChild, args: ['textInput',] }],
20417
- autosizeDirective: [{ type: i0.ViewChild, args: [textField.CdkTextareaAutosize,] }]
20418
- };
20419
20434
 
20420
- var TextPopover = /** @class */ (function () {
20421
- function TextPopover(popoverController, translate) {
20422
- this.popoverController = popoverController;
20423
- this.translate = translate;
20424
- this.placeholder = '';
20425
- this.editing = true;
20426
- this.multiline = true;
20427
- this.maxLength = 2000;
20428
- this.autofocus = false;
20429
- this.subscription = new rxjs.Subscription();
20435
+ var ImageModule = /** @class */ (function () {
20436
+ function ImageModule() {
20430
20437
  }
20431
- Object.defineProperty(TextPopover.prototype, "disabled", {
20432
- get: function () {
20433
- return this.form.disabled;
20434
- },
20435
- enumerable: false,
20436
- configurable: true
20437
- });
20438
- Object.defineProperty(TextPopover.prototype, "enabled", {
20439
- get: function () {
20440
- return this.form.enabled;
20441
- },
20442
- enumerable: false,
20443
- configurable: true
20444
- });
20445
- Object.defineProperty(TextPopover.prototype, "valid", {
20446
- get: function () {
20447
- var _a;
20448
- return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.valid) || false;
20449
- },
20450
- enumerable: false,
20451
- configurable: true
20452
- });
20453
- Object.defineProperty(TextPopover.prototype, "value", {
20454
- get: function () {
20455
- var _a;
20456
- return (_a = this.form) === null || _a === void 0 ? void 0 : _a.value.text;
20457
- },
20458
- enumerable: false,
20459
- configurable: true
20460
- });
20461
- TextPopover.prototype.ngOnInit = function () {
20462
- this.enable();
20463
- };
20464
- TextPopover.prototype.ngAfterViewInit = function () {
20465
- var _this = this;
20466
- setTimeout(function () { return _this.form.setValue({ text: _this.text }); }, 0);
20467
- };
20468
- TextPopover.prototype.onValidate = function (event) {
20469
- return __awaiter(this, void 0, void 0, function () {
20470
- var value, err_1;
20471
- return __generator(this, function (_b) {
20472
- switch (_b.label) {
20473
- case 0: return [4 /*yield*/, waitWhilePending(this.form)];
20474
- case 1:
20475
- _b.sent();
20476
- if (!this.valid) {
20477
- logFormErrors(this.form.control);
20478
- return [2 /*return*/];
20479
- }
20480
- _b.label = 2;
20481
- case 2:
20482
- _b.trys.push([2, 4, , 5]);
20483
- value = this.value;
20484
- this.disable();
20485
- return [4 /*yield*/, this.popoverController.dismiss(value)];
20486
- case 3:
20487
- _b.sent();
20488
- this.form.error = null;
20489
- return [3 /*break*/, 5];
20490
- case 4:
20491
- err_1 = _b.sent();
20492
- this.form.error = (err_1 && err_1.message) || err_1;
20493
- this.enable();
20494
- return [3 /*break*/, 5];
20495
- case 5: return [2 /*return*/];
20496
- }
20497
- });
20498
- });
20499
- };
20500
- TextPopover.prototype.disable = function () {
20501
- this.form.disable();
20502
- };
20503
- TextPopover.prototype.enable = function () {
20504
- if (this.editing)
20505
- this.form.enable();
20506
- };
20507
- TextPopover.prototype.cancel = function () {
20508
- this.popoverController.dismiss();
20509
- };
20510
- TextPopover.prototype.ngOnDestroy = function () {
20511
- this.subscription.unsubscribe();
20438
+ ImageModule.forRoot = function () {
20439
+ console.debug('[image] Creating module (root)');
20440
+ return {
20441
+ ngModule: ImageModule,
20442
+ providers: [
20443
+ ngx$9.ImagePicker,
20444
+ ngx$b.MediaCapture,
20445
+ ngx$a.PhotoViewer
20446
+ ]
20447
+ };
20512
20448
  };
20513
- return TextPopover;
20449
+ return ImageModule;
20514
20450
  }());
20515
- TextPopover.decorators = [
20516
- { type: i0.Component, args: [{
20517
- selector: 'app-text-popover',
20518
- template: "\n<ion-content class=\"ion-padding\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <ion-item *ngIf=\"form.error\" visible-xs visible-sm visible-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"form.error|translate\"></ion-label>\n </ion-item>\n\n <app-text-form #form [placeholder]=\"placeholder\"\n [multiline]=\"multiline\"\n [maxLength]=\"maxLength\"\n [autofocus]=\"editing && autofocus\"\n (onSubmit)=\"onValidate($event)\"\n ></app-text-form>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n\n </ion-col>\n\n <ion-col size=\"auto\">\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"cancel()\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n <ion-button\n [fill]=\"disabled ? 'clear' : 'solid'\"\n (click)=\"onValidate($event)\"\n (keyup.enter)=\"onValidate($event)\"\n color=\"tertiary\"\n [disabled]=\"disabled\"\n [title]=\"'COMMON.BTN_VALIDATE_WITH_SHORTCUT_HELP'|translate\">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n"
20451
+ ImageModule.decorators = [
20452
+ { type: i0.NgModule, args: [{
20453
+ imports: [
20454
+ i1$4.CommonModule,
20455
+ ImageGalleryModule
20456
+ ],
20457
+ exports: [
20458
+ // Sub module
20459
+ ImageGalleryModule
20460
+ ]
20519
20461
  },] }
20520
20462
  ];
20521
- TextPopover.ctorParameters = function () { return [
20522
- { type: i1$5.PopoverController },
20523
- { type: i1$2.TranslateService }
20524
- ]; };
20525
- TextPopover.propDecorators = {
20526
- form: [{ type: i0.ViewChild, args: ['form', { static: true },] }],
20527
- text: [{ type: i0.Input }],
20528
- placeholder: [{ type: i0.Input }],
20529
- editing: [{ type: i0.Input }],
20530
- multiline: [{ type: i0.Input }],
20531
- maxLength: [{ type: i0.Input }],
20532
- autofocus: [{ type: i0.Input }]
20533
- };
20534
20463
 
20535
20464
  var ResizableDirective = /** @class */ (function () {
20536
20465
  function ResizableDirective(document, elementRef) {
@@ -21540,6 +21469,409 @@
21540
21469
  form: [{ type: i0.ViewChild, args: ['form', { static: true },] }]
21541
21470
  };
21542
21471
 
21472
+ // eslint-disable-next-line @angular-eslint/directive-class-suffix
21473
+ var AppForm = /** @class */ (function () {
21474
+ function AppForm(injector, form) {
21475
+ var _this = this;
21476
+ this._subscription = new rxjs.Subscription();
21477
+ this._enable = false;
21478
+ this.i18nFieldPrefix = null;
21479
+ this.readySubject = new rxjs.BehaviorSubject(false);
21480
+ this.loadingSubject = new rxjs.BehaviorSubject(true);
21481
+ this.errorSubject = new rxjs.BehaviorSubject(undefined);
21482
+ this.debug = false;
21483
+ this.onCancel = new i0.EventEmitter();
21484
+ this.onSubmit = new i0.EventEmitter();
21485
+ if (form)
21486
+ this.setForm(form);
21487
+ this.translate = injector.get(i1$2.TranslateService);
21488
+ this.settings = injector.get(LocalSettingsService);
21489
+ this.errorTranslator = injector.get(FormErrorTranslator);
21490
+ this.autocompleteHelper = new MatAutocompleteConfigHolder(this.settings && {
21491
+ getUserAttributes: function (a, b) { return _this.settings.getFieldDisplayAttributes(a, b); }
21492
+ });
21493
+ this.autocompleteFields = this.autocompleteHelper.fields;
21494
+ }
21495
+ Object.defineProperty(AppForm.prototype, "_loading", {
21496
+ /**
21497
+ * @deprecated
21498
+ */
21499
+ get: function () {
21500
+ return this.loadingSubject.value;
21501
+ },
21502
+ /**
21503
+ * @deprecated
21504
+ */
21505
+ set: function (value) {
21506
+ this.loadingSubject.next(value);
21507
+ },
21508
+ enumerable: false,
21509
+ configurable: true
21510
+ });
21511
+ Object.defineProperty(AppForm.prototype, "_$ready", {
21512
+ /**
21513
+ * @deprecated
21514
+ */
21515
+ get: function () {
21516
+ return this.readySubject;
21517
+ },
21518
+ enumerable: false,
21519
+ configurable: true
21520
+ });
21521
+ Object.defineProperty(AppForm.prototype, "_$loading", {
21522
+ /**
21523
+ * @deprecated
21524
+ */
21525
+ get: function () {
21526
+ return this.loadingSubject;
21527
+ },
21528
+ enumerable: false,
21529
+ configurable: true
21530
+ });
21531
+ Object.defineProperty(AppForm.prototype, "error", {
21532
+ get: function () {
21533
+ return this.errorSubject.value;
21534
+ },
21535
+ set: function (error) {
21536
+ this.setError(error);
21537
+ },
21538
+ enumerable: false,
21539
+ configurable: true
21540
+ });
21541
+ Object.defineProperty(AppForm.prototype, "loading", {
21542
+ get: function () {
21543
+ return this.loadingSubject.value;
21544
+ },
21545
+ enumerable: false,
21546
+ configurable: true
21547
+ });
21548
+ Object.defineProperty(AppForm.prototype, "loaded", {
21549
+ get: function () {
21550
+ return !this.loadingSubject.value;
21551
+ },
21552
+ enumerable: false,
21553
+ configurable: true
21554
+ });
21555
+ Object.defineProperty(AppForm.prototype, "value", {
21556
+ get: function () {
21557
+ return this.form.value;
21558
+ },
21559
+ set: function (data) {
21560
+ this.setValue(data);
21561
+ },
21562
+ enumerable: false,
21563
+ configurable: true
21564
+ });
21565
+ Object.defineProperty(AppForm.prototype, "dirty", {
21566
+ get: function () {
21567
+ var _a;
21568
+ return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.dirty) || false;
21569
+ },
21570
+ enumerable: false,
21571
+ configurable: true
21572
+ });
21573
+ Object.defineProperty(AppForm.prototype, "invalid", {
21574
+ get: function () {
21575
+ return !this.form || this.form.invalid;
21576
+ },
21577
+ enumerable: false,
21578
+ configurable: true
21579
+ });
21580
+ Object.defineProperty(AppForm.prototype, "pending", {
21581
+ get: function () {
21582
+ return !this.form || (this.form.dirty && this.form.pending);
21583
+ },
21584
+ enumerable: false,
21585
+ configurable: true
21586
+ });
21587
+ Object.defineProperty(AppForm.prototype, "valid", {
21588
+ get: function () {
21589
+ var _a;
21590
+ return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.valid) || false;
21591
+ },
21592
+ enumerable: false,
21593
+ configurable: true
21594
+ });
21595
+ Object.defineProperty(AppForm.prototype, "empty", {
21596
+ get: function () {
21597
+ return !this.form || (!this.form.dirty && !this.form.touched);
21598
+ },
21599
+ enumerable: false,
21600
+ configurable: true
21601
+ });
21602
+ Object.defineProperty(AppForm.prototype, "untouched", {
21603
+ get: function () {
21604
+ return !this.form || this.form.untouched;
21605
+ },
21606
+ enumerable: false,
21607
+ configurable: true
21608
+ });
21609
+ Object.defineProperty(AppForm.prototype, "enabled", {
21610
+ get: function () {
21611
+ return this._enable;
21612
+ },
21613
+ enumerable: false,
21614
+ configurable: true
21615
+ });
21616
+ Object.defineProperty(AppForm.prototype, "disabled", {
21617
+ get: function () {
21618
+ return !this._enable;
21619
+ },
21620
+ enumerable: false,
21621
+ configurable: true
21622
+ });
21623
+ AppForm.prototype.disable = function (opts) {
21624
+ var _a;
21625
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.disable(opts);
21626
+ if (this._enable) {
21627
+ this._enable = false;
21628
+ if (!opts || opts.emitEvent !== true)
21629
+ this.markForCheck();
21630
+ }
21631
+ };
21632
+ AppForm.prototype.enable = function (opts) {
21633
+ var _a;
21634
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.enable(opts);
21635
+ if (!this._enable) {
21636
+ this._enable = true;
21637
+ if (!opts || opts.emitEvent !== true)
21638
+ this.markForCheck();
21639
+ }
21640
+ };
21641
+ Object.defineProperty(AppForm.prototype, "form", {
21642
+ get: function () {
21643
+ return this._form;
21644
+ },
21645
+ set: function (value) {
21646
+ this.setForm(value);
21647
+ },
21648
+ enumerable: false,
21649
+ configurable: true
21650
+ });
21651
+ AppForm.prototype.ngOnInit = function () {
21652
+ this._enable ? this.enable() : this.disable();
21653
+ this.errorTranslatorOptions = this.errorTranslatorOptions || {
21654
+ controlPathTranslator: this
21655
+ };
21656
+ };
21657
+ AppForm.prototype.ngOnDestroy = function () {
21658
+ this._subscription.unsubscribe();
21659
+ this.readySubject.unsubscribe();
21660
+ this.loadingSubject.unsubscribe();
21661
+ this.errorSubject.unsubscribe();
21662
+ this.onCancel.unsubscribe();
21663
+ this.onSubmit.unsubscribe();
21664
+ };
21665
+ AppForm.prototype.cancel = function () {
21666
+ return __awaiter(this, void 0, void 0, function () {
21667
+ return __generator(this, function (_b) {
21668
+ this.onCancel.emit();
21669
+ return [2 /*return*/];
21670
+ });
21671
+ });
21672
+ };
21673
+ /**
21674
+ *
21675
+ * @param event
21676
+ * @param opts allow to skip validation check, using {checkValid: false}
21677
+ */
21678
+ AppForm.prototype.doSubmit = function (event, opts) {
21679
+ return __awaiter(this, void 0, void 0, function () {
21680
+ return __generator(this, function (_b) {
21681
+ switch (_b.label) {
21682
+ case 0:
21683
+ if (!this._form) {
21684
+ this.markAllAsTouched({ emitEvent: true });
21685
+ return [2 /*return*/];
21686
+ }
21687
+ if (!((!opts || opts.checkValid !== false) && !this._form.valid)) return [3 /*break*/, 2];
21688
+ // Wait validation end
21689
+ return [4 /*yield*/, AppFormUtils.waitWhilePending(this._form)];
21690
+ case 1:
21691
+ // Wait validation end
21692
+ _b.sent();
21693
+ // Form is invalid: exit (+ log if debug)
21694
+ if (this._form.invalid) {
21695
+ this.markAllAsTouched({ emitEvent: true });
21696
+ if (this.debug)
21697
+ AppFormUtils.logFormErrors(this._form);
21698
+ return [2 /*return*/];
21699
+ }
21700
+ _b.label = 2;
21701
+ case 2:
21702
+ // Emit event
21703
+ this.onSubmit.emit(event);
21704
+ return [2 /*return*/];
21705
+ }
21706
+ });
21707
+ });
21708
+ };
21709
+ AppForm.prototype.setForm = function (form) {
21710
+ var _this = this;
21711
+ if (this._form !== form) {
21712
+ this._form = form;
21713
+ this._subscription.add(this._form.statusChanges.subscribe(function (status) { return _this.markForCheck(); }));
21714
+ }
21715
+ };
21716
+ AppForm.prototype.setValue = function (data, opts) {
21717
+ if (!data) {
21718
+ console.warn('[form] Trying to set an empty value to form. Skipping');
21719
+ return;
21720
+ }
21721
+ // DEBUG
21722
+ //if (this.debug) console.debug('[form] Updating form (using entity)', data);
21723
+ // Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
21724
+ AppFormUtils.copyEntity2Form(data, this.form, Object.assign({ emitEvent: false, onlySelf: true }, opts));
21725
+ if (!opts || opts.emitEvent !== true) {
21726
+ this.markForCheck();
21727
+ }
21728
+ };
21729
+ AppForm.prototype.reset = function (data, opts) {
21730
+ if (data) {
21731
+ if (this.debug)
21732
+ console.debug('[form] Resetting form (using entity)', data);
21733
+ // Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
21734
+ var json = AppFormUtils.getFormValueFromEntity(data, this.form);
21735
+ this.form.reset(json, { emitEvent: false, onlySelf: true });
21736
+ }
21737
+ else {
21738
+ this.form.reset(null, { emitEvent: false, onlySelf: true });
21739
+ }
21740
+ if (!opts || opts.emitEvent !== true)
21741
+ this.markForCheck();
21742
+ };
21743
+ AppForm.prototype.markAsPristine = function (opts) {
21744
+ this.form.markAsPristine(opts);
21745
+ if (!opts || opts.emitEvent !== false)
21746
+ this.markForCheck();
21747
+ };
21748
+ AppForm.prototype.markAsUntouched = function (opts) {
21749
+ this.form.markAsUntouched(opts);
21750
+ if (!opts || opts.emitEvent !== false)
21751
+ this.markForCheck();
21752
+ };
21753
+ /**
21754
+ * @deprecated prefer to use markAllAsTouched()
21755
+ * @param opts
21756
+ */
21757
+ AppForm.prototype.markAsTouched = function (opts) {
21758
+ // this.form.markAllAsTouched() // This is not working well (e.g. in TripForm)
21759
+ console.warn('TODO: Replace this call by markAllAsTouched() - because of changes in ngx-components >= 0.16.0');
21760
+ AppFormUtils.markAsTouched(this.form, opts);
21761
+ if (!opts || opts.emitEvent !== false)
21762
+ this.markForCheck();
21763
+ };
21764
+ AppForm.prototype.markAllAsTouched = function (opts) {
21765
+ // this.form.markAllAsTouched() // This is not working well (e.g. in TripForm)
21766
+ AppFormUtils.markAllAsTouched(this.form, opts);
21767
+ if (!opts || opts.emitEvent !== false)
21768
+ this.markForCheck();
21769
+ };
21770
+ AppForm.prototype.markAsDirty = function (opts) {
21771
+ this.form.markAsDirty(opts);
21772
+ if (!opts || opts.emitEvent !== false)
21773
+ this.markForCheck();
21774
+ };
21775
+ AppForm.prototype.markAsLoading = function (opts) {
21776
+ this.setLoading(true, opts);
21777
+ };
21778
+ AppForm.prototype.markAsLoaded = function (opts) {
21779
+ this.setLoading(false, opts);
21780
+ };
21781
+ AppForm.prototype.markAsReady = function (opts) {
21782
+ if (this.readySubject.value !== true) {
21783
+ this.readySubject.next(true);
21784
+ // If subclasses implements OnReady
21785
+ if (typeof this['ngOnReady'] === 'function') {
21786
+ this.ngOnReady();
21787
+ }
21788
+ }
21789
+ };
21790
+ /**
21791
+ * Wait form is ready
21792
+ * @param opts
21793
+ */
21794
+ AppForm.prototype.ready = function (opts) {
21795
+ if (this.readySubject.value)
21796
+ return Promise.resolve();
21797
+ return waitForTrue(this.readySubject, opts);
21798
+ };
21799
+ /**
21800
+ * Wait form is not busy (=loaded)
21801
+ * @param opts
21802
+ */
21803
+ AppForm.prototype.waitIdle = function (opts) {
21804
+ if (!this.loadingSubject.value)
21805
+ return Promise.resolve();
21806
+ return waitForFalse(this.loadingSubject, opts);
21807
+ };
21808
+ AppForm.prototype.updateValueAndValidity = function (opts) {
21809
+ AppFormUtils.updateValueAndValidity(this.form, opts);
21810
+ if (!opts || opts.emitEvent !== false)
21811
+ this.markForCheck();
21812
+ };
21813
+ AppForm.prototype.translateControlPath = function (path) {
21814
+ var _a;
21815
+ var i18nFieldName = this.getI18nFieldName(path);
21816
+ return ((_a = this.translate) === null || _a === void 0 ? void 0 : _a.instant(i18nFieldName)) || i18nFieldName;
21817
+ };
21818
+ /* -- protected methods -- */
21819
+ AppForm.prototype.getFormError = function (form, opts) {
21820
+ if (!form || !this.errorTranslator)
21821
+ return undefined;
21822
+ return this.errorTranslator.translateFormErrors(this.form, Object.assign({ controlPathTranslator: this }, opts));
21823
+ };
21824
+ AppForm.prototype.getI18nFieldName = function (path) {
21825
+ return (this.i18nFieldPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
21826
+ };
21827
+ AppForm.prototype.registerSubscription = function (sub) {
21828
+ return this._subscription.add(sub);
21829
+ };
21830
+ AppForm.prototype.unregisterSubscription = function (sub) {
21831
+ this._subscription.remove(sub);
21832
+ };
21833
+ AppForm.prototype.registerAutocompleteField = function (fieldName, opts) {
21834
+ return this.autocompleteHelper.add(fieldName, opts);
21835
+ };
21836
+ AppForm.prototype.setError = function (value, opts) {
21837
+ if (this.errorSubject.value !== value) {
21838
+ this.errorSubject.next(value);
21839
+ if (!opts || opts.emitEvent !== false) {
21840
+ this.markForCheck();
21841
+ }
21842
+ }
21843
+ };
21844
+ AppForm.prototype.markForCheck = function () {
21845
+ // Should be overwritten by subclasses
21846
+ console.warn('markForCheck() has been called, but is not overwritten by component ' + this.constructor.name);
21847
+ };
21848
+ /* -- private function -- */
21849
+ AppForm.prototype.setLoading = function (value, opts) {
21850
+ if (this.loadingSubject.value !== value) {
21851
+ this.loadingSubject.next(value);
21852
+ if (!opts || opts.emitEvent !== false) {
21853
+ this.markForCheck();
21854
+ }
21855
+ }
21856
+ };
21857
+ return AppForm;
21858
+ }());
21859
+ AppForm.decorators = [
21860
+ { type: i0.Directive }
21861
+ ];
21862
+ AppForm.ctorParameters = function () { return [
21863
+ { type: i0.Injector },
21864
+ { type: i1.FormGroup }
21865
+ ]; };
21866
+ AppForm.propDecorators = {
21867
+ debug: [{ type: i0.Input }],
21868
+ tabindex: [{ type: i0.Input }],
21869
+ errorTranslatorOptions: [{ type: i0.Input }],
21870
+ form: [{ type: i0.Input }],
21871
+ onCancel: [{ type: i0.Output }],
21872
+ onSubmit: [{ type: i0.Output }]
21873
+ };
21874
+
21543
21875
  var AuthForm = /** @class */ (function (_super) {
21544
21876
  __extends(AuthForm, _super);
21545
21877
  function AuthForm(injector, platform, formBuilder, settings, configService, modalCtrl, network, cd, environment) {
@@ -24893,6 +25225,190 @@
24893
25225
  },] }
24894
25226
  ];
24895
25227
 
25228
+ var TextPopover = /** @class */ (function () {
25229
+ function TextPopover(popoverController, translate) {
25230
+ this.popoverController = popoverController;
25231
+ this.translate = translate;
25232
+ this.placeholder = '';
25233
+ this.editing = true;
25234
+ this.multiline = true;
25235
+ this.maxLength = 2000;
25236
+ this.autofocus = false;
25237
+ this.subscription = new rxjs.Subscription();
25238
+ }
25239
+ Object.defineProperty(TextPopover.prototype, "disabled", {
25240
+ get: function () {
25241
+ return this.form.disabled;
25242
+ },
25243
+ enumerable: false,
25244
+ configurable: true
25245
+ });
25246
+ Object.defineProperty(TextPopover.prototype, "enabled", {
25247
+ get: function () {
25248
+ return this.form.enabled;
25249
+ },
25250
+ enumerable: false,
25251
+ configurable: true
25252
+ });
25253
+ Object.defineProperty(TextPopover.prototype, "valid", {
25254
+ get: function () {
25255
+ var _a;
25256
+ return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.valid) || false;
25257
+ },
25258
+ enumerable: false,
25259
+ configurable: true
25260
+ });
25261
+ Object.defineProperty(TextPopover.prototype, "value", {
25262
+ get: function () {
25263
+ var _a;
25264
+ return (_a = this.form) === null || _a === void 0 ? void 0 : _a.value.text;
25265
+ },
25266
+ enumerable: false,
25267
+ configurable: true
25268
+ });
25269
+ TextPopover.prototype.ngOnInit = function () {
25270
+ this.enable();
25271
+ };
25272
+ TextPopover.prototype.ngAfterViewInit = function () {
25273
+ var _this = this;
25274
+ setTimeout(function () { return _this.form.setValue({ text: _this.text }); }, 0);
25275
+ };
25276
+ TextPopover.prototype.onValidate = function (event) {
25277
+ return __awaiter(this, void 0, void 0, function () {
25278
+ var value, err_1;
25279
+ return __generator(this, function (_b) {
25280
+ switch (_b.label) {
25281
+ case 0: return [4 /*yield*/, waitWhilePending(this.form)];
25282
+ case 1:
25283
+ _b.sent();
25284
+ if (!this.valid) {
25285
+ logFormErrors(this.form.control);
25286
+ return [2 /*return*/];
25287
+ }
25288
+ _b.label = 2;
25289
+ case 2:
25290
+ _b.trys.push([2, 4, , 5]);
25291
+ value = this.value;
25292
+ this.disable();
25293
+ return [4 /*yield*/, this.popoverController.dismiss(value)];
25294
+ case 3:
25295
+ _b.sent();
25296
+ this.form.error = null;
25297
+ return [3 /*break*/, 5];
25298
+ case 4:
25299
+ err_1 = _b.sent();
25300
+ this.form.error = (err_1 && err_1.message) || err_1;
25301
+ this.enable();
25302
+ return [3 /*break*/, 5];
25303
+ case 5: return [2 /*return*/];
25304
+ }
25305
+ });
25306
+ });
25307
+ };
25308
+ TextPopover.prototype.disable = function () {
25309
+ this.form.disable();
25310
+ };
25311
+ TextPopover.prototype.enable = function () {
25312
+ if (this.editing)
25313
+ this.form.enable();
25314
+ };
25315
+ TextPopover.prototype.cancel = function () {
25316
+ this.popoverController.dismiss();
25317
+ };
25318
+ TextPopover.prototype.ngOnDestroy = function () {
25319
+ this.subscription.unsubscribe();
25320
+ };
25321
+ return TextPopover;
25322
+ }());
25323
+ TextPopover.decorators = [
25324
+ { type: i0.Component, args: [{
25325
+ selector: 'app-text-popover',
25326
+ template: "\n<ion-content class=\"ion-padding\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <ion-item *ngIf=\"form.error\" visible-xs visible-sm visible-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"form.error|translate\"></ion-label>\n </ion-item>\n\n <app-text-form #form [placeholder]=\"placeholder\"\n [multiline]=\"multiline\"\n [maxLength]=\"maxLength\"\n [autofocus]=\"editing && autofocus\"\n (onSubmit)=\"onValidate($event)\"\n ></app-text-form>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n\n </ion-col>\n\n <ion-col size=\"auto\">\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"cancel()\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n <ion-button\n [fill]=\"disabled ? 'clear' : 'solid'\"\n (click)=\"onValidate($event)\"\n (keyup.enter)=\"onValidate($event)\"\n color=\"tertiary\"\n [disabled]=\"disabled\"\n [title]=\"'COMMON.BTN_VALIDATE_WITH_SHORTCUT_HELP'|translate\">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n"
25327
+ },] }
25328
+ ];
25329
+ TextPopover.ctorParameters = function () { return [
25330
+ { type: i1$5.PopoverController },
25331
+ { type: i1$2.TranslateService }
25332
+ ]; };
25333
+ TextPopover.propDecorators = {
25334
+ form: [{ type: i0.ViewChild, args: ['form', { static: true },] }],
25335
+ text: [{ type: i0.Input }],
25336
+ placeholder: [{ type: i0.Input }],
25337
+ editing: [{ type: i0.Input }],
25338
+ multiline: [{ type: i0.Input }],
25339
+ maxLength: [{ type: i0.Input }],
25340
+ autofocus: [{ type: i0.Input }]
25341
+ };
25342
+
25343
+ var TextForm = /** @class */ (function (_super) {
25344
+ __extends(TextForm, _super);
25345
+ function TextForm(injector, cd, formBuilder) {
25346
+ var _this = _super.call(this, injector) || this;
25347
+ _this.injector = injector;
25348
+ _this.cd = cd;
25349
+ _this.formBuilder = formBuilder;
25350
+ _this.showError = true;
25351
+ _this.multiline = true;
25352
+ _this.autoHeight = false;
25353
+ _this.maxLength = 2000;
25354
+ _this.autofocus = false;
25355
+ _this.textAreaChanges = new i0.EventEmitter();
25356
+ return _this;
25357
+ }
25358
+ TextForm.prototype.ngOnInit = function () {
25359
+ var form = this.formBuilder.group({
25360
+ text: [null, isNotNil(this.maxLength)
25361
+ ? i1.Validators.maxLength(this.maxLength)
25362
+ : undefined
25363
+ ]
25364
+ });
25365
+ this.control = form.get('text');
25366
+ this.setForm(form);
25367
+ _super.prototype.ngOnInit.call(this);
25368
+ };
25369
+ TextForm.prototype.textAreaChanged = function (event) {
25370
+ this.textAreaChanges.emit(this.control.value);
25371
+ };
25372
+ TextForm.prototype.containerResize = function () {
25373
+ var _a;
25374
+ (_a = this.autosizeDirective) === null || _a === void 0 ? void 0 : _a.resizeToFitContent(true);
25375
+ };
25376
+ TextForm.prototype.focusInput = function () {
25377
+ if (this.textArea)
25378
+ focusInput(this.textArea);
25379
+ if (this.textInput)
25380
+ focusInput(this.textInput);
25381
+ };
25382
+ TextForm.prototype.markForCheck = function () {
25383
+ this.cd.markForCheck();
25384
+ };
25385
+ return TextForm;
25386
+ }(AppForm));
25387
+ TextForm.decorators = [
25388
+ { type: i0.Component, args: [{
25389
+ selector: 'app-text-form',
25390
+ template: "<form class=\"form-container\" [formGroup]=\"form\" (ngSubmit)=\"doSubmit($event)\">\n <mat-form-field *ngIf=\"multiline; else monoline\">\n <textarea\n #textArea\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"control.disabled\"\n [class.fixed-height]=\"!autoHeight\"\n [cdkTextareaAutosize]=\"autoHeight\"\n (keyup)=\"textAreaChanged($event)\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n [autofocus]=\"autofocus\"\n ></textarea>\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textArea.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n <ng-template #monoline>\n <mat-form-field>\n <input\n #textInput\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"disabled\"\n [appAutofocus]=\"autofocus\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n />\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textInput.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n </ng-template>\n</form>\n",
25391
+ styles: ["textarea.fixed-height{height:11.5em}"]
25392
+ },] }
25393
+ ];
25394
+ TextForm.ctorParameters = function () { return [
25395
+ { type: i0.Injector },
25396
+ { type: i0.ChangeDetectorRef },
25397
+ { type: i1.FormBuilder }
25398
+ ]; };
25399
+ TextForm.propDecorators = {
25400
+ showError: [{ type: i0.Input }],
25401
+ placeholder: [{ type: i0.Input }],
25402
+ multiline: [{ type: i0.Input }],
25403
+ autoHeight: [{ type: i0.Input }],
25404
+ maxLength: [{ type: i0.Input }],
25405
+ autofocus: [{ type: i0.Input }],
25406
+ textAreaChanges: [{ type: i0.Output }],
25407
+ textArea: [{ type: i0.ViewChild, args: ['textArea',] }],
25408
+ textInput: [{ type: i0.ViewChild, args: ['textInput',] }],
25409
+ autosizeDirective: [{ type: i0.ViewChild, args: [textField.CdkTextareaAutosize,] }]
25410
+ };
25411
+
24896
25412
  var AppUpdateOfflineModeCard = /** @class */ (function () {
24897
25413
  function AppUpdateOfflineModeCard() {
24898
25414
  this.onUpdateClick = new i0.EventEmitter();
@@ -25889,7 +26405,8 @@
25889
26405
  this.asyncCreateNew(insertAt);
25890
26406
  };
25891
26407
  EntitiesTableDataSource.prototype.connect = function (collectionViewer) {
25892
- // DEBUG console.debug("[entities-datasource] connect");
26408
+ // DEBUG
26409
+ //console.debug("[entities-datasource] connect");
25893
26410
  return _super_1.prototype.connect.call(this, collectionViewer);
25894
26411
  };
25895
26412
  EntitiesTableDataSource.prototype.disconnect = function (collectionViewer) {
@@ -30336,7 +30853,7 @@
30336
30853
  var _this = this;
30337
30854
  return __generator(this, function (_b) {
30338
30855
  switch (_b.label) {
30339
- case 0: return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30856
+ case 0: return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value); }))];
30340
30857
  case 1:
30341
30858
  data = _b.sent();
30342
30859
  if (now) {
@@ -30397,7 +30914,7 @@
30397
30914
  })];
30398
30915
  case 1:
30399
30916
  res = _b.sent();
30400
- return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30917
+ return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value); }))];
30401
30918
  case 2:
30402
30919
  data = _b.sent();
30403
30920
  if (now)
@@ -30420,6 +30937,22 @@
30420
30937
  });
30421
30938
  });
30422
30939
  };
30940
+ AbstractUserEventService.prototype.load = function (id, opts) {
30941
+ return __awaiter(this, void 0, void 0, function () {
30942
+ var filter, data;
30943
+ return __generator(this, function (_b) {
30944
+ switch (_b.label) {
30945
+ case 0:
30946
+ filter = this.defaultFilter();
30947
+ filter.includedIds = [id];
30948
+ return [4 /*yield*/, this.loadPage({ offset: 0, size: 1 }, filter, opts)];
30949
+ case 1:
30950
+ data = (_b.sent()).data;
30951
+ return [2 /*return*/, data && data[0]];
30952
+ }
30953
+ });
30954
+ });
30955
+ };
30423
30956
  AbstractUserEventService.prototype.add = function (entity) {
30424
30957
  return __awaiter(this, void 0, void 0, function () {
30425
30958
  var withContent;
@@ -30427,7 +30960,6 @@
30427
30960
  switch (_b.label) {
30428
30961
  case 0: return [4 /*yield*/, this.processUserEvent(entity)];
30429
30962
  case 1:
30430
- // TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
30431
30963
  entity = _b.sent();
30432
30964
  if (!entity)
30433
30965
  return [2 /*return*/]; // Rejected
@@ -30439,7 +30971,9 @@
30439
30971
  });
30440
30972
  // Update count
30441
30973
  this._countSubject.next(this._countSubject.value + 1);
30442
- return [2 /*return*/];
30974
+ // Add id
30975
+ console.log('TODO: add an ID to user event ?');
30976
+ return [2 /*return*/, entity];
30443
30977
  }
30444
30978
  });
30445
30979
  });
@@ -30547,7 +31081,7 @@
30547
31081
  });
30548
31082
  }
30549
31083
  if (!(!opts || opts.toEntity !== false)) return [3 /*break*/, 2];
30550
- return [4 /*yield*/, Promise.all((data || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
31084
+ return [4 /*yield*/, Promise.all((data || []).map(function (value) { return _this.processUserEvent(value); }))];
30551
31085
  case 1: return [2 /*return*/, _b.sent()];
30552
31086
  case 2: return [2 /*return*/, data];
30553
31087
  }
@@ -30801,16 +31335,15 @@
30801
31335
  (_a = this._listenSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
30802
31336
  this._listenSubscription = undefined;
30803
31337
  };
30804
- AbstractUserEventService.prototype.processUserEvent = function (source, that) {
31338
+ AbstractUserEventService.prototype.processUserEvent = function (source) {
30805
31339
  return __awaiter(this, void 0, void 0, function () {
30806
31340
  var target, listeners, listeners_1, listeners_1_1, listener, res, _b, e_3_1;
30807
31341
  var e_3, _c;
30808
31342
  return __generator(this, function (_d) {
30809
31343
  switch (_d.label) {
30810
31344
  case 0:
30811
- that = that || this;
30812
- target = that.fromObject(source);
30813
- listeners = (that.listeners || [])
31345
+ target = this.fromObject(source);
31346
+ listeners = (this.listeners || [])
30814
31347
  .filter(function (listener) { return !!listener.onReceived; })
30815
31348
  .filter(function (listener) { return listener.accept(target); });
30816
31349
  _d.label = 1;
@@ -30835,8 +31368,8 @@
30835
31368
  target = _b;
30836
31369
  return [3 /*break*/, 7];
30837
31370
  case 6:
30838
- if (that._debug)
30839
- console.debug(that._logPrefix + "Event has been rejected by a listener", source);
31371
+ if (this._debug)
31372
+ console.debug(this._logPrefix + "Event has been rejected by a listener", source);
30840
31373
  return [3 /*break*/, 8];
30841
31374
  case 7:
30842
31375
  listeners_1_1 = listeners_1.next();
@@ -30870,8 +31403,8 @@
30870
31403
  return [2 /*return*/];
30871
31404
  // set read date
30872
31405
  userEvents.forEach(function (userEvent) { return userEvent.readDate = moment$6(); });
30873
- localEntities = userEvents.filter(function (userEvent) { return !userEvent.id || userEvent.id < 0; });
30874
- remoteEntities = userEvents.filter(function (userEvent) { return userEvent.id > 0; });
31406
+ localEntities = userEvents.filter(EntityUtils.isLocal);
31407
+ remoteEntities = userEvents.filter(EntityUtils.isRemote);
30875
31408
  // save local entities
30876
31409
  if (localEntities.length) {
30877
31410
  if (this._debug)
@@ -30910,9 +31443,6 @@
30910
31443
  recipients: [this.defaultRecipient()]
30911
31444
  };
30912
31445
  };
30913
- AbstractUserEventService.prototype.defaultRecipient = function () {
30914
- return this.accountService.person.pubkey;
30915
- };
30916
31446
  AbstractUserEventService.prototype.fillDefaultProperties = function (entity) {
30917
31447
  };
30918
31448
  AbstractUserEventService.prototype.unreadEvents = function (events) {
@@ -31605,7 +32135,7 @@
31605
32135
  _this.environment = environment;
31606
32136
  _this._logPrefix = '[job-progression-service] ';
31607
32137
  // For DEV only
31608
- _this._debug = !(environment === null || environment === void 0 ? void 0 : environment.production);
32138
+ _this._debug = environment && !environment.production;
31609
32139
  return _this;
31610
32140
  }
31611
32141
  JobProgressionService.prototype.listenChanges = function (id, options) {
@@ -33551,8 +34081,167 @@
33551
34081
  },] }
33552
34082
  ];
33553
34083
 
34084
+ // @dynamic
34085
+ exports.ImageAttachment = /** @class */ (function (_super) {
34086
+ __extends(ImageAttachment, _super);
34087
+ function ImageAttachment() {
34088
+ var _this = _super.apply(this, __spread(arguments)) || this;
34089
+ _this.dataUrl = null;
34090
+ _this.url = null;
34091
+ _this.title = null;
34092
+ return _this;
34093
+ }
34094
+ ImageAttachment.prototype.fromObject = function (source, opts) {
34095
+ _super.prototype.fromObject.call(this, source, opts);
34096
+ this.url = source.url;
34097
+ this.dataUrl = source.dataUrl;
34098
+ this.title = source.title;
34099
+ };
34100
+ return ImageAttachment;
34101
+ }(Entity));
34102
+ exports.ImageAttachment = __decorate([
34103
+ EntityClass({ typename: 'ImageAttachmentVO' })
34104
+ ], exports.ImageAttachment);
34105
+ // @dynamic
34106
+ exports.ImageAttachmentFilter = /** @class */ (function (_super) {
34107
+ __extends(ImageAttachmentFilter, _super);
34108
+ function ImageAttachmentFilter() {
34109
+ return _super !== null && _super.apply(this, arguments) || this;
34110
+ }
34111
+ return ImageAttachmentFilter;
34112
+ }(EntityFilter));
34113
+ exports.ImageAttachmentFilter = __decorate([
34114
+ EntityClass({ typename: 'ImageAttachmentFilterVO' })
34115
+ ], exports.ImageAttachmentFilter);
34116
+ var ImageAttachmentService = /** @class */ (function (_super) {
34117
+ __extends(ImageAttachmentService, _super);
34118
+ function ImageAttachmentService(platform) {
34119
+ var _this = _super.call(this, platform) || this;
34120
+ _this.platform = platform;
34121
+ _this.$images = new rxjs.BehaviorSubject([
34122
+ { id: 0, url: 'https://test.sumaris.net/assets/img/bg/ray-1.jpg', title: 'ray #1' },
34123
+ { id: 1, url: 'https://test.sumaris.net/assets/img/bg/ray-2.jpg', title: 'ray #2' }
34124
+ ]);
34125
+ console.debug('[gallery-testing-service] Create service');
34126
+ return _this;
34127
+ }
34128
+ ImageAttachmentService.prototype.ngOnStart = function () {
34129
+ return Promise.resolve(undefined);
34130
+ };
34131
+ ImageAttachmentService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34132
+ console.debug('[gallery-testing-service] Watching images...');
34133
+ return this.$images
34134
+ .pipe(operators.map(function (images) {
34135
+ var data = (images || []).map(exports.ImageAttachment.fromObject);
34136
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34137
+ console.debug("[gallery-testing-service] Loaded " + data.length + " images...");
34138
+ return { data: data, total: data.length };
34139
+ }));
34140
+ };
34141
+ ImageAttachmentService.prototype.saveAll = function (entities, opts) {
34142
+ return __awaiter(this, void 0, void 0, function () {
34143
+ var currentId;
34144
+ return __generator(this, function (_a) {
34145
+ if (!entities)
34146
+ return [2 /*return*/, []];
34147
+ currentId = this.$images.value.reduce(function (res, image) { return Math.max(res, +(image === null || image === void 0 ? void 0 : image.id) || 0); }, 0);
34148
+ entities.filter(function (item) { return isNil(item.id); })
34149
+ .forEach(function (item) {
34150
+ item.id = ++currentId;
34151
+ });
34152
+ this.$images.next(__spread(this.$images.value, entities));
34153
+ return [2 /*return*/];
34154
+ });
34155
+ });
34156
+ };
34157
+ ImageAttachmentService.prototype.deleteAll = function (entities, opts) {
34158
+ return __awaiter(this, void 0, void 0, function () {
34159
+ var deletedIds, filteredData;
34160
+ return __generator(this, function (_a) {
34161
+ deletedIds = (entities || []).map(function (item) { return item.id; }).filter(isNotNil);
34162
+ filteredData = (this.$images.value).filter(function (item) { return !deletedIds.includes(item.id); });
34163
+ this.$images.next(filteredData);
34164
+ return [2 /*return*/];
34165
+ });
34166
+ });
34167
+ };
34168
+ ImageAttachmentService.prototype.asFilter = function (filter) {
34169
+ return exports.ImageAttachmentFilter.fromObject(filter);
34170
+ };
34171
+ return ImageAttachmentService;
34172
+ }(StartableService));
34173
+ ImageAttachmentService.decorators = [
34174
+ { type: i0.Injectable }
34175
+ ];
34176
+ ImageAttachmentService.ctorParameters = function () { return [
34177
+ { type: i1$5.Platform }
34178
+ ]; };
34179
+
34180
+ var GalleryTestPage = /** @class */ (function () {
34181
+ function GalleryTestPage(dataService) {
34182
+ this.dataService = dataService;
34183
+ this._subscription = new rxjs.Subscription();
34184
+ this.dataSource = new EntitiesTableDataSource(exports.ImageAttachment, this.dataService);
34185
+ }
34186
+ GalleryTestPage.prototype.ngOnInit = function () {
34187
+ this._subscription.add(this.dataSource.watchAll(0, 100, null, null, null)
34188
+ .subscribe());
34189
+ };
34190
+ GalleryTestPage.prototype.ngOnDestroy = function () {
34191
+ this._subscription.unsubscribe();
34192
+ };
34193
+ return GalleryTestPage;
34194
+ }());
34195
+ GalleryTestPage.decorators = [
34196
+ { type: i0.Component, args: [{
34197
+ selector: 'app-gallery-test-page',
34198
+ template: "<ion-header>\n <ion-toolbar color=\"primary\">\n\n <ion-buttons slot=\"start\">\n <ion-back-button></ion-back-button>\n </ion-buttons>\n\n <ion-title>Image gallery</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content>\n <app-image-gallery [dataSource]=\"dataSource\">\n </app-image-gallery>\n</ion-content>\n",
34199
+ providers: [
34200
+ { provide: ImageAttachmentService, useClass: ImageAttachmentService }
34201
+ ]
34202
+ },] }
34203
+ ];
34204
+ GalleryTestPage.ctorParameters = function () { return [
34205
+ { type: ImageAttachmentService }
34206
+ ]; };
34207
+
34208
+ var routes$4 = [
34209
+ {
34210
+ path: 'gallery',
34211
+ pathMatch: 'full',
34212
+ component: GalleryTestPage
34213
+ },
34214
+ ];
34215
+ var ImageGalleryTestingModule = /** @class */ (function () {
34216
+ function ImageGalleryTestingModule() {
34217
+ }
34218
+ return ImageGalleryTestingModule;
34219
+ }());
34220
+ ImageGalleryTestingModule.decorators = [
34221
+ { type: i0.NgModule, args: [{
34222
+ imports: [
34223
+ i1$4.CommonModule,
34224
+ i1$5.IonicModule,
34225
+ ImageGalleryModule,
34226
+ i1$2.TranslateModule.forChild(),
34227
+ i3.RouterModule.forChild(routes$4),
34228
+ i1$2.TranslateModule.forChild(),
34229
+ ],
34230
+ declarations: [
34231
+ // Components
34232
+ GalleryTestPage
34233
+ ],
34234
+ exports: [
34235
+ i3.RouterModule,
34236
+ // Components
34237
+ GalleryTestPage
34238
+ ]
34239
+ },] }
34240
+ ];
34241
+
33554
34242
  var SHARED_TESTING_PAGES = __spread(SHARED_MATERIAL_TESTING_PAGES, [
33555
34243
  { label: 'Shared other components', divider: true },
34244
+ { label: 'Image gallery', page: '/testing/shared/gallery' },
33556
34245
  { label: 'Toast', page: '/testing/shared/toast' },
33557
34246
  { label: 'File upload', page: '/testing/shared/upload-file' }
33558
34247
  ]);
@@ -33565,17 +34254,20 @@
33565
34254
  { type: i0.NgModule, args: [{
33566
34255
  imports: [
33567
34256
  i1$4.CommonModule,
34257
+ i1$5.IonicModule,
33568
34258
  i1$2.TranslateModule.forChild(),
33569
34259
  // Testing sub-modules
33570
34260
  MaterialTestingModule,
33571
34261
  ToastTestingModule,
33572
- UploadFileTestingModule
34262
+ UploadFileTestingModule,
34263
+ ImageGalleryTestingModule
33573
34264
  ],
33574
34265
  exports: [
33575
34266
  // Testing sub-modules
33576
34267
  MaterialTestingModule,
33577
34268
  ToastTestingModule,
33578
- UploadFileTestingModule
34269
+ UploadFileTestingModule,
34270
+ ImageGalleryTestingModule
33579
34271
  ]
33580
34272
  },] }
33581
34273
  ];
@@ -33963,7 +34655,7 @@
33963
34655
  { type: i1$5.PopoverController }
33964
34656
  ]; };
33965
34657
 
33966
- var routes$4 = [
34658
+ var routes$5 = [
33967
34659
  {
33968
34660
  path: 'text-popover',
33969
34661
  pathMatch: 'full',
@@ -33981,7 +34673,7 @@
33981
34673
  i1$4.CommonModule,
33982
34674
  i1$5.IonicModule,
33983
34675
  i1$2.TranslateModule.forChild(),
33984
- i3.RouterModule.forChild(routes$4)
34676
+ i3.RouterModule.forChild(routes$5)
33985
34677
  ],
33986
34678
  declarations: [
33987
34679
  TextPopoverTestingPage
@@ -33998,7 +34690,7 @@
33998
34690
  { label: 'Table', page: '/testing/core/table' },
33999
34691
  { label: 'Text popover', page: '/testing/core/text-popover' }
34000
34692
  ];
34001
- var routes$5 = [
34693
+ var routes$6 = [
34002
34694
  {
34003
34695
  path: '',
34004
34696
  pathMatch: 'full',
@@ -34025,7 +34717,7 @@
34025
34717
  imports: [
34026
34718
  i1$4.CommonModule,
34027
34719
  i1$2.TranslateModule.forChild(),
34028
- i3.RouterModule.forChild(routes$5),
34720
+ i3.RouterModule.forChild(routes$6),
34029
34721
  // Sub modules
34030
34722
  TableTestingModule,
34031
34723
  TextPopoverTestingModule
@@ -34202,6 +34894,7 @@
34202
34894
  this.recipients = source.recipients || [];
34203
34895
  this.startDate = fromDateISOString(source.startDate);
34204
34896
  this.excludeRead = source.excludeRead || false;
34897
+ this.includedIds = source.includedIds || [];
34205
34898
  };
34206
34899
  UserEventTestFilter.prototype.buildFilter = function () {
34207
34900
  var _this = this;
@@ -34221,6 +34914,9 @@
34221
34914
  if (isNotNil(this.startDate)) {
34222
34915
  filterFns.push(function (t) { return _this.startDate.isSameOrBefore(t.creationDate); });
34223
34916
  }
34917
+ if (isNotEmptyArray(this.includedIds)) {
34918
+ filterFns.push(function (t) { return _this.includedIds.includes(t.id); });
34919
+ }
34224
34920
  if (this.excludeRead === true) {
34225
34921
  filterFns.push(function (t) { return isNil(t.readSignature); }); // todo or t.signature ?
34226
34922
  }
@@ -34272,7 +34968,7 @@
34272
34968
  ], this.$userEvents.value));
34273
34969
  this._countSubject.next((this._countSubject.value || 0) + 1);
34274
34970
  this.$newUserEvents.next([entity]);
34275
- return [2 /*return*/];
34971
+ return [2 /*return*/, entity];
34276
34972
  }
34277
34973
  });
34278
34974
  });
@@ -34335,6 +35031,9 @@
34335
35031
  });
34336
35032
  });
34337
35033
  };
35034
+ UserEventTestService.prototype.defaultRecipient = function () {
35035
+ return this.accountService.isLogin() ? this.accountService.person.pubkey : undefined;
35036
+ };
34338
35037
  UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34339
35038
  var _this = this;
34340
35039
  return this.$userEvents.pipe(operators.map(function (userEvents) {
@@ -34377,7 +35076,7 @@
34377
35076
  { type: AccountService },
34378
35077
  { type: NetworkService },
34379
35078
  { type: i1$2.TranslateService },
34380
- { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
35079
+ { type: Environment, decorators: [{ type: i0.Inject, args: [ENVIRONMENT,] }] }
34381
35080
  ]; };
34382
35081
 
34383
35082
  var moment$a = momentImported__namespace;
@@ -34637,7 +35336,7 @@
34637
35336
  { label: 'User event', page: '/testing/social/user-event' },
34638
35337
  { label: 'Job progression', page: '/testing/social/job-progression' }
34639
35338
  ];
34640
- var routes$6 = [
35339
+ var routes$7 = [
34641
35340
  {
34642
35341
  path: 'job-progression',
34643
35342
  pathMatch: 'full',
@@ -34659,7 +35358,7 @@
34659
35358
  imports: [
34660
35359
  i1$4.CommonModule,
34661
35360
  i1$2.TranslateModule.forChild(),
34662
- i3.RouterModule.forChild(routes$6),
35361
+ i3.RouterModule.forChild(routes$7),
34663
35362
  JobTestingModule,
34664
35363
  UserEventTestingModule
34665
35364
  ],
@@ -34709,6 +35408,7 @@
34709
35408
  exports.AppHelpModal = AppHelpModal;
34710
35409
  exports.AppIconComponent = AppIconComponent;
34711
35410
  exports.AppIconModule = AppIconModule;
35411
+ exports.AppImageGalleryComponent = AppImageGalleryComponent;
34712
35412
  exports.AppInMemoryTable = AppInMemoryTable;
34713
35413
  exports.AppInstallUpgradeCard = AppInstallUpgradeCard;
34714
35414
  exports.AppListForm = AppListForm;
@@ -34803,6 +35503,7 @@
34803
35503
  exports.FormGetPipe = FormGetPipe;
34804
35504
  exports.FormGetValuePipe = FormGetValuePipe;
34805
35505
  exports.Fragments = Fragments$1;
35506
+ exports.GalleryTestPage = GalleryTestPage;
34806
35507
  exports.GraphqlService = GraphqlService;
34807
35508
  exports.HAMMER_PRESS_TIME = HAMMER_PRESS_TIME;
34808
35509
  exports.HAMMER_TAP_TIME = HAMMER_TAP_TIME;
@@ -34810,6 +35511,12 @@
34810
35511
  exports.HomePage = HomePage;
34811
35512
  exports.Hotkeys = Hotkeys;
34812
35513
  exports.HotkeysDialogComponent = HotkeysDialogComponent;
35514
+ exports.IMAGE_DEFAULTS = IMAGE_DEFAULTS;
35515
+ exports.ImageAttachmentService = ImageAttachmentService;
35516
+ exports.ImageGalleryTestingModule = ImageGalleryTestingModule;
35517
+ exports.ImageModule = ImageModule;
35518
+ exports.ImageService = ImageService;
35519
+ exports.ImagesUtils = ImagesUtils;
34813
35520
  exports.InMemoryEntitiesService = InMemoryEntitiesService;
34814
35521
  exports.IsLoginAccountPipe = IsLoginAccountPipe;
34815
35522
  exports.IsNilOrBlankPipe = IsNilOrBlankPipe;
@@ -35121,19 +35828,20 @@
35121
35828
  exports.ɵa = CustomReuseStrategy;
35122
35829
  exports.ɵb = MatNumpadDomService;
35123
35830
  exports.ɵc = isFocusableElement;
35124
- exports.ɵd = RegisterForm;
35125
- exports.ɵe = AccountValidatorService;
35126
- exports.ɵf = RegisterModal;
35127
- exports.ɵg = UserSettingsValidatorService;
35128
- exports.ɵh = LocalSettingsValidatorService;
35129
- exports.ɵi = AppUpdateOfflineModeCard;
35130
- exports.ɵj = UserEventNotificationList;
35131
- exports.ɵk = JobProgressionList;
35132
- exports.ɵl = DateTestPage;
35133
- exports.ɵm = NumpadTestPage;
35134
- exports.ɵn = MatBadgeIconTestPage;
35135
- exports.ɵo = ToastTestingModule;
35136
- exports.ɵp = ToastTestingPage;
35831
+ exports.ɵd = ImageGalleryModule;
35832
+ exports.ɵe = RegisterForm;
35833
+ exports.ɵf = AccountValidatorService;
35834
+ exports.ɵg = RegisterModal;
35835
+ exports.ɵh = UserSettingsValidatorService;
35836
+ exports.ɵi = LocalSettingsValidatorService;
35837
+ exports.ɵj = AppUpdateOfflineModeCard;
35838
+ exports.ɵk = UserEventNotificationList;
35839
+ exports.ɵl = JobProgressionList;
35840
+ exports.ɵm = DateTestPage;
35841
+ exports.ɵn = NumpadTestPage;
35842
+ exports.ɵo = MatBadgeIconTestPage;
35843
+ exports.ɵp = ToastTestingModule;
35844
+ exports.ɵq = ToastTestingPage;
35137
35845
 
35138
35846
  Object.defineProperty(exports, '__esModule', { value: true });
35139
35847