@provoly/dashboard 1.2.10 → 1.2.11

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.
@@ -490,11 +490,11 @@ const enTranslations$1 = {
490
490
  share: {
491
491
  private: 'Private',
492
492
  public: 'Public',
493
- restricted: 'Restricted',
493
+ groups: 'Restricted',
494
494
  type: 'Visibility',
495
495
  users: 'Authorized users',
496
496
  noGroups: 'No group available',
497
- groups: {
497
+ groupLabels: {
498
498
  ALL: 'Public',
499
499
  AUTHENTICATED: 'Connected users'
500
500
  },
@@ -907,10 +907,10 @@ const frTranslations$1 = {
907
907
  share: {
908
908
  private: 'Privé',
909
909
  public: 'Public',
910
- restricted: 'Restreint',
910
+ groups: 'Restreint',
911
911
  type: 'Visibilité',
912
912
  users: 'Utilisateurs autorisés',
913
- groups: {
913
+ groupLabels: {
914
914
  ALL: 'Tout le monde',
915
915
  AUTHENTICATED: 'Les utilisateurs connectés'
916
916
  },
@@ -954,7 +954,7 @@ const frTranslations$1 = {
954
954
  selectItem: 'Sélectionner la source de données',
955
955
  unselectItem: 'Désélectionner la source de données',
956
956
  noItemSelected: 'Aucune source de données sélectionnée'
957
- },
957
+ }
958
958
  },
959
959
  errors: {
960
960
  default: 'Une erreur est survenue. Veuillez vérifiez les informations ou contacter votre administrateur si le problème persiste',
@@ -5209,9 +5209,7 @@ class TranslateItemToSymbolPipe {
5209
5209
  this.symbolService = symbolService;
5210
5210
  }
5211
5211
  transform(value, ...args) {
5212
- return from$1(new Promise((resolve) => this.symbolService
5213
- .getSymbol(value)
5214
- .then((canvas) => resolve(canvas.toDataURL('image/png')))));
5212
+ return from$1(new Promise((resolve) => this.symbolService.getSymbol(value).then((canvas) => resolve(canvas.toDataURL('image/png')))));
5215
5213
  }
5216
5214
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: TranslateItemToSymbolPipe, deps: [{ token: SymbolService }], target: i0.ɵɵFactoryTarget.Pipe }); }
5217
5215
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: TranslateItemToSymbolPipe, name: "translateItemToSymbol" }); }
@@ -6855,7 +6853,7 @@ class SelectA11yService {
6855
6853
  setToggle(toggleCallback) {
6856
6854
  this.toggle = toggleCallback;
6857
6855
  }
6858
- onFocusChange(origin, autocomplete, toggleFocus, focusSelect) {
6856
+ onFocusChange(origin, autocomplete, toggleFocus, focusInput) {
6859
6857
  toggleFocus();
6860
6858
  switch (origin) {
6861
6859
  case 'mouse':
@@ -6865,7 +6863,7 @@ class SelectA11yService {
6865
6863
  break;
6866
6864
  case 'keyboard':
6867
6865
  if (autocomplete) {
6868
- focusSelect();
6866
+ focusInput();
6869
6867
  }
6870
6868
  break;
6871
6869
  }
@@ -6916,11 +6914,12 @@ class SelectA11yService {
6916
6914
  optionDivRef.nextElementSibling.focus();
6917
6915
  }
6918
6916
  if (last && autocomplete) {
6919
- // with autocomplete=true, focus is not trapped, so prevent tabbing out of list
6917
+ // with autocomplete=true, focus is not trapped, so prevent navigating out of list
6920
6918
  event.preventDefault();
6921
6919
  }
6922
6920
  break;
6923
6921
  case 'Tab':
6922
+ // with autocomplete=true, focus is not trapped, so prevent tabbing out of list
6924
6923
  if (last && autocomplete) {
6925
6924
  event.preventDefault();
6926
6925
  }
@@ -6997,7 +6996,7 @@ class PrySelectComponent extends SubscriptionnerDirective {
6997
6996
  this.modalWidth = 200;
6998
6997
  this.onFocusChange = (origin) => {
6999
6998
  if (!this.inhibate) {
7000
- this.a11yService.onFocusChange(origin, this.autocomplete, () => this.toggleFocus(), () => this.focusSelect());
6999
+ this.a11yService.onFocusChange(origin, this.autocomplete, () => this.toggleFocus(), () => this.focusInput());
7001
7000
  this.inhibition();
7002
7001
  }
7003
7002
  };
@@ -7147,7 +7146,7 @@ class PrySelectComponent extends SubscriptionnerDirective {
7147
7146
  else {
7148
7147
  this.overlayRef?.dispose();
7149
7148
  this.overlayRef = undefined;
7150
- this.focusSelect();
7149
+ this.returnFocus();
7151
7150
  }
7152
7151
  }
7153
7152
  }
@@ -7167,8 +7166,11 @@ class PrySelectComponent extends SubscriptionnerDirective {
7167
7166
  toggleFocus() {
7168
7167
  this.focused = !this.focused;
7169
7168
  }
7170
- focusSelect() {
7171
- return this.autocomplete ? this.input?.nativeElement.focus() : this.selectElement?.nativeElement.focus();
7169
+ returnFocus() {
7170
+ return this.autocomplete ? this.focusInput() : this.selectElement?.nativeElement.focus();
7171
+ }
7172
+ focusInput() {
7173
+ this.input?.nativeElement.focus();
7172
7174
  }
7173
7175
  getOverlayConfig() {
7174
7176
  const positionStrategy = this.overlay
@@ -7416,12 +7418,12 @@ const READ_ACCESS = 'READ';
7416
7418
  const WRITE_ACCESS = 'WRITE';
7417
7419
  // GROUP UTIL METHODS
7418
7420
  const getGroupLabel = (group, i18n) => {
7419
- return group.system ? i18n.instant('@pry.share.groups.' + group.name) : group.name;
7421
+ return group.system ? i18n.instant('@pry.share.groupLabels.' + group.name) : group.name;
7420
7422
  };
7421
7423
  const getGroupLabelByName = (groupName, i18n) => {
7422
- return i18n.instant('@pry.share.groups.' + groupName).startsWith('@')
7424
+ return i18n.instant('@pry.share.groupLabels.' + groupName).startsWith('@')
7423
7425
  ? groupName
7424
- : i18n.instant('@pry.share.groups.' + groupName);
7426
+ : i18n.instant('@pry.share.groupLabels.' + groupName);
7425
7427
  };
7426
7428
  // DASHBOARD GROUP RIGHTS METHODS
7427
7429
  const canManifestBeMadePublic = (manifest, datasets) => {
@@ -11970,7 +11972,7 @@ class DashboardEffects {
11970
11972
  }
11971
11973
  })));
11972
11974
  this.sendAggregatesEvent$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.triggerAggregate), filter$1((action) => action.id !== DEFAULT_NAMED_QUERY_ID && action.id !== EXPLORE_NAMED_QUERY_ID), tap((action) => window.dispatchEvent(new CustomEvent('datasourceRefresh', { detail: action.id })))), { dispatch: false });
11973
- this.startMissingViewAfterViewUpdate$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.updateManifest, DashboardActions.updateManifestAfterFetch, DashboardActions.updateManifestAfterTenantLeave, DashboardActions.updateManifestAfterTenantJoin, DashboardActions.explore, DashboardActions.detail, DashboardActions.restoreInitialManifest, DashboardActions.createTab), withLatestFrom(this.store.select(DashboardSelectors.rank)), filter$1(([action, rank]) => rank === 0), mergeMap$1((action) => [
11975
+ this.startMissingViewAfterViewUpdate$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.updateManifest, DashboardActions.updateManifestAfterFetch, DashboardActions.updateManifestAfterTenantLeave, DashboardActions.updateManifestAfterTenantJoin, DashboardActions.explore, DashboardActions.detail, DashboardActions.restoreInitialManifest, DashboardActions.createTab, DashboardActions.moveWidget), withLatestFrom(this.store.select(DashboardSelectors.rank)), filter$1(([action, rank]) => rank === 0), mergeMap$1((action) => [
11974
11976
  DashboardActions.startingMissingViews(),
11975
11977
  DashboardActions.assertResultSets({}),
11976
11978
  DashboardActions.solveCollisions()
@@ -12143,7 +12145,10 @@ class DashboardEffects {
12143
12145
  const currentWindowLayout = manifestGlobal.windows[rank].grid?.layout ?? DashboardGridLayout.FULL;
12144
12146
  // si non trouvé : nouvelle page, première position suggérée
12145
12147
  const firstProposedLayout = WidgetPlacementUtils.placementOptions(newWidgetManifest, currentWindowLayout)[0];
12146
- manifestGlobal.windows.push({ widgets: [firstProposedLayout], grid: { layout: currentWindowLayout } });
12148
+ manifestGlobal.windows.push({
12149
+ widgets: [firstProposedLayout ?? { x: 1, y: 1, height: 1, width: 1 }],
12150
+ grid: { layout: currentWindowLayout }
12151
+ });
12147
12152
  }
12148
12153
  if (action.alert === undefined || action.alert === true) {
12149
12154
  const messageAction = DashboardActions.multiSnackBar({
@@ -12163,6 +12168,73 @@ class DashboardEffects {
12163
12168
  }
12164
12169
  return DashboardActions.updateManifest({ manifest: manifestGlobal, selectedIds });
12165
12170
  })));
12171
+ this.moveWidget$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.moveWidget), withLatestFrom(this.store.select(DashboardSelectors.gridLayout), this.store.select(DashboardSelectors.globalManifest), this.store.select(DashboardSelectors.rank), this.store.select(DashboardSelectors.dashboardCellParams), this.store.select(DashboardSelectors.selectedItemIds)), map$1(([action, layout, _globalManifest, rank, params, selectedIds]) => {
12172
+ const manifestGlobal = JSON.parse(JSON.stringify(_globalManifest));
12173
+ const newWindows = [...manifestGlobal.windows];
12174
+ // Creating new current window manifest, without moved widget
12175
+ const myNewWindow = {
12176
+ ...newWindows[rank],
12177
+ widgets: [...newWindows[rank].widgets]
12178
+ };
12179
+ const widget = myNewWindow.widgets.splice(action.widgetIndex, 1)[0];
12180
+ newWindows[rank] = myNewWindow;
12181
+ // Creating either a new window manifest or update the target one
12182
+ const targetRank = action.targetIndex;
12183
+ if (targetRank !== -1) {
12184
+ if (!newWindows[targetRank]) {
12185
+ newWindows[targetRank] = {
12186
+ ...newWindows[rank],
12187
+ widgets: [widget]
12188
+ };
12189
+ }
12190
+ else {
12191
+ let found = null;
12192
+ // Try to find a spot in windows (starting by current rank, then in others)
12193
+ const sequence = WidgetPlacementUtils.swapArrayElements(new Array(manifestGlobal.windows.length).fill(0).map((_, idx, array) => idx), 0, rank);
12194
+ // Trying all placement options in target window
12195
+ const windowLayout = manifestGlobal.windows[targetRank].grid?.layout ?? DashboardGridLayout.MANUAL;
12196
+ if (windowLayout !== DashboardGridLayout.MANUAL) {
12197
+ const options = WidgetPlacementUtils.placementOptions(widget, windowLayout);
12198
+ if (!found) {
12199
+ for (const option of options) {
12200
+ if (!found) {
12201
+ // Are we disjoint from all other widgets ?
12202
+ const isDisjointFromAll = (manifestGlobal.windows[targetRank].widgets ?? [])
12203
+ .map((widget) => WidgetPlacementUtils.areDisjoint(widget, option))
12204
+ .reduce((p, c) => p && c, true);
12205
+ if (isDisjointFromAll) {
12206
+ // Found a disjoint placement !
12207
+ found = { actualRank: targetRank, widget: option };
12208
+ }
12209
+ }
12210
+ }
12211
+ }
12212
+ }
12213
+ else {
12214
+ // In manual mode, we should resolveCollisions but for now it's not (cause we only have inverted collisions right now)
12215
+ found = { actualRank: targetRank, widget };
12216
+ }
12217
+ if (!!found) {
12218
+ const placeWeFound = found;
12219
+ newWindows[placeWeFound.actualRank].widgets.push(placeWeFound.widget);
12220
+ }
12221
+ else {
12222
+ const currentWindowLayout = manifestGlobal.windows[rank].grid?.layout ?? DashboardGridLayout.FULL;
12223
+ // si non trouvé : nouvelle page, première position suggérée
12224
+ const firstProposedLayout = WidgetPlacementUtils.placementOptions(widget, currentWindowLayout)[0];
12225
+ newWindows.push({ widgets: [firstProposedLayout ?? widget], grid: { layout: currentWindowLayout } });
12226
+ }
12227
+ }
12228
+ }
12229
+ else {
12230
+ // create new window to welcome this widget
12231
+ newWindows.push({
12232
+ ...newWindows[rank],
12233
+ widgets: [widget]
12234
+ });
12235
+ }
12236
+ return DashboardActions.updateManifest({ manifest: { ...manifestGlobal, windows: newWindows }, selectedIds });
12237
+ })));
12166
12238
  this.multiSnackBar$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.multiSnackBar), tap((action) => this.snackBar.open(action.message))), { dispatch: false });
12167
12239
  this.relaunchAfterOrder$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.quickOrder), map$1((action) => SearchActions.getDatasourceItems({
12168
12240
  id: action.datasourceId,
@@ -12425,50 +12497,7 @@ const internalReducer = createReducer(dashboardInitialState, on(DashboardActions
12425
12497
  [action.id]: action.params
12426
12498
  }
12427
12499
  }
12428
- })), on(DashboardActions.moveWidget, (state, action) => {
12429
- const myRank = state.manifests.tenants.indexOf(state.manifests.sender);
12430
- const newWindows = [...state.manifests.manifest.windows];
12431
- // Creating new current window manifest, without moved widget
12432
- const myNewWindow = {
12433
- ...newWindows[myRank],
12434
- widgets: [...newWindows[myRank].widgets]
12435
- };
12436
- const widget = myNewWindow.widgets.splice(action.widgetIndex, 1)[0];
12437
- newWindows[myRank] = myNewWindow;
12438
- // Creating either a new window manifest or update the target one
12439
- const targetRank = action.targetIndex;
12440
- if (targetRank !== -1) {
12441
- if (!newWindows[targetRank]) {
12442
- newWindows[targetRank] = {
12443
- ...newWindows[myRank],
12444
- widgets: [widget]
12445
- };
12446
- }
12447
- else {
12448
- newWindows[targetRank] = {
12449
- ...newWindows[targetRank],
12450
- widgets: [...(newWindows[targetRank].widgets ?? []), widget]
12451
- };
12452
- }
12453
- }
12454
- else {
12455
- // create new window to welcome this widget
12456
- newWindows.push({
12457
- ...newWindows[myRank],
12458
- widgets: [widget]
12459
- });
12460
- }
12461
- return {
12462
- ...state,
12463
- manifests: {
12464
- ...state.manifests,
12465
- manifest: {
12466
- ...state.manifests.manifest,
12467
- windows: newWindows
12468
- }
12469
- }
12470
- };
12471
- }), on(DashboardActions.maximizeWidget, (state, action) => {
12500
+ })), on(DashboardActions.maximizeWidget, (state, action) => {
12472
12501
  const myRank = state.manifests.tenants.indexOf(state.manifests.sender);
12473
12502
  const newWindows = JSON.parse(JSON.stringify(state.manifests.manifest.windows));
12474
12503
  newWindows[myRank].widgets[action.widgetIndex].layout = {