@sumaris-net/ngx-components 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +211 -196
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/doc/changelog.md +7 -2
  6. package/esm2015/public_api.js +2 -1
  7. package/esm2015/src/app/admin/users/list/users.js +5 -22
  8. package/esm2015/src/app/core/form/entity-editor.class.js +5 -1
  9. package/esm2015/src/app/core/home/home.js +2 -2
  10. package/esm2015/src/app/core/services/account.service.js +38 -27
  11. package/esm2015/src/app/core/services/base-entity-service.class.js +2 -2
  12. package/esm2015/src/app/core/services/local-settings.service.js +18 -14
  13. package/esm2015/src/app/core/services/model/settings.model.js +1 -1
  14. package/esm2015/src/app/core/services/platform.service.js +35 -31
  15. package/esm2015/src/app/core/table/memory-table.class.js +2 -7
  16. package/esm2015/src/app/core/table/table.class.js +21 -24
  17. package/esm2015/src/app/shared/directives/autofocus.directive.js +15 -24
  18. package/esm2015/src/app/shared/platforms.js +36 -0
  19. package/esm2015/src/app/shared/services/progress-bar.service.js +1 -1
  20. package/esm2015/src/app/social/list/user-events.table.js +3 -8
  21. package/fesm2015/sumaris-net.ngx-components.js +165 -135
  22. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  23. package/package.json +1 -1
  24. package/public_api.d.ts +1 -0
  25. package/src/app/admin/users/list/users.d.ts +1 -12
  26. package/src/app/core/form/entity-editor.class.d.ts +1 -1
  27. package/src/app/core/services/account.service.d.ts +2 -0
  28. package/src/app/core/services/local-settings.service.d.ts +0 -2
  29. package/src/app/core/services/model/settings.model.d.ts +0 -1
  30. package/src/app/core/services/platform.service.d.ts +8 -5
  31. package/src/app/core/table/memory-table.class.d.ts +0 -1
  32. package/src/app/core/table/table.class.d.ts +7 -9
  33. package/src/app/shared/directives/autofocus.directive.d.ts +4 -5
  34. package/src/app/shared/platforms.d.ts +13 -0
  35. package/src/app/social/list/user-events.table.d.ts +0 -1
  36. package/sumaris-net.ngx-components.metadata.json +1 -1
@@ -992,7 +992,7 @@ class MatAutocompleteConfigHolder {
992
992
  }
993
993
  }
994
994
  const noop$8 = (_) => { };
995
- const ɵ0$b = noop$8;
995
+ const ɵ0$c = noop$8;
996
996
  class MatAutocompleteField {
997
997
  constructor(cd, formGroupDir) {
998
998
  this.cd = cd;
@@ -3918,26 +3918,56 @@ SharedPipesModule.decorators = [
3918
3918
  },] }
3919
3919
  ];
3920
3920
 
3921
+ /* ---
3922
+ * Source: https://github.com/ionic-team/ionic-framework/blob/b0d53ca73619585671d8cf4dc24e47f826495a0a/core/src/utils/platform.ts
3923
+ * --- */
3924
+ const matchMedia = (win, query) => win.matchMedia(query).matches;
3925
+ const testUserAgent = (win, expr) => {
3926
+ const userAgent = win.navigator.userAgent || win.navigator.vendor || window.opera;
3927
+ return expr.test(userAgent);
3928
+ };
3929
+ const isWindow = (win) => {
3930
+ const userAgent = win.navigator.userAgent || win.navigator.vendor || window.opera;
3931
+ return /windows/i.test(userAgent);
3932
+ };
3933
+ /**
3934
+ * Detect desktop, by fine cursor. See https://github.com/ionic-team/ionic-framework/issues/19942
3935
+ * @param win
3936
+ */
3937
+ const isDesktop = (win) => matchMedia(win, '(any-pointer:fine)');
3938
+ const isTouchUi = (win) => matchMedia(win, '(any-pointer:coarse)');
3939
+ const isMobile = (win) => isTouchUi(win) && !isDesktop(win);
3940
+ const isIpad = (win) => {
3941
+ // iOS 12 and below
3942
+ if (testUserAgent(win, /iPad/i)) {
3943
+ return true;
3944
+ }
3945
+ // iOS 13+
3946
+ if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
3947
+ return true;
3948
+ }
3949
+ return false;
3950
+ };
3951
+ const ɵ0$b = isIpad;
3952
+ const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
3953
+ const isAndroid = (win) => testUserAgent(win, /android|sink/i);
3954
+ const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
3955
+
3921
3956
  // Import the core angular services.
3922
3957
  // ----------------------------------------------------------------------------------- //
3923
3958
  // ----------------------------------------------------------------------------------- //
3924
3959
  const BASE_TIMER_DELAY = 100;
3925
3960
  class AutofocusDirective {
3926
3961
  // I initialize the autofocus directive.
3927
- constructor(elementRef, platform, keyboard) {
3962
+ constructor(elementRef, keyboard) {
3928
3963
  this.keyboard = keyboard;
3929
- this.timer = null;
3930
- this.elementRef = elementRef;
3964
+ this._timer = null;
3965
+ this._elementRef = elementRef;
3931
3966
  this.shouldFocusElement = '';
3932
- this.timer = null;
3967
+ this._timer = null;
3933
3968
  this.timerDelay = BASE_TIMER_DELAY;
3934
- platform.ready().then(() => {
3935
- this.touchUi = platform.is('mobile') || platform.is('tablet');
3936
- });
3969
+ this._mobile = isMobile(window);
3937
3970
  }
3938
- // ---
3939
- // PUBLIC METHODS.
3940
- // ---
3941
3971
  // I get called once after the contents have been fully initialized.
3942
3972
  ngAfterContentInit() {
3943
3973
  // Because this directive can act on the stand-only "autofocus" attribute or
@@ -3972,29 +4002,26 @@ class AutofocusDirective {
3972
4002
  ngOnDestroy() {
3973
4003
  this.stopFocusWorkflow();
3974
4004
  }
3975
- // ---
3976
- // PRIVATE METHODS.
3977
- // ---
4005
+ /* --- private functions -- */
3978
4006
  // I start the timer-based workflow that will focus the current element.
3979
4007
  startFocusWorkflow() {
3980
4008
  // if touch UI: do NOT focus when keyboard hide
3981
- if (this.touchUi && this.keyboard && this.keyboard.isVisible === false)
4009
+ if (this._mobile && this.keyboard && this.keyboard.isVisible === false)
3982
4010
  return;
3983
4011
  // If there is already a timer running for this element, just let it play out -
3984
4012
  // resetting it at this point will only push-out the time at which the focus is
3985
4013
  // applied to the element.
3986
- if (this.timer) {
4014
+ if (this._timer)
3987
4015
  return;
3988
- }
3989
- this.timer = setTimeout(() => {
3990
- this.timer = null;
3991
- this.elementRef.nativeElement.focus();
4016
+ this._timer = setTimeout(() => {
4017
+ this._timer = null;
4018
+ this._elementRef.nativeElement.focus();
3992
4019
  }, this.timerDelay);
3993
4020
  }
3994
4021
  // I stop the timer-based workflow, preventing focus from taking place.
3995
4022
  stopFocusWorkflow() {
3996
- clearTimeout(this.timer);
3997
- this.timer = null;
4023
+ clearTimeout(this._timer);
4024
+ this._timer = null;
3998
4025
  }
3999
4026
  }
4000
4027
  AutofocusDirective.decorators = [
@@ -4008,7 +4035,6 @@ AutofocusDirective.decorators = [
4008
4035
  ];
4009
4036
  AutofocusDirective.ctorParameters = () => [
4010
4037
  { type: ElementRef },
4011
- { type: Platform },
4012
4038
  { type: Keyboard, decorators: [{ type: Optional }] }
4013
4039
  ];
4014
4040
 
@@ -9980,7 +10006,7 @@ SelectPeerModal.propDecorators = {
9980
10006
 
9981
10007
  const moment$3 = momentImported;
9982
10008
  const SETTINGS_STORAGE_KEY = 'settings';
9983
- const SETTINGS_TRANSIENT_PROPERTIES = ['mobile', 'touchUi'];
10009
+ const SETTINGS_TRANSIENT_PROPERTIES = ['mobile', 'touchUi' /*deprecated*/];
9984
10010
  // fixme: this constant points to static environment
9985
10011
  const DEFAULT_SETTINGS = {
9986
10012
  accountInheritance: true,
@@ -10016,29 +10042,32 @@ class LocalSettingsService extends StartableService {
10016
10042
  return this._data && this._data.latLongFormat || 'DDMM';
10017
10043
  }
10018
10044
  get usageMode() {
10019
- return (this._data && this._data.usageMode || (this.mobile ? 'FIELD' : 'DESK'));
10045
+ var _a;
10046
+ if (isNil((_a = this._data) === null || _a === void 0 ? void 0 : _a.mobile)) {
10047
+ console.warn("[settings] Accessing to property 'usageMode' BEFORE service started! Please use ready()");
10048
+ return isCordova(window) ? 'FIELD' : 'DESK';
10049
+ }
10050
+ return this._data.usageMode;
10020
10051
  }
10021
10052
  get mobile() {
10022
- return this._data && toBoolean(this._data.mobile, this.platform.is('mobile'));
10053
+ var _a;
10054
+ if (isNil((_a = this._data) === null || _a === void 0 ? void 0 : _a.mobile)) {
10055
+ console.warn("[settings] Accessing to property 'mobile' BEFORE service started! Please use ready()");
10056
+ return isMobile(window);
10057
+ }
10058
+ return this._data.mobile;
10023
10059
  }
10024
10060
  set mobile(value) {
10025
10061
  this._data.mobile = value;
10026
10062
  }
10027
- get touchUi() {
10028
- return this._data.touchUi;
10029
- }
10030
- set touchUi(value) {
10031
- this._data.touchUi = value;
10032
- }
10033
10063
  get pageHistory() {
10034
10064
  return (this._data && this._data.pageHistory || []);
10035
10065
  }
10036
10066
  ngOnStart() {
10037
10067
  console.info('[settings] Starting service...');
10038
10068
  // Restoring local settings
10039
- this._data.mobile = toBoolean(this._data.mobile, this.platform.is('mobile'));
10040
- this._data.touchUi = this._data.mobile || this.platform.is('phablet') || this.platform.is('tablet');
10041
- this._data.usageMode = this.platform.is('android') || this.platform.is('ios') ? 'FIELD' : 'DESK'; // FIELD by default if Android or iOs
10069
+ this._data.mobile = isNotNil(this._data.mobile) ? this._data.mobile : isMobile(window);
10070
+ this._data.usageMode = (isAndroid(window) || isIOS(window)) ? 'FIELD' : 'DESK'; // FIELD by default if Android or iOS
10042
10071
  // Restoring local settings
10043
10072
  return this.restoreLocally();
10044
10073
  }
@@ -13561,6 +13590,7 @@ class AccountService extends BaseGraphqlService {
13561
13590
  this.onChange = new Subject();
13562
13591
  this.onAuthTokenChange = new Subject();
13563
13592
  this.onAuthBasicChange = new Subject();
13593
+ this._stopWatching$ = new Subject();
13564
13594
  this._cache = {
13565
13595
  loaded: false,
13566
13596
  keypair: null,
@@ -13963,6 +13993,7 @@ class AccountService extends BaseGraphqlService {
13963
13993
  if (hadAuthBasic)
13964
13994
  this.onAuthBasicChange.next(undefined);
13965
13995
  this.onChange.next(undefined);
13996
+ this._stopWatching$.next();
13966
13997
  });
13967
13998
  }
13968
13999
  /**
@@ -14079,12 +14110,17 @@ class AccountService extends BaseGraphqlService {
14079
14110
  return res && res.confirmAccountEmail;
14080
14111
  });
14081
14112
  }
14082
- listenChanges() {
14113
+ watch() {
14083
14114
  if (!this._cache.pubkey)
14084
- return Subscription.EMPTY;
14085
- const self = this;
14086
- console.debug('[account] [WS] Listening changes');
14087
- const subscription = this.graphql.subscribe({
14115
+ throw new Error('Not logged in');
14116
+ if (!this.started) {
14117
+ // Wait service ready, then loop
14118
+ return from(this.ready())
14119
+ .pipe(switchMap(() => this.watch()));
14120
+ }
14121
+ this._stopWatching$.next(); // Stop previous listening
14122
+ console.debug('[account] [WS] Watching changes');
14123
+ return this.graphql.subscribe({
14088
14124
  query: AccountSubscriptions.listenChanges,
14089
14125
  variables: {
14090
14126
  interval: 10
@@ -14093,35 +14129,39 @@ class AccountService extends BaseGraphqlService {
14093
14129
  code: ErrorCodes$2.SUBSCRIBE_ACCOUNT_ERROR,
14094
14130
  message: 'ERROR.ACCOUNT.SUBSCRIBE_ACCOUNT_ERROR'
14095
14131
  }
14096
- }).subscribe({
14097
- next: ({ data }) => __awaiter(this, void 0, void 0, function* () {
14098
- var _a;
14099
- if (!data)
14100
- return;
14101
- const existingUpdateDate = toDateISOString((_a = self._data) === null || _a === void 0 ? void 0 : _a.updateDate);
14102
- if (existingUpdateDate !== data.updateDate) {
14103
- console.debug(`[account] [WS] Detected update on {${data.updateDate}}`);
14104
- yield self.refresh();
14105
- }
14106
- }),
14107
- error: (err) => __awaiter(this, void 0, void 0, function* () {
14132
+ })
14133
+ .pipe(
14134
+ // Stop this pipe next time we call watch()
14135
+ takeUntil(this._stopWatching$), map(({ data }) => {
14136
+ var _a;
14137
+ if (!data)
14138
+ return;
14139
+ const existingUpdateDate = toDateISOString((_a = this._data) === null || _a === void 0 ? void 0 : _a.updateDate);
14140
+ if (existingUpdateDate === data.updateDate)
14141
+ return;
14142
+ console.debug(`[account] [WS] Detected update on {${data.updateDate}}`);
14143
+ return Account.fromObject(data);
14144
+ }), filter(isNotNil));
14145
+ }
14146
+ listenChanges() {
14147
+ const self = this;
14148
+ const subscription = this.watch()
14149
+ .subscribe({
14150
+ next: (data) => self.refresh(),
14151
+ error: (err) => {
14108
14152
  if (err && +err.code === ServerErrorCodes.NOT_FOUND) {
14109
14153
  console.info('[account] Account not exists anymore: force user to logout...', err);
14110
- yield self.logout();
14154
+ self.logout();
14111
14155
  }
14112
14156
  else if (err && +err.code === ServerErrorCodes.UNAUTHORIZED) {
14113
14157
  console.info('[account] Account not authorized: force user to logout...', err);
14114
- yield self.logout();
14158
+ self.logout();
14115
14159
  }
14116
14160
  else {
14117
14161
  console.warn('[account] [WS] Received error:', err);
14118
14162
  }
14119
- }),
14120
- complete: () => {
14121
- console.debug('[account] [WS] Completed');
14122
14163
  }
14123
14164
  });
14124
- // Add log when closing WS
14125
14165
  subscription.add(() => console.debug('[account] [WS] Stop listening changes'));
14126
14166
  return subscription;
14127
14167
  }
@@ -15125,24 +15165,39 @@ class PlatformService extends StartableService {
15125
15165
  if (this._debug)
15126
15166
  console.debug('[platform] Creating service');
15127
15167
  }
15128
- get mobile() {
15129
- return isNotNil(this._mobile) ? this._mobile : this.platform.is('mobile');
15130
- }
15131
15168
  is(platformName) {
15132
- return this.platform.is(platformName);
15169
+ switch (platformName) {
15170
+ case 'mobile':
15171
+ // Use custom mobile detection - see SUMARIS issue #323
15172
+ return isMobile(window);
15173
+ default:
15174
+ return this.platform.is(platformName);
15175
+ }
15176
+ }
15177
+ get mobile() {
15178
+ return isNotNil(this._mobile) ? this._mobile : isMobile(window);
15133
15179
  }
15134
15180
  /**
15135
- * Say if opened has been opened from a web browser (and NOT inside an Android or iOs App).
15181
+ * Say if opened has been opened inside an Android or iOs App.
15136
15182
  * This is used to known if there is cordova features
15137
15183
  */
15138
- isWebOrDesktop() {
15139
- return !this.platform.is('mobile') || this.platform.is('mobileweb');
15184
+ isCordova() {
15185
+ return this._cordova;
15140
15186
  }
15141
15187
  isAndroidCordova() {
15142
15188
  return this._android && this._cordova || false;
15143
15189
  }
15190
+ isIOSCordova() {
15191
+ return this._ios && this._cordova || false;
15192
+ }
15193
+ isWeb() {
15194
+ return !this._cordova || (!this._android && !this._ios);
15195
+ }
15196
+ isApp() {
15197
+ return this._cordova && (this._android || this._ios);
15198
+ }
15144
15199
  get canDownload() {
15145
- return this._android && this._cordova && isNotNil(this.downloader);
15200
+ return !!this.downloader && this.isAndroidCordova();
15146
15201
  }
15147
15202
  get canOpenFile() {
15148
15203
  return false;
@@ -15159,16 +15214,13 @@ class PlatformService extends StartableService {
15159
15214
  this.accountService.tokenType = undefined;
15160
15215
  console.info('[platform] Starting platform...');
15161
15216
  try {
15162
- this._mobile = this.platform.is('mobile');
15163
- this._cordova = this.platform.is('cordova');
15164
- this._android = this.platform.is('android');
15165
- this.configureCordovaPlugins(this._mobile);
15166
- this.touchUi = this._mobile || this.platform.is('tablet') || this.platform.is('phablet');
15167
- // Force mobile in settings
15168
- if (this._mobile) {
15169
- this.settings.mobile = this._mobile;
15170
- this.settings.touchUi = this.touchUi;
15171
- }
15217
+ this._mobile = this.is('mobile');
15218
+ this._cordova = this.is('cordova');
15219
+ this._android = this.is('android');
15220
+ this._ios = this.is('ios');
15221
+ this.configureCordovaPlugins();
15222
+ // Force some settings
15223
+ this.settings.mobile = this._mobile;
15172
15224
  // Configure translation
15173
15225
  yield this.configureTranslate();
15174
15226
  // Configure storage
@@ -15182,7 +15234,7 @@ class PlatformService extends StartableService {
15182
15234
  this.networkService.ready(),
15183
15235
  this.audioProvider.ready()
15184
15236
  ]);
15185
- console.info(`[platform] Starting platform [OK] {mobile: ${this._mobile}, touchUi: ${this.touchUi}, downloader: ${this.canDownload}, fileOpener: ${this.canOpenFile}} in ${Date.now() - now}ms`);
15237
+ console.info(`[platform] Starting platform [OK] {mobile: ${this._mobile}, downloader: ${this.canDownload}, fileOpener: ${this.canOpenFile}} in ${Date.now() - now}ms`);
15186
15238
  // Update cache configuration when network changed
15187
15239
  this.networkService.onNetworkStatusChanges
15188
15240
  .pipe(skip(1)) // Skip the first event (behavior subject send event immediately)
@@ -15194,7 +15246,7 @@ class PlatformService extends StartableService {
15194
15246
  console.info(`[platform] Using auth token type {${tokenType}}`);
15195
15247
  this.accountService.tokenType = tokenType;
15196
15248
  });
15197
- // Hide the splashscreen (if mobile) - after 1s
15249
+ // Hide the splashscreen (if mobile) - after 1s - and play start sound
15198
15250
  if (this.mobile) {
15199
15251
  setTimeout(() => {
15200
15252
  var _a;
@@ -15269,7 +15321,7 @@ class PlatformService extends StartableService {
15269
15321
  //}
15270
15322
  }
15271
15323
  /* -- protected methods -- */
15272
- configureCordovaPlugins(mobile) {
15324
+ configureCordovaPlugins() {
15273
15325
  console.info('[platform] Configuring Cordova plugins...');
15274
15326
  if (this.statusBar) {
15275
15327
  this.statusBar.styleDefault();
@@ -15278,15 +15330,6 @@ class PlatformService extends StartableService {
15278
15330
  if (this.keyboard) {
15279
15331
  this.keyboard.hideFormAccessoryBar(true);
15280
15332
  }
15281
- // Force to use InAppBrowser instead of default window.open()
15282
- if (this.browser) {
15283
- // FIXME: this create a infinite loop (e.g. when downloading an extraction file)
15284
- // window.open = (url?: string, target?: string, features?: string, replace?: boolean) => {
15285
- // console.debug("[platform] Call to window.open() redirected to InAppBrowser.open()");
15286
- // this.browser.create(url, target, features).show();
15287
- // return window;
15288
- // };
15289
- }
15290
15333
  }
15291
15334
  configureTranslate() {
15292
15335
  console.info('[platform] Configuring i18n ...');
@@ -18006,7 +18049,7 @@ class HomePage {
18006
18049
  this.appName = config.label || this.environment.defaultAppName || 'SUMARiS';
18007
18050
  this.logo = config.largeLogo || config.smallLogo || undefined;
18008
18051
  this.description = config.name;
18009
- this.isWeb = this.platform.isWebOrDesktop();
18052
+ this.isWeb = this.platform.isWeb();
18010
18053
  this.canRegister = config.getPropertyAsBoolean(CORE_CONFIG_OPTIONS.REGISTRATION_ENABLE);
18011
18054
  const partners = (config.partners || []).filter(p => p && p.logo);
18012
18055
  this.$partners.next(partners);
@@ -20639,7 +20682,7 @@ class BaseEntityService extends BaseGraphqlService {
20639
20682
  });
20640
20683
  }
20641
20684
  canUserWrite(data, opts) {
20642
- return true;
20685
+ return !!data;
20643
20686
  }
20644
20687
  saveAll(entities, opts) {
20645
20688
  return __awaiter(this, void 0, void 0, function* () {
@@ -21296,13 +21339,7 @@ class CellValueChangeListener {
21296
21339
  // @dynamic
21297
21340
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
21298
21341
  class AppTable {
21299
- constructor(route, router, platform, location, modalCtrl, settings, columns, _dataSource, _filter, injector) {
21300
- this.route = route;
21301
- this.router = router;
21302
- this.platform = platform;
21303
- this.location = location;
21304
- this.modalCtrl = modalCtrl;
21305
- this.settings = settings;
21342
+ constructor(injector, columns, _dataSource, _filter) {
21306
21343
  this.columns = columns;
21307
21344
  this._dataSource = _dataSource;
21308
21345
  this._filter = _filter;
@@ -21345,13 +21382,19 @@ class AppTable {
21345
21382
  this.onDirty = new EventEmitter();
21346
21383
  this.onError = new EventEmitter();
21347
21384
  this._paginator = null;
21348
- this.mobile = this.platform.is('mobile');
21349
- this.translate = injector === null || injector === void 0 ? void 0 : injector.get(TranslateService);
21350
- this.formErrorAdapter = injector === null || injector === void 0 ? void 0 : injector.get(FormErrorTranslator);
21351
- this.alertCtrl = injector === null || injector === void 0 ? void 0 : injector.get(AlertController);
21352
- this.toastController = injector === null || injector === void 0 ? void 0 : injector.get(ToastController);
21385
+ this.route = injector.get(ActivatedRoute);
21386
+ this.router = injector.get(Router);
21387
+ this.location = injector.get(Location);
21388
+ this.settings = injector.get(LocalSettingsService);
21389
+ this.translate = injector.get(TranslateService);
21390
+ this.modalCtrl = injector.get(ModalController);
21391
+ this.alertCtrl = injector.get(AlertController);
21392
+ this.toastController = injector.get(ToastController);
21393
+ this.formErrorAdapter = injector.get(FormErrorTranslator);
21394
+ this.mobile = this.settings.mobile;
21395
+ // Autocomplete fields
21353
21396
  this._autocompleteConfigHolder = new MatAutocompleteConfigHolder({
21354
- getUserAttributes: (a, b) => settings.getFieldDisplayAttributes(a, b)
21397
+ getUserAttributes: (a, b) => this.settings.getFieldDisplayAttributes(a, b)
21355
21398
  });
21356
21399
  this.autocompleteFields = this._autocompleteConfigHolder.fields;
21357
21400
  }
@@ -22513,9 +22556,12 @@ class AppTable {
22513
22556
  return (this.i18nColumnPrefix || '') + changeCaseToUnderscore(columnName).toUpperCase();
22514
22557
  }
22515
22558
  generateTableId() {
22516
- return this.location.path(true).replace(/[?].*$/g, '').replace(/\/[\d]+/g, '_id') + '_' + this.constructor.name;
22559
+ const id = this.location.path(true)
22560
+ .replace(/[?].*$/g, '')
22561
+ .replace(/\/[\d]+/g, '_id')
22562
+ + '_' + this.constructor.name;
22517
22563
  //if (this.debug) console.debug("[table] id = " + id);
22518
- //return id;
22564
+ return id;
22519
22565
  }
22520
22566
  addRowToTable(insertAt) {
22521
22567
  return __awaiter(this, void 0, void 0, function* () {
@@ -22782,16 +22828,10 @@ AppTable.decorators = [
22782
22828
  { type: Directive }
22783
22829
  ];
22784
22830
  AppTable.ctorParameters = () => [
22785
- { type: ActivatedRoute },
22786
- { type: Router },
22787
- { type: undefined },
22788
- { type: Location },
22789
- { type: ModalController },
22790
- { type: LocalSettingsService },
22831
+ { type: Injector },
22791
22832
  { type: Array },
22792
22833
  { type: EntitiesTableDataSource },
22793
- { type: undefined },
22794
- { type: Injector }
22834
+ { type: undefined }
22795
22835
  ];
22796
22836
  AppTable.propDecorators = {
22797
22837
  settingsId: [{ type: Input }],
@@ -23867,6 +23907,10 @@ class AppEntityEditor extends AppTabEditor {
23867
23907
  if (!opts || opts.emitEvent !== false)
23868
23908
  this.markForCheck();
23869
23909
  }
23910
+ /* -- public abstract methods (to override) -- */
23911
+ canUserWrite(data, opts) {
23912
+ return this.dataService.canUserWrite(data, opts);
23913
+ }
23870
23914
  /* -- protected methods -- */
23871
23915
  /**
23872
23916
  * Return undefined to keep same tab
@@ -24020,8 +24064,7 @@ AppEntityEditor.ctorParameters = () => [
24020
24064
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
24021
24065
  class AppInMemoryTable extends AppTable {
24022
24066
  constructor(injector, columns, dataType, memoryDataService, validatorService, options, filter) {
24023
- super(injector.get(ActivatedRoute), injector.get(Router), injector.get(Platform), injector.get(Location), injector.get(ModalController), injector.get(LocalSettingsService), columns, new EntitiesTableDataSource(dataType, memoryDataService, validatorService, options), filter, injector);
24024
- this.injector = injector;
24067
+ super(injector, columns, new EntitiesTableDataSource(dataType, memoryDataService, validatorService, options), filter);
24025
24068
  this.columns = columns;
24026
24069
  this.dataType = dataType;
24027
24070
  this.memoryDataService = memoryDataService;
@@ -24511,7 +24554,7 @@ const ICONS_MAP = {
24511
24554
  }*/
24512
24555
  class UserEventsTable extends AppTable {
24513
24556
  constructor(injector, accountService, service, entities, cd, environment) {
24514
- super(injector.get(ActivatedRoute), injector.get(Router), injector.get(Platform), injector.get(Location), injector.get(ModalController), injector.get(LocalSettingsService),
24557
+ super(injector,
24515
24558
  // columns
24516
24559
  RESERVED_START_COLUMNS
24517
24560
  .concat([
@@ -24520,8 +24563,7 @@ class UserEventsTable extends AppTable {
24520
24563
  'eventType',
24521
24564
  'message'
24522
24565
  ])
24523
- .concat(RESERVED_END_COLUMNS), null, null, injector);
24524
- this.injector = injector;
24566
+ .concat(RESERVED_END_COLUMNS), null, null);
24525
24567
  this.accountService = accountService;
24526
24568
  this.service = service;
24527
24569
  this.entities = entities;
@@ -24895,8 +24937,8 @@ PersonValidatorService.ctorParameters = () => [
24895
24937
  ];
24896
24938
 
24897
24939
  class UsersPage extends AppTable {
24898
- constructor(route, router, platform, location, modalCtrl, accountService, settings, validatorService, configService, dataService, cd, formBuilder, injector, environment) {
24899
- super(route, router, platform, location, modalCtrl, settings, RESERVED_START_COLUMNS
24940
+ constructor(injector, accountService, validatorService, configService, dataService, cd, formBuilder, environment) {
24941
+ super(injector, RESERVED_START_COLUMNS
24900
24942
  .concat([
24901
24943
  'avatar',
24902
24944
  'lastName',
@@ -24915,14 +24957,8 @@ class UsersPage extends AppTable {
24915
24957
  dataServiceOptions: {
24916
24958
  saveOnlyDirtyRows: true
24917
24959
  }
24918
- }), null, injector);
24919
- this.route = route;
24920
- this.router = router;
24921
- this.platform = platform;
24922
- this.location = location;
24923
- this.modalCtrl = modalCtrl;
24960
+ }), null);
24924
24961
  this.accountService = accountService;
24925
- this.settings = settings;
24926
24962
  this.validatorService = validatorService;
24927
24963
  this.configService = configService;
24928
24964
  this.dataService = dataService;
@@ -25046,19 +25082,13 @@ UsersPage.decorators = [
25046
25082
  },] }
25047
25083
  ];
25048
25084
  UsersPage.ctorParameters = () => [
25049
- { type: ActivatedRoute },
25050
- { type: Router },
25051
- { type: PlatformService },
25052
- { type: Location },
25053
- { type: ModalController },
25085
+ { type: Injector },
25054
25086
  { type: AccountService },
25055
- { type: LocalSettingsService },
25056
25087
  { type: ValidatorService },
25057
25088
  { type: ConfigService },
25058
25089
  { type: PersonService },
25059
25090
  { type: ChangeDetectorRef },
25060
25091
  { type: FormBuilder },
25061
- { type: Injector },
25062
25092
  { type: undefined, decorators: [{ type: Inject, args: [ENVIRONMENT,] }] }
25063
25093
  ];
25064
25094
  UsersPage.propDecorators = {
@@ -25128,5 +25158,5 @@ const ErrorCodes = {
25128
25158
  * Generated bundle index. Do not edit.
25129
25159
  */
25130
25160
 
25131
- export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileService, FileSizePipe, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialChipsModule, MaterialTestingModule, MaterialTestingPage, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialRef, ReferentialUtils, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBooleanModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UserEvent, UserEventFilter, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString, fromScrollEndEvent, fromUnixMsTimestamp, fromUnixTimestamp, getCaretPosition, getColorContrast, getColorShade, getColorTint, getConnectionType, getControlFromPath, getFocusableInputElements, getFormErrors, getFormValueFromEntity, getProperty, getPropertyByPath, getPropertyByPathAsString, getRandomImage, hexToRgb, hexToRgbArray, isControlHasInput, isEmptyArray, isInputElement, isInstanceOf, isInt, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchUpperCase, mergeLoadResult, mixHex, moveInputCaretToSeparator, noTrailingSlash, notNilOrDefault, nullIfUndefined, parseLatitudeOrLongitude, propertiesPathComparator, propertyComparator, propertyPathComparator, referentialToString, referentialsToString, remove, removeAll, removeDiacritics, removeDuplicatesFromArray, removeEnd, removeValueInArray, replaceAll, resetCalculatedValue, resizeArray, rgbArrayToHex, rgbToHex, round, scrollFactory, selectInputContent, selectInputRange, setCalculatedValue, setTabIndex, sleep, slideInOutAnimation, slideUpDownAnimation, sort, splitById, splitByProperty, startsWithUpperCase, suggestFromArray, suggestFromStringArray, tabindexComparator, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, SharedMatBadgeIconModule as ɵc, MatBadgeIconDirective as ɵd, isFocusableElement as ɵe, MatBadgeIconTestPage as ɵf, RegisterForm as ɵg, AccountValidatorService as ɵh, RegisterModal as ɵi, UserSettingsValidatorService as ɵj, LocalSettingsValidatorService as ɵk, AppIconComponent as ɵl };
25161
+ export { APP_ABOUT_DEVELOPERS, APP_ABOUT_PARTNERS, APP_CONFIG_OPTIONS, APP_FORM_ERROR_I18N_KEYS, APP_GRAPHQL_TYPE_POLICIES, APP_HOME_BUTTONS, APP_LOCALES, APP_LOCAL_SETTINGS, APP_LOCAL_SETTINGS_OPTIONS, APP_LOCAL_STORAGE_TYPE_POLICIES, APP_MENU_ITEMS, APP_TESTING_PAGES, AboutModal, Account, AccountPage, AccountService, AccountToStringPipe, ActionsColumnComponent, AdminModule, AdminRoutingModule, Alerts, AnimationState, AppEditor, AppEditorOptions, AppEntityEditor, AppForm, AppFormField, AppFormProvider, AppFormUtils, AppGestureConfig, AppGraphQLModule, AppHelpModal, AppInMemoryTable, AppInstallUpgradeCard, AppListForm, AppLoadingSpinner, AppMenuModule, AppNullForm, AppPropertiesForm, AppTabEditor, AppTabEditorOptions, AppTable, AppTableDataSourceOptions, AppTableUtils, AppValidatorService, AppendToInputDirective, ArrayFilterPipe, ArrayFirstPipe, ArrayIncludesPipe, ArrayLengthPipe, ArrayPluckPipe, AudioProvider, AuthForm, AuthGuardService, AuthModal, AutocompleteTestPage, AutofocusDirective, Base58, BaseEntityService, BaseGraphqlService, BaseGraphqlServiceOptions, BaseReferential, Beans, CORE_CONFIG_OPTIONS, CellValueChangeListener, ChipsTestPage, Color, ColorScale, ComponentDirtyGuard, ConfigService, Configuration, CoreModule, CryptoService, DATE_ISO_PATTERN, DATE_UNIX_MS_TIMESTAMP, DATE_UNIX_TIMESTAMP, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_PLACEHOLDER_CHAR, DEFAULT_REQUIRED_COLUMNS, DateDiffDurationPipe, DateFormatPipe, DateFromNowPipe, DateTimeTestPage, DateUtils, Department, DepartmentToStringPipe, DurationPipe, ENTITIES_STORAGE_KEY_PREFIX, ENVIRONMENT, EmptyArrayPipe, EntitiesService, EntitiesStorage, EntitiesTableDataSource, Entity, EntityClass, EntityClasses, EntityFilter, EntityFilterUtils, EntityMetadataComponent, EntityStore, EntityUtils, Environment, ErrorCodes, EvenPipe, FileService, FileSizePipe, FormArrayHelper, FormButtonsBarComponent, FormButtonsBarToken, FormErrorTranslatePipe, FormErrorTranslator, FormFieldValuesHolder, Fragments, GraphqlService, HAMMER_PRESS_TIME, HAMMER_TAP_TIME, HighlightPipe, HomePage, Hotkeys, HotkeysDialogComponent, InMemoryEntitiesService, IsLoginAccountPipe, IsNilOrBlankPipe, IsNotNilOrBlankPipe, IsNotOnFieldModePipe, IsOnFieldModePipe, JobUtils, KEYBOARD_HIDE_DELAY_MS, LAT_LONG_DEFAULT_MAX_DECIMALS, LAT_LONG_PATTERNS, LatLongFormatPipe, LatLongTestPage, LatitudeFormatPipe, LocalSettingsService, LongitudeFormatPipe, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, MapGetPipe, MapKeysPipe, MapValuesPipe, MatAutocompleteConfigHolder, MatAutocompleteField, MatBooleanField, MatChipsField, MatDate, MatDateShort, MatDateTime, MatDuration, MatLatLongField, MatNumpadComponent, MatNumpadContainerComponent, MatNumpadContent, MatPaginatorI18n, MatStepperI18n, MatSwipeField, MaterialChipsModule, MaterialTestingModule, MaterialTestingPage, MathAbsPipe, MenuComponent, MenuItems, MenuService, ModalToolbarComponent, NetworkService, NgInitDirective, NgVarDirective, NotEmptyArrayPipe, NumberFormatPipe, NumpadDirective, OddPipe, PRIORITIZED_AUTHORITIES, PUBKEY_REGEXP, Peer, Person, PersonFilter, PersonFragments, PersonService, PersonToStringPipe, PersonUtils, PersonValidatorService, PlatformService, ProgressBarService, ProgressInterceptor, PropertyGetPipe, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, Referential, ReferentialRef, ReferentialUtils, RegisterConfirmPage, SETTINGS_DISPLAY_COLUMNS, SETTINGS_FILTER, SETTINGS_PAGE_SIZE, SETTINGS_SORTED_COLUMN, SETTINGS_STORAGE_KEY, SETTINGS_TRANSIENT_PROPERTIES, SPACE_PLACEHOLDER_CHAR, SelectPeerModal, SettingsPage, SharedDirectivesModule, SharedFormArrayValidators, SharedFormGroupValidators, SharedHotkeysModule, SharedMatAutocompleteModule, SharedMatBooleanModule, SharedMatDateTimeModule, SharedMatDurationModule, SharedMatLatLongModule, SharedMatNumpadModule, SharedMatSwipeModule, SharedMaterialModule, SharedModule, SharedPipesModule, SharedRoutingModule, SharedTestingModule, SharedValidators, SocialModule, Software, StartableService, StatusById, StatusIds, StatusList, StrLengthPipe, SwipeTestPage, TableSelectColumnsComponent, ToStringPipe, Toasts, ToolbarComponent, ToolbarToken, TranslatablePipe, TranslateContextPipe, TranslateContextService, UserEvent, UserEventFilter, UserEventService, UserEventTypes, UserEventsTable, UserSettings, UsersPage, accountToString, adaptValueToControl, addValueInArray, arrayDistinct, arrayGroupBy, arraySize, asInputElement, canHaveFocus, capitalizeFirstLetter, chainPromises, changeCaseToUnderscore, clearValueInArray, copyEntity2Form, createPromiseEvent, createPromiseEventEmitter, departmentToString, departmentsToString, disableControls, emitPromiseEvent, entityToString, equals, equalsOrNil, fadeInAnimation, fadeInOutAnimation, filterFalse, filterNotNil, filterNumberInput, filterTrue, firstArrayValue, firstFalse, firstFalsePromise, firstNotNil, firstNotNilPromise, firstTrue, firstTruePromise, focusInput, focusNextInput, focusPreviousInput, formatLatitude, formatLongitude, fromDateISOString, fromScrollEndEvent, fromUnixMsTimestamp, fromUnixTimestamp, getCaretPosition, getColorContrast, getColorShade, getColorTint, getConnectionType, getControlFromPath, getFocusableInputElements, getFormErrors, getFormValueFromEntity, getProperty, getPropertyByPath, getPropertyByPathAsString, getRandomImage, hexToRgb, hexToRgbArray, isAndroid, isControlHasInput, isCordova, isDesktop, isEmptyArray, isIOS, isInputElement, isInstanceOf, isInt, isMobile, isNil, isNilOrBlank, isNilOrNaN, isNotEmptyArray, isNotNil, isNotNilOrBlank, isNotNilOrNaN, isNotNilString, isNumber, isNumberRange, isTouchUi, isWindow, joinProperties, joinPropertiesPath, logFormErrors, markAllAsTouched, markAsUntouched, markControlAsTouched, markFormGroupAsTouched, matchMedia, matchUpperCase, mergeLoadResult, mixHex, moveInputCaretToSeparator, noTrailingSlash, notNilOrDefault, nullIfUndefined, parseLatitudeOrLongitude, propertiesPathComparator, propertyComparator, propertyPathComparator, referentialToString, referentialsToString, remove, removeAll, removeDiacritics, removeDuplicatesFromArray, removeEnd, removeValueInArray, replaceAll, resetCalculatedValue, resizeArray, rgbArrayToHex, rgbToHex, round, scrollFactory, selectInputContent, selectInputRange, setCalculatedValue, setTabIndex, sleep, slideInOutAnimation, slideUpDownAnimation, sort, splitById, splitByProperty, startsWithUpperCase, suggestFromArray, suggestFromStringArray, tabindexComparator, testUserAgent, toBoolean, toDateISOString, toDuration, toFloat, toInt, toNotNil, toNumber, trimEmptyToNull, uncapitalizeFirstLetter, updateValueAndValidity, waitFor, waitForTrue, waitIdle, waitWhilePending, ɵ0$b as ɵ0, CustomReuseStrategy as ɵa, MatNumpadDomService as ɵb, SharedMatBadgeIconModule as ɵc, MatBadgeIconDirective as ɵd, isFocusableElement as ɵe, MatBadgeIconTestPage as ɵf, RegisterForm as ɵg, AccountValidatorService as ɵh, RegisterModal as ɵi, UserSettingsValidatorService as ɵj, LocalSettingsValidatorService as ɵk, AppIconComponent as ɵl };
25132
25162
  //# sourceMappingURL=sumaris-net.ngx-components.js.map