ngx-edu-sharing-ui 10.0.7 → 10.0.8

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.
@@ -18,7 +18,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
18
18
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
19
19
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
20
20
  import * as i2 from 'ngx-edu-sharing-api';
21
- import { RestConstants, LANGUAGES, ME, HOME_REPOSITORY, PROPERTY_FILTER_ALL, ConfigService, MdsService } from 'ngx-edu-sharing-api';
21
+ import { RestConstants, SessionStorageService, LANGUAGES, ME, HOME_REPOSITORY, PROPERTY_FILTER_ALL, ConfigService, MdsService } from 'ngx-edu-sharing-api';
22
22
  import * as i3$2 from '@angular/material/core';
23
23
  import { MatRippleModule } from '@angular/material/core';
24
24
  import * as i2$1 from '@angular/router';
@@ -1303,6 +1303,19 @@ const WORKFLOW_STATUS_CHECKED = {
1303
1303
  * is the case when it is embedded as a web component into another website.
1304
1304
  */
1305
1305
  const ASSETS_BASE_PATH = new InjectionToken('ASSETS_BASE_PATH');
1306
+ class I18nConfig {
1307
+ constructor() {
1308
+ /**
1309
+ * shall the user profile be read
1310
+ * If not set, defaults to true
1311
+ */
1312
+ this.obeyUserProfile = true;
1313
+ }
1314
+ }
1315
+ /**
1316
+ * additional configuration options
1317
+ */
1318
+ const I18N_CONFIG = new InjectionToken('I18N_CONFIG');
1306
1319
  /**
1307
1320
  * custom additional uris to fetch language files from
1308
1321
  *
@@ -1313,6 +1326,198 @@ const ASSETS_BASE_PATH = new InjectionToken('ASSETS_BASE_PATH');
1313
1326
  */
1314
1327
  const ADDITIONAL_I18N_PROVIDER = new InjectionToken('ADDITIONAL_I18N_PROVIDER');
1315
1328
 
1329
+ var NodesRightMode;
1330
+ (function (NodesRightMode) {
1331
+ // rights on the current node, no matter if its a reference or origianl
1332
+ NodesRightMode[NodesRightMode["Local"] = 0] = "Local";
1333
+ // effective rights on the current node, only relevant for collection references (for non-refs, this equals to local)
1334
+ NodesRightMode[NodesRightMode["Effective"] = 1] = "Effective";
1335
+ })(NodesRightMode || (NodesRightMode = {}));
1336
+ class OptionItem {
1337
+ /**
1338
+ *
1339
+ * @param name the option name, which is used for the translation
1340
+ * @param icon A material icon name
1341
+ * @param callback A function callback when this option is chosen. Will get the current node
1342
+ * passed as an argument. If available, the relevant nodes are passed as second argument,
1343
+ * i.e., the selection, if any, or the current node as single-item array otherwise.
1344
+ */
1345
+ constructor(name, icon,
1346
+ // TODO: Maybe switch to only providing the second parameter.
1347
+ callback) {
1348
+ this.name = name;
1349
+ this.icon = icon;
1350
+ this.callback = callback;
1351
+ /**
1352
+ * If true, this option will be shown all the time in the node table
1353
+ * @type {boolean}
1354
+ */
1355
+ this.showAlways = false;
1356
+ /**
1357
+ * If true, this option will be shown as an action (if room). If none of the items has showAsAction set, the first items will always be shown as action
1358
+ * @type {boolean}
1359
+ */
1360
+ this.showAsAction = false;
1361
+ /**
1362
+ * If true, this option will be shown as a toggle on the right side (provide iconToggle as a toggle icon)
1363
+ * @type {boolean}
1364
+ */
1365
+ this.isToggle = false;
1366
+ /**
1367
+ * Only when @isToggle. is the toggle currently visible
1368
+ */
1369
+ this.isToggleVisible = true;
1370
+ /**
1371
+ * Only when @isToggle. Where to place the toggle, before or after all other actions
1372
+ * @type {boolean}
1373
+ */
1374
+ this.togglePosition = 'after';
1375
+ /**
1376
+ * If true, shows a line at the top.
1377
+ *
1378
+ * This feature is usually handled now by associating an entry to a `group`
1379
+ * now. However `isSeparate` is kept as fallback for now.
1380
+ */
1381
+ this.isSeparate = false;
1382
+ /**
1383
+ * The item will be indicated with an accent color in the menu.
1384
+ *
1385
+ * Used by the dropdown variant of the main menu to indicate the currently
1386
+ * active scope.
1387
+ */
1388
+ this.isSelected = false;
1389
+ /**
1390
+ * If true, only displayed on a mobile device (based on the navigator agent)
1391
+ * @type {boolean}
1392
+ */
1393
+ this.onlyMobile = false;
1394
+ /**
1395
+ * custom aria-label
1396
+ * @type {string}
1397
+ */
1398
+ this.ariaLabel = '';
1399
+ /**
1400
+ * If true, only displayed on a desktop device (based on the navigator agent)
1401
+ * @type {boolean}
1402
+ */
1403
+ this.onlyDesktop = false;
1404
+ /**
1405
+ * Set to false if the action should be shown, but should not be clickable
1406
+ * @type {boolean}
1407
+ */
1408
+ this.isEnabled = true;
1409
+ /**
1410
+ * Show the given name (if false, only icon will show)
1411
+ */
1412
+ this.showName = true;
1413
+ /**
1414
+ * Or concat of supported element types for the action
1415
+ */
1416
+ this.elementType = [ElementType.Node];
1417
+ this.permissionsMode = HideMode.Disable;
1418
+ this.permissionsRightMode = NodesRightMode.Local;
1419
+ this.toolpermissionsMode = HideMode.Disable;
1420
+ }
1421
+ }
1422
+ class CustomOptions {
1423
+ constructor() {
1424
+ /**
1425
+ * If true, all existing or available options for the object stay
1426
+ * If false, no options will be set, only the options in "addOptions" are used
1427
+ */
1428
+ this.useDefaultOptions = true;
1429
+ }
1430
+ }
1431
+ var HideMode;
1432
+ (function (HideMode) {
1433
+ HideMode[HideMode["Disable"] = 0] = "Disable";
1434
+ HideMode[HideMode["Hide"] = 1] = "Hide";
1435
+ })(HideMode || (HideMode = {}));
1436
+ var Scope;
1437
+ (function (Scope) {
1438
+ Scope["Render"] = "Render";
1439
+ Scope["Search"] = "Search";
1440
+ Scope["SearchCollections"] = "SearchCollections";
1441
+ Scope["SavedSearches"] = "SavedSearches";
1442
+ Scope["CollectionsReferences"] = "CollectionsReferences";
1443
+ Scope["CollectionsProposals"] = "CollectionsProposals";
1444
+ Scope["CollectionsCollection"] = "CollectionsCollection";
1445
+ Scope["WorkspaceList"] = "WorkspaceList";
1446
+ Scope["WorkspaceTree"] = "WorkspaceTree";
1447
+ Scope["Sharing"] = "Sharing";
1448
+ Scope["Oer"] = "Oer";
1449
+ Scope["UserManagement"] = "UserManagement";
1450
+ Scope["UserProfile"] = "UserProfile";
1451
+ Scope["Stream"] = "Stream";
1452
+ Scope["CreateMenu"] = "CreateMenu";
1453
+ Scope["MediacenterNodesList"] = "MediacenterNodesList";
1454
+ Scope["Admin"] = "Admin";
1455
+ Scope["DebugShowAll"] = "DebugShowAll";
1456
+ })(Scope || (Scope = {}));
1457
+ var ElementType;
1458
+ (function (ElementType) {
1459
+ ElementType[ElementType["Node"] = 0] = "Node";
1460
+ ElementType[ElementType["NodeChild"] = 1] = "NodeChild";
1461
+ ElementType[ElementType["MapRef"] = 2] = "MapRef";
1462
+ ElementType[ElementType["NodePublishedCopy"] = 3] = "NodePublishedCopy";
1463
+ ElementType[ElementType["NodeRevoked"] = 4] = "NodeRevoked";
1464
+ ElementType[ElementType["NodeBlockedImport"] = 5] = "NodeBlockedImport";
1465
+ ElementType[ElementType["NodeProposal"] = 6] = "NodeProposal";
1466
+ ElementType[ElementType["Person"] = 7] = "Person";
1467
+ ElementType[ElementType["Group"] = 8] = "Group";
1468
+ ElementType[ElementType["SavedSearch"] = 9] = "SavedSearch";
1469
+ ElementType[ElementType["Unknown"] = 10] = "Unknown";
1470
+ })(ElementType || (ElementType = {}));
1471
+ class OptionGroup {
1472
+ /**
1473
+ * @param id The group identifier. Used to seperate elements based on the group
1474
+ * @param priority Group with 0 has highest priority, higher values mean lower priority
1475
+ */
1476
+ constructor(id, priority) {
1477
+ this.id = id;
1478
+ this.priority = priority;
1479
+ }
1480
+ }
1481
+ class DefaultGroups {
1482
+ static { this.Primary = new OptionGroup('Primary', 10); }
1483
+ static { this.Create = new OptionGroup('Create', 15); }
1484
+ static { this.View = new OptionGroup('View', 20); }
1485
+ static { this.CreateConnector = new OptionGroup('CreateConnector', 25); }
1486
+ static { this.CreateLtiTools = new OptionGroup('CreateLtiTools', 28); }
1487
+ static { this.Reuse = new OptionGroup('Reuse', 30); }
1488
+ static { this.Edit = new OptionGroup('Edit', 40); }
1489
+ static { this.FileOperations = new OptionGroup('FileOperations', 50); }
1490
+ static { this.Delete = new OptionGroup('Delete', 60); }
1491
+ static { this.Toggles = new OptionGroup('Toggles', 70); }
1492
+ }
1493
+ var Constrain;
1494
+ (function (Constrain) {
1495
+ Constrain[Constrain["CollectionReference"] = 0] = "CollectionReference";
1496
+ Constrain[Constrain["NoCollectionReference"] = 1] = "NoCollectionReference";
1497
+ Constrain[Constrain["Directory"] = 2] = "Directory";
1498
+ Constrain[Constrain["Collections"] = 3] = "Collections";
1499
+ Constrain[Constrain["Files"] = 4] = "Files";
1500
+ Constrain[Constrain["FilesAndDirectories"] = 5] = "FilesAndDirectories";
1501
+ Constrain[Constrain["Admin"] = 6] = "Admin";
1502
+ Constrain[Constrain["AdminOrDebug"] = 7] = "AdminOrDebug";
1503
+ Constrain[Constrain["NoBulk"] = 8] = "NoBulk";
1504
+ Constrain[Constrain["NoSelection"] = 9] = "NoSelection";
1505
+ Constrain[Constrain["ClipboardContent"] = 10] = "ClipboardContent";
1506
+ Constrain[Constrain["AddObjects"] = 11] = "AddObjects";
1507
+ Constrain[Constrain["HomeRepository"] = 12] = "HomeRepository";
1508
+ Constrain[Constrain["User"] = 13] = "User";
1509
+ Constrain[Constrain["NoScope"] = 14] = "NoScope";
1510
+ Constrain[Constrain["ReurlMode"] = 15] = "ReurlMode";
1511
+ Constrain[Constrain["LTIMode"] = 16] = "LTIMode";
1512
+ })(Constrain || (Constrain = {}));
1513
+ var Target;
1514
+ (function (Target) {
1515
+ Target[Target["List"] = 0] = "List";
1516
+ Target[Target["ListDropdown"] = 1] = "ListDropdown";
1517
+ Target[Target["Actionbar"] = 2] = "Actionbar";
1518
+ Target[Target["CreateMenu"] = 3] = "CreateMenu";
1519
+ })(Target || (Target = {}));
1520
+
1316
1521
  const EDU_SHARING_UI_CONFIG = new InjectionToken('EDU_SHARING_API_CONFIG');
1317
1522
  class EduSharingUiConfiguration {
1318
1523
  constructor() {
@@ -1668,6 +1873,43 @@ class NodeHelperService {
1668
1873
  isNodeRevoked(node) {
1669
1874
  return node?.aspects?.includes(RestConstants.CCM_ASPECT_REVOKED);
1670
1875
  }
1876
+ /**
1877
+ * returns true if all nodes have the requested right
1878
+ * mode (only works for collection refs):
1879
+ * Local: check only rights of the node itself
1880
+ * Effective: check only rights of the original node this refers to (collection ref). If it is not a collection ref, fallback to local
1881
+ */
1882
+ getNodesRight(nodes, right, mode = NodesRightMode.Local) {
1883
+ if (nodes == null)
1884
+ return true;
1885
+ for (const node of nodes) {
1886
+ let currentMode = mode;
1887
+ // if no access effective present and not a collection ref. use the local data
1888
+ if (!node.aspects?.includes(RestConstants.CCM_ASPECT_IO_REFERENCE) &&
1889
+ !node.accessEffective?.length) {
1890
+ currentMode = NodesRightMode.Local;
1891
+ }
1892
+ if (currentMode === NodesRightMode.Effective) {
1893
+ if (!node.aspects?.includes(RestConstants.CCM_ASPECT_IO_REFERENCE)) {
1894
+ if (node.accessEffective && node.accessEffective.indexOf(right) !== -1) {
1895
+ continue;
1896
+ }
1897
+ }
1898
+ if (node.accessEffective && node.accessEffective.indexOf(right) !== -1) {
1899
+ continue;
1900
+ }
1901
+ if (RestConstants.IMPLICIT_COLLECTION_PERMISSIONS.indexOf(right) === -1) {
1902
+ // permission not matched on original -> implicit permissions from collection may apply
1903
+ return false;
1904
+ }
1905
+ }
1906
+ // check regular node rights
1907
+ if (!node.access || node.access.indexOf(right) === -1) {
1908
+ return false;
1909
+ }
1910
+ }
1911
+ return true;
1912
+ }
1671
1913
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NodeHelperService, deps: [{ token: i1.TranslateService }, { token: i2.ApiHelpersService }, { token: i2.NetworkService }, { token: i2.ConfigService }, { token: RepoUrlService }, { token: ASSETS_BASE_PATH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1672
1914
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NodeHelperService, providedIn: 'root' }); }
1673
1915
  }
@@ -3918,198 +4160,6 @@ const AVAILABLE_LIST_WIDGETS = {
3918
4160
  Text: ListTextComponent,
3919
4161
  };
3920
4162
 
3921
- var NodesRightMode;
3922
- (function (NodesRightMode) {
3923
- // rights on the current node, no matter if its a reference or origianl
3924
- NodesRightMode[NodesRightMode["Local"] = 0] = "Local";
3925
- // effective rights on the current node, only relevant for collection references (for non-refs, this equals to local)
3926
- NodesRightMode[NodesRightMode["Effective"] = 1] = "Effective";
3927
- })(NodesRightMode || (NodesRightMode = {}));
3928
- class OptionItem {
3929
- /**
3930
- *
3931
- * @param name the option name, which is used for the translation
3932
- * @param icon A material icon name
3933
- * @param callback A function callback when this option is chosen. Will get the current node
3934
- * passed as an argument. If available, the relevant nodes are passed as second argument,
3935
- * i.e., the selection, if any, or the current node as single-item array otherwise.
3936
- */
3937
- constructor(name, icon,
3938
- // TODO: Maybe switch to only providing the second parameter.
3939
- callback) {
3940
- this.name = name;
3941
- this.icon = icon;
3942
- this.callback = callback;
3943
- /**
3944
- * If true, this option will be shown all the time in the node table
3945
- * @type {boolean}
3946
- */
3947
- this.showAlways = false;
3948
- /**
3949
- * If true, this option will be shown as an action (if room). If none of the items has showAsAction set, the first items will always be shown as action
3950
- * @type {boolean}
3951
- */
3952
- this.showAsAction = false;
3953
- /**
3954
- * If true, this option will be shown as a toggle on the right side (provide iconToggle as a toggle icon)
3955
- * @type {boolean}
3956
- */
3957
- this.isToggle = false;
3958
- /**
3959
- * Only when @isToggle. is the toggle currently visible
3960
- */
3961
- this.isToggleVisible = true;
3962
- /**
3963
- * Only when @isToggle. Where to place the toggle, before or after all other actions
3964
- * @type {boolean}
3965
- */
3966
- this.togglePosition = 'after';
3967
- /**
3968
- * If true, shows a line at the top.
3969
- *
3970
- * This feature is usually handled now by associating an entry to a `group`
3971
- * now. However `isSeparate` is kept as fallback for now.
3972
- */
3973
- this.isSeparate = false;
3974
- /**
3975
- * The item will be indicated with an accent color in the menu.
3976
- *
3977
- * Used by the dropdown variant of the main menu to indicate the currently
3978
- * active scope.
3979
- */
3980
- this.isSelected = false;
3981
- /**
3982
- * If true, only displayed on a mobile device (based on the navigator agent)
3983
- * @type {boolean}
3984
- */
3985
- this.onlyMobile = false;
3986
- /**
3987
- * custom aria-label
3988
- * @type {string}
3989
- */
3990
- this.ariaLabel = '';
3991
- /**
3992
- * If true, only displayed on a desktop device (based on the navigator agent)
3993
- * @type {boolean}
3994
- */
3995
- this.onlyDesktop = false;
3996
- /**
3997
- * Set to false if the action should be shown, but should not be clickable
3998
- * @type {boolean}
3999
- */
4000
- this.isEnabled = true;
4001
- /**
4002
- * Show the given name (if false, only icon will show)
4003
- */
4004
- this.showName = true;
4005
- /**
4006
- * Or concat of supported element types for the action
4007
- */
4008
- this.elementType = [ElementType.Node];
4009
- this.permissionsMode = HideMode.Disable;
4010
- this.permissionsRightMode = NodesRightMode.Local;
4011
- this.toolpermissionsMode = HideMode.Disable;
4012
- }
4013
- }
4014
- class CustomOptions {
4015
- constructor() {
4016
- /**
4017
- * If true, all existing or available options for the object stay
4018
- * If false, no options will be set, only the options in "addOptions" are used
4019
- */
4020
- this.useDefaultOptions = true;
4021
- }
4022
- }
4023
- var HideMode;
4024
- (function (HideMode) {
4025
- HideMode[HideMode["Disable"] = 0] = "Disable";
4026
- HideMode[HideMode["Hide"] = 1] = "Hide";
4027
- })(HideMode || (HideMode = {}));
4028
- var Scope;
4029
- (function (Scope) {
4030
- Scope["Render"] = "Render";
4031
- Scope["Search"] = "Search";
4032
- Scope["SearchCollections"] = "SearchCollections";
4033
- Scope["SavedSearches"] = "SavedSearches";
4034
- Scope["CollectionsReferences"] = "CollectionsReferences";
4035
- Scope["CollectionsProposals"] = "CollectionsProposals";
4036
- Scope["CollectionsCollection"] = "CollectionsCollection";
4037
- Scope["WorkspaceList"] = "WorkspaceList";
4038
- Scope["WorkspaceTree"] = "WorkspaceTree";
4039
- Scope["Sharing"] = "Sharing";
4040
- Scope["Oer"] = "Oer";
4041
- Scope["UserManagement"] = "UserManagement";
4042
- Scope["UserProfile"] = "UserProfile";
4043
- Scope["Stream"] = "Stream";
4044
- Scope["CreateMenu"] = "CreateMenu";
4045
- Scope["MediacenterNodesList"] = "MediacenterNodesList";
4046
- Scope["Admin"] = "Admin";
4047
- Scope["DebugShowAll"] = "DebugShowAll";
4048
- })(Scope || (Scope = {}));
4049
- var ElementType;
4050
- (function (ElementType) {
4051
- ElementType[ElementType["Node"] = 0] = "Node";
4052
- ElementType[ElementType["NodeChild"] = 1] = "NodeChild";
4053
- ElementType[ElementType["MapRef"] = 2] = "MapRef";
4054
- ElementType[ElementType["NodePublishedCopy"] = 3] = "NodePublishedCopy";
4055
- ElementType[ElementType["NodeRevoked"] = 4] = "NodeRevoked";
4056
- ElementType[ElementType["NodeBlockedImport"] = 5] = "NodeBlockedImport";
4057
- ElementType[ElementType["NodeProposal"] = 6] = "NodeProposal";
4058
- ElementType[ElementType["Person"] = 7] = "Person";
4059
- ElementType[ElementType["Group"] = 8] = "Group";
4060
- ElementType[ElementType["SavedSearch"] = 9] = "SavedSearch";
4061
- ElementType[ElementType["Unknown"] = 10] = "Unknown";
4062
- })(ElementType || (ElementType = {}));
4063
- class OptionGroup {
4064
- /**
4065
- * @param id The group identifier. Used to seperate elements based on the group
4066
- * @param priority Group with 0 has highest priority, higher values mean lower priority
4067
- */
4068
- constructor(id, priority) {
4069
- this.id = id;
4070
- this.priority = priority;
4071
- }
4072
- }
4073
- class DefaultGroups {
4074
- static { this.Primary = new OptionGroup('Primary', 10); }
4075
- static { this.Create = new OptionGroup('Create', 15); }
4076
- static { this.View = new OptionGroup('View', 20); }
4077
- static { this.CreateConnector = new OptionGroup('CreateConnector', 25); }
4078
- static { this.CreateLtiTools = new OptionGroup('CreateLtiTools', 28); }
4079
- static { this.Reuse = new OptionGroup('Reuse', 30); }
4080
- static { this.Edit = new OptionGroup('Edit', 40); }
4081
- static { this.FileOperations = new OptionGroup('FileOperations', 50); }
4082
- static { this.Delete = new OptionGroup('Delete', 60); }
4083
- static { this.Toggles = new OptionGroup('Toggles', 70); }
4084
- }
4085
- var Constrain;
4086
- (function (Constrain) {
4087
- Constrain[Constrain["CollectionReference"] = 0] = "CollectionReference";
4088
- Constrain[Constrain["NoCollectionReference"] = 1] = "NoCollectionReference";
4089
- Constrain[Constrain["Directory"] = 2] = "Directory";
4090
- Constrain[Constrain["Collections"] = 3] = "Collections";
4091
- Constrain[Constrain["Files"] = 4] = "Files";
4092
- Constrain[Constrain["FilesAndDirectories"] = 5] = "FilesAndDirectories";
4093
- Constrain[Constrain["Admin"] = 6] = "Admin";
4094
- Constrain[Constrain["AdminOrDebug"] = 7] = "AdminOrDebug";
4095
- Constrain[Constrain["NoBulk"] = 8] = "NoBulk";
4096
- Constrain[Constrain["NoSelection"] = 9] = "NoSelection";
4097
- Constrain[Constrain["ClipboardContent"] = 10] = "ClipboardContent";
4098
- Constrain[Constrain["AddObjects"] = 11] = "AddObjects";
4099
- Constrain[Constrain["HomeRepository"] = 12] = "HomeRepository";
4100
- Constrain[Constrain["User"] = 13] = "User";
4101
- Constrain[Constrain["NoScope"] = 14] = "NoScope";
4102
- Constrain[Constrain["ReurlMode"] = 15] = "ReurlMode";
4103
- Constrain[Constrain["LTIMode"] = 16] = "LTIMode";
4104
- })(Constrain || (Constrain = {}));
4105
- var Target;
4106
- (function (Target) {
4107
- Target[Target["List"] = 0] = "List";
4108
- Target[Target["ListDropdown"] = 1] = "ListDropdown";
4109
- Target[Target["Actionbar"] = 2] = "Actionbar";
4110
- Target[Target["CreateMenu"] = 3] = "CreateMenu";
4111
- })(Target || (Target = {}));
4112
-
4113
4163
  var CustomFieldSpecialType;
4114
4164
  (function (CustomFieldSpecialType) {
4115
4165
  CustomFieldSpecialType[CustomFieldSpecialType["preview"] = 0] = "preview";
@@ -4292,23 +4342,33 @@ const DEFAULT_SUPPORTED_LANGUAGES = [
4292
4342
  'none',
4293
4343
  ];
4294
4344
  class TranslationsService {
4295
- constructor(config, route, storage, translate, sessionStorage, ref, appService) {
4345
+ constructor(config, injector,
4346
+ // optional, some web components may don't have it!
4347
+ route, i18nConfig, translate, ref, appService) {
4296
4348
  this.config = config;
4349
+ this.injector = injector;
4297
4350
  this.route = route;
4298
- this.storage = storage;
4351
+ this.i18nConfig = i18nConfig;
4299
4352
  this.translate = translate;
4300
- this.sessionStorage = sessionStorage;
4301
4353
  this.ref = ref;
4302
4354
  this.appService = appService;
4303
4355
  this.languageLoaded = new BehaviorSubject(false);
4304
- this.sessionStorage?.observe('language').subscribe((lang) => {
4305
- // language has changed, i.e. user has different preference
4306
- if (this.translate.currentLang && this.translate.currentLang !== lang) {
4307
- this.initialize().subscribe(() => {
4308
- this.ref.tick();
4309
- });
4310
- }
4311
- });
4356
+ if (!this.i18nConfig) {
4357
+ this.i18nConfig = new I18nConfig();
4358
+ }
4359
+ if (this.i18nConfig.obeyUserProfile) {
4360
+ this.injector
4361
+ .get(SessionStorageService)
4362
+ ?.observe('language')
4363
+ .subscribe((lang) => {
4364
+ // language has changed, i.e. user has different preference
4365
+ if (this.translate.currentLang && this.translate.currentLang !== lang) {
4366
+ this.initialize().subscribe(() => {
4367
+ this.ref.tick();
4368
+ });
4369
+ }
4370
+ });
4371
+ }
4312
4372
  }
4313
4373
  /**
4314
4374
  * Determines and configures the language to use and triggers loading of translations with
@@ -4328,13 +4388,13 @@ class TranslationsService {
4328
4388
  }
4329
4389
  }), tap((supportedLanguages) => this.translate.addLangs(supportedLanguages)),
4330
4390
  // Select queryParams.locale if set meaningfully
4331
- switchMap((supportedLanguages) => this.route.queryParams.pipe(first(), map((params) => {
4391
+ switchMap((supportedLanguages) => (this.route ? this.route.queryParams : of(null)).pipe(first(), map((params) => {
4332
4392
  let selectedLanguage = null;
4333
- if (supportedLanguages.indexOf(params.locale) !== -1) {
4334
- selectedLanguage = params.locale;
4393
+ if (supportedLanguages.indexOf(params?.locale) !== -1) {
4394
+ selectedLanguage = params?.locale;
4335
4395
  }
4336
- else if (params.locale) {
4337
- if (params.locale === 'de') {
4396
+ else if (params?.locale) {
4397
+ if (params?.locale === 'de') {
4338
4398
  const deVariants = supportedLanguages.filter((l) => l.startsWith('de-'));
4339
4399
  if (deVariants?.length === 1) {
4340
4400
  selectedLanguage = deVariants[0];
@@ -4366,7 +4426,19 @@ class TranslationsService {
4366
4426
  });
4367
4427
  }
4368
4428
  else {
4369
- return this.storage.get('language').pipe(map((storageLanguage) => {
4429
+ if (!this.i18nConfig.obeyUserProfile) {
4430
+ console.info('obeyUserProfile is disabled, using default language ' +
4431
+ supportedLanguages[0]);
4432
+ return of({
4433
+ supportedLanguages,
4434
+ selectedLanguage,
4435
+ useStored: false,
4436
+ });
4437
+ }
4438
+ return this.injector
4439
+ .get(SessionStorageService)
4440
+ .get('language')
4441
+ .pipe(map((storageLanguage) => {
4370
4442
  let useStored = false;
4371
4443
  if (supportedLanguages.indexOf(storageLanguage) !== -1) {
4372
4444
  selectedLanguage = storageLanguage;
@@ -4410,8 +4482,10 @@ class TranslationsService {
4410
4482
  }),
4411
4483
  // Set fallback language
4412
4484
  tap(({ supportedLanguages, selectedLanguage, useStored }) => {
4413
- if (!useStored) {
4414
- void this.storage.set('language', selectedLanguage);
4485
+ if (!useStored && this.i18nConfig.obeyUserProfile) {
4486
+ void this.injector
4487
+ .get(SessionStorageService)
4488
+ .set('language', selectedLanguage);
4415
4489
  }
4416
4490
  if (selectedLanguage === 'none') {
4417
4491
  this.translate.setDefaultLang('none');
@@ -4467,13 +4541,20 @@ class TranslationsService {
4467
4541
  getLocale() {
4468
4542
  return this.getISOLanguage().replace('_', '-');
4469
4543
  }
4470
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TranslationsService, deps: [{ token: i2.ConfigService }, { token: i2$1.ActivatedRoute }, { token: i2.SessionStorageService }, { token: i1.TranslateService }, { token: i2.SessionStorageService }, { token: i0.ApplicationRef }, { token: AppService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
4544
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TranslationsService, deps: [{ token: i2.ConfigService }, { token: i0.Injector }, { token: i2$1.ActivatedRoute, optional: true }, { token: I18N_CONFIG, optional: true }, { token: i1.TranslateService }, { token: i0.ApplicationRef }, { token: AppService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
4471
4545
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TranslationsService, providedIn: 'root' }); }
4472
4546
  }
4473
4547
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: TranslationsService, decorators: [{
4474
4548
  type: Injectable,
4475
4549
  args: [{ providedIn: 'root' }]
4476
- }], ctorParameters: () => [{ type: i2.ConfigService }, { type: i2$1.ActivatedRoute }, { type: i2.SessionStorageService }, { type: i1.TranslateService }, { type: i2.SessionStorageService }, { type: i0.ApplicationRef }, { type: AppService, decorators: [{
4550
+ }], ctorParameters: () => [{ type: i2.ConfigService }, { type: i0.Injector }, { type: i2$1.ActivatedRoute, decorators: [{
4551
+ type: Optional
4552
+ }] }, { type: I18nConfig, decorators: [{
4553
+ type: Optional
4554
+ }, {
4555
+ type: Inject,
4556
+ args: [I18N_CONFIG]
4557
+ }] }, { type: i1.TranslateService }, { type: i0.ApplicationRef }, { type: AppService, decorators: [{
4477
4558
  type: Optional
4478
4559
  }] }] });
4479
4560
 
@@ -7209,8 +7290,6 @@ const TRANSLATION_LIST = [
7209
7290
  ];
7210
7291
  let TranslationLoader = TranslationLoader_1 = class TranslationLoader {
7211
7292
  static create(http, configService, configuration, assetsBasePath, additionalI18nProvider) {
7212
- console.log('ASSETS_BASE_PATH', assetsBasePath);
7213
- console.log('ADDITIONAL_I18N_PROVIDER', assetsBasePath);
7214
7293
  return new TranslationLoader_1(assetsBasePath, additionalI18nProvider, http, configService, configuration);
7215
7294
  }
7216
7295
  constructor(assetsBasePath, additionalI18nProvider, http, configService, configuration, prefix = (assetsBasePath ?? '') + 'assets/i18n', suffix = '.json') {
@@ -7423,6 +7502,7 @@ class TranslationsModule {
7423
7502
  HttpClient,
7424
7503
  ConfigService,
7425
7504
  EduSharingUiConfiguration,
7505
+ [new Optional(), I18N_CONFIG],
7426
7506
  [new Optional(), ASSETS_BASE_PATH],
7427
7507
  [new Optional(), ADDITIONAL_I18N_PROVIDER],
7428
7508
  ],
@@ -7446,6 +7526,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
7446
7526
  HttpClient,
7447
7527
  ConfigService,
7448
7528
  EduSharingUiConfiguration,
7529
+ [new Optional(), I18N_CONFIG],
7449
7530
  [new Optional(), ASSETS_BASE_PATH],
7450
7531
  [new Optional(), ADDITIONAL_I18N_PROVIDER],
7451
7532
  ],
@@ -7519,5 +7600,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
7519
7600
  * Generated bundle index. Do not edit.
7520
7601
  */
7521
7602
 
7522
- export { ADDITIONAL_I18N_PROVIDER, ASSETS_BASE_PATH, AccessibilityService, AccessibilitySettings, ActionbarComponent, AppContainerService, AppService, BorderBoxObserverDirective, CheckTextOverflowDirective, ClickSource, ColorHelper, CombinedDataSource, Constrain, CustomFieldSpecialType, CustomOptions, CustomSelectionModel, CustomTemplatesDataSource, DateHelper, DefaultGroups, DropdownComponent, DurationFormat, DurationHelper, EDU_SHARING_UI_CONFIG, EduSharingUiCommonModule, EduSharingUiConfiguration, EduSharingUiModule, ElementType, FallbackTranslationHandler, FocusStateDirective, FormatDatePipe, FormatDurationPipe, FormatOptions, FormatSizePipe, Helper, HideMode, IconDirective, InfiniteScrollDirective, InteractionType, ItemsCap, KeyboardShortcutsService, ListBaseComponent, ListCountsComponent, ListItem, ListItemLabelPipe, ListItemSort, ListItemsModule, ListTextComponent, LocalEventsService, MdsHelperService, MdsModule, NodeCache, NodeDataSource, NodeDataSourceRemote, NodeEntriesDisplayType, NodeEntriesGlobalService, NodeEntriesModule, NodeEntriesService, NodeEntriesWrapperComponent, NodeHelperService, NodeIconPipe, NodeImagePipe, NodeImageSizePipe, NodeLicensePipe, NodePersonNamePipe, NodeRowComponent, NodeTitlePipe, NodeUrlComponent, NodesDragDirective, NodesDragDropService, NodesDragSourceDirective, NodesDropTargetDirective, NodesRightMode, OPEN_URL_MODE, OptionGroup, OptionItem, OptionsHelperDataService, OptionsHelperService, PreferredColor, PropertySlugPipe, RelativeMode, RenderHelperService, RepoUrlService, RestHelper, Scope, SearchHelperService, SortDropdownComponent, SortEvent, SpinnerComponent, TRANSLATION_LIST, Target, TemporaryStorageService, Toast, ToastDuration, TranslationLoader, TranslationsModule, TranslationsService, UIAnimation, UIConstants, UIService, VCard, VCardNamePipe, WORKFLOW_STATUS_CHECKED, WORKFLOW_STATUS_HASFLAWS, WORKFLOW_STATUS_TO_CHECK, WORKFLOW_STATUS_UNCHECKED, clearDraggedNodes, dragNodesTransferType, getConfigProvider, isNumeric, isTrue, macroTick, matchesShortcutCondition, microTick, notNull, readDraggedNodes, saveDraggedNodes };
7603
+ export { ADDITIONAL_I18N_PROVIDER, ASSETS_BASE_PATH, AccessibilityService, AccessibilitySettings, ActionbarComponent, AppContainerService, AppService, BorderBoxObserverDirective, CheckTextOverflowDirective, ClickSource, ColorHelper, CombinedDataSource, Constrain, CustomFieldSpecialType, CustomOptions, CustomSelectionModel, CustomTemplatesDataSource, DateHelper, DefaultGroups, DropdownComponent, DurationFormat, DurationHelper, EDU_SHARING_UI_CONFIG, EduSharingUiCommonModule, EduSharingUiConfiguration, EduSharingUiModule, ElementType, FallbackTranslationHandler, FocusStateDirective, FormatDatePipe, FormatDurationPipe, FormatOptions, FormatSizePipe, Helper, HideMode, I18N_CONFIG, I18nConfig, IconDirective, InfiniteScrollDirective, InteractionType, ItemsCap, KeyboardShortcutsService, ListBaseComponent, ListCountsComponent, ListItem, ListItemLabelPipe, ListItemSort, ListItemsModule, ListTextComponent, LocalEventsService, MdsHelperService, MdsModule, NodeCache, NodeDataSource, NodeDataSourceRemote, NodeEntriesDisplayType, NodeEntriesGlobalService, NodeEntriesModule, NodeEntriesService, NodeEntriesWrapperComponent, NodeHelperService, NodeIconPipe, NodeImagePipe, NodeImageSizePipe, NodeLicensePipe, NodePersonNamePipe, NodeRowComponent, NodeTitlePipe, NodeUrlComponent, NodesDragDirective, NodesDragDropService, NodesDragSourceDirective, NodesDropTargetDirective, NodesRightMode, OPEN_URL_MODE, OptionGroup, OptionItem, OptionsHelperDataService, OptionsHelperService, PreferredColor, PropertySlugPipe, RelativeMode, RenderHelperService, RepoUrlService, RestHelper, Scope, SearchHelperService, SortDropdownComponent, SortEvent, SpinnerComponent, TRANSLATION_LIST, Target, TemporaryStorageService, Toast, ToastDuration, TranslationLoader, TranslationsModule, TranslationsService, UIAnimation, UIConstants, UIService, VCard, VCardNamePipe, WORKFLOW_STATUS_CHECKED, WORKFLOW_STATUS_HASFLAWS, WORKFLOW_STATUS_TO_CHECK, WORKFLOW_STATUS_UNCHECKED, clearDraggedNodes, dragNodesTransferType, getConfigProvider, isNumeric, isTrue, macroTick, matchesShortcutCondition, microTick, notNull, readDraggedNodes, saveDraggedNodes };
7523
7604
  //# sourceMappingURL=ngx-edu-sharing-ui.mjs.map