@umbraco-cms/backoffice 14.0.0--preview004-168c444e → 14.0.0--preview004-ec083258

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.
@@ -1646,8 +1646,8 @@ export default {
1646
1646
  groupsHelp: 'Add groups to assign access and permissions',
1647
1647
  inviteAnotherUser: 'Invite another user',
1648
1648
  inviteUserHelp: 'Invite new users to give them access to Umbraco. An invite email will be sent to the\n user with information on how to log in to Umbraco. Invites last for 72 hours.\n ',
1649
- language: 'Language',
1650
- languageHelp: 'Set the language you will see in menus and dialogs',
1649
+ language: 'UI Culture',
1650
+ languageHelp: 'Set the culture you will see in menus and dialogs',
1651
1651
  lastLockoutDate: 'Last lockout date',
1652
1652
  lastLogin: 'Last login',
1653
1653
  lastPasswordChangeDate: 'Password last changed',
@@ -1782,8 +1782,8 @@ export default {
1782
1782
  inviteAnotherUser: 'Invite another user',
1783
1783
  inviteUserHelp:
1784
1784
  'Invite new users to give them access to Umbraco. An invite email will be sent to the\n user with information on how to log in to Umbraco. Invites last for 72 hours.\n ',
1785
- language: 'Language',
1786
- languageHelp: 'Set the language you will see in menus and dialogs',
1785
+ language: 'UI Culture',
1786
+ languageHelp: 'Set the culture you will see in menus and dialogs',
1787
1787
  lastLockoutDate: 'Last lockout date',
1788
1788
  lastLogin: 'Last login',
1789
1789
  lastPasswordChangeDate: 'Password last changed',
@@ -2754,6 +2754,28 @@
2754
2754
  }
2755
2755
  ]
2756
2756
  },
2757
+ {
2758
+ "name": "umb-ui-culture-input",
2759
+ "path": "./../src/packages/core/localization/components/ui-culture-input/ui-culture-input.element.ts",
2760
+ "attributes": [
2761
+ {
2762
+ "name": "value",
2763
+ "type": "FormDataEntryValue | FormData"
2764
+ }
2765
+ ],
2766
+ "properties": [
2767
+ {
2768
+ "name": "value",
2769
+ "attribute": "value",
2770
+ "type": "FormDataEntryValue | FormData"
2771
+ },
2772
+ {
2773
+ "name": "styles",
2774
+ "type": "array",
2775
+ "default": "[null]"
2776
+ }
2777
+ ]
2778
+ },
2757
2779
  {
2758
2780
  "name": "umb-localize-date",
2759
2781
  "path": "./../src/packages/core/localization/localize-date.element.ts",
@@ -7,7 +7,7 @@ export const data = [
7
7
  mediaStartNodeIds: [],
8
8
  name: 'Umbraco User',
9
9
  email: 'noreply@umbraco.com',
10
- languageIsoCode: 'en-US',
10
+ languageIsoCode: 'en-us',
11
11
  state: UserStateModel.ACTIVE,
12
12
  lastLoginDate: '9/10/2022',
13
13
  lastLockoutDate: '11/23/2021',
@@ -24,7 +24,7 @@ export const data = [
24
24
  mediaStartNodeIds: ['f2f81a40-c989-4b6b-84e2-057cecd3adc1'],
25
25
  name: 'Amelie Walker',
26
26
  email: 'awalker1@domain.com',
27
- languageIsoCode: 'Japanese',
27
+ languageIsoCode: 'da-dk',
28
28
  state: UserStateModel.INACTIVE,
29
29
  lastLoginDate: '2023-10-12T18:30:32.879Z',
30
30
  lastLockoutDate: null,
@@ -41,7 +41,7 @@ export const data = [
41
41
  mediaStartNodeIds: [],
42
42
  name: 'Oliver Kim',
43
43
  email: 'okim1@domain.com',
44
- languageIsoCode: 'Russian',
44
+ languageIsoCode: 'da-dk',
45
45
  state: UserStateModel.ACTIVE,
46
46
  lastLoginDate: '2023-10-12T18:30:32.879Z',
47
47
  lastLockoutDate: null,
@@ -58,7 +58,7 @@ export const data = [
58
58
  mediaStartNodeIds: [],
59
59
  name: 'Eliana Nieves',
60
60
  email: 'enieves1@domain.com',
61
- languageIsoCode: 'Spanish',
61
+ languageIsoCode: 'en-us',
62
62
  state: UserStateModel.INVITED,
63
63
  lastLoginDate: '2023-10-12T18:30:32.879Z',
64
64
  lastLockoutDate: null,
@@ -75,7 +75,7 @@ export const data = [
75
75
  mediaStartNodeIds: [],
76
76
  name: 'Jasmine Patel',
77
77
  email: 'jpatel1@domain.com',
78
- languageIsoCode: 'Hindi',
78
+ languageIsoCode: 'en-us',
79
79
  state: UserStateModel.LOCKED_OUT,
80
80
  lastLoginDate: '2023-10-12T18:30:32.879Z',
81
81
  lastLockoutDate: '2023-10-12T18:30:32.879Z',
@@ -0,0 +1,2 @@
1
+ import './ui-culture-input/ui-culture-input.element.js';
2
+ export { UmbUiCultureInputElement } from './ui-culture-input/ui-culture-input.element.js';
@@ -0,0 +1,2 @@
1
+ import './ui-culture-input/ui-culture-input.element.js';
2
+ export { UmbUiCultureInputElement } from './ui-culture-input/ui-culture-input.element.js';
@@ -0,0 +1,19 @@
1
+ import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
2
+ declare const UmbUiCultureInputElement_base: (new (...args: any[]) => import("../../../../../external/uui/index.js").FormControlMixinInterface) & typeof UmbLitElement;
3
+ export declare class UmbUiCultureInputElement extends UmbUiCultureInputElement_base {
4
+ #private;
5
+ private _options;
6
+ private _selectElement;
7
+ get value(): FormDataEntryValue | FormData;
8
+ set value(value: FormDataEntryValue | FormData);
9
+ constructor();
10
+ protected getFormElement(): HTMLInputElement;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ static styles: import("@lit/reactive-element/css-tag").CSSResult[];
13
+ }
14
+ export default UmbUiCultureInputElement;
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'umb-ui-culture-input': UmbUiCultureInputElement;
18
+ }
19
+ }
@@ -0,0 +1,79 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { UmbChangeEvent } from '../../../event/index.js';
8
+ import { css, html, customElement, query, state, property } from '../../../../../external/lit/index.js';
9
+ import { FormControlMixin } from '../../../../../external/uui/index.js';
10
+ import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
11
+ import { umbExtensionsRegistry } from '../../../extension-registry/index.js';
12
+ export let UmbUiCultureInputElement = class UmbUiCultureInputElement extends FormControlMixin(UmbLitElement) {
13
+ get value() {
14
+ return this._value;
15
+ }
16
+ set value(value) {
17
+ if (typeof value === 'string') {
18
+ const oldValue = this._value;
19
+ this._value = value.toLowerCase();
20
+ this.requestUpdate('value', oldValue);
21
+ }
22
+ }
23
+ constructor() {
24
+ super();
25
+ this._options = [];
26
+ this.#observeTranslations();
27
+ }
28
+ #observeTranslations() {
29
+ this.observe(umbExtensionsRegistry.extensionsOfType('localization'), (localizationManifests) => {
30
+ this.#mapToOptions(localizationManifests);
31
+ }, 'umbObserveLocalizationManifests');
32
+ }
33
+ #mapToOptions(manifests) {
34
+ this._options = manifests
35
+ .filter((isoCode) => isoCode !== undefined)
36
+ .map((manifest) => ({
37
+ name: manifest.name,
38
+ value: manifest.meta.culture.toLowerCase(),
39
+ }));
40
+ }
41
+ getFormElement() {
42
+ return this._selectElement;
43
+ }
44
+ #onChange(event) {
45
+ event.stopPropagation();
46
+ const target = event.target;
47
+ if (typeof target?.value === 'string') {
48
+ this.value = target.value;
49
+ this.dispatchEvent(new UmbChangeEvent());
50
+ }
51
+ }
52
+ render() {
53
+ return html ` <uui-combobox value="${this._value}" @change=${this.#onChange}>
54
+ <uui-combobox-list>
55
+ ${this._options.map((option) => html `<uui-combobox-list-option value="${option.value}">${option.name}</uui-combobox-list-option>`)}
56
+ </uui-combobox-list>
57
+ </uui-combobox>`;
58
+ }
59
+ static { this.styles = [
60
+ css `
61
+ :host {
62
+ display: block;
63
+ }
64
+ `,
65
+ ]; }
66
+ };
67
+ __decorate([
68
+ state()
69
+ ], UmbUiCultureInputElement.prototype, "_options", void 0);
70
+ __decorate([
71
+ query('uui-combobox')
72
+ ], UmbUiCultureInputElement.prototype, "_selectElement", void 0);
73
+ __decorate([
74
+ property({ type: String })
75
+ ], UmbUiCultureInputElement.prototype, "value", null);
76
+ UmbUiCultureInputElement = __decorate([
77
+ customElement('umb-ui-culture-input')
78
+ ], UmbUiCultureInputElement);
79
+ export default UmbUiCultureInputElement;
@@ -3,3 +3,4 @@ import './localize-date.element.js';
3
3
  import './localize-number.element.js';
4
4
  import './localize-relative-time.element.js';
5
5
  export * from './registry/localization.registry.js';
6
+ export { UmbUiCultureInputElement } from './components/index.js';
@@ -3,3 +3,4 @@ import './localize-date.element.js';
3
3
  import './localize-number.element.js';
4
4
  import './localize-relative-time.element.js';
5
5
  export * from './registry/localization.registry.js';
6
+ export { UmbUiCultureInputElement } from './components/index.js';
@@ -2,8 +2,6 @@ import { UmbLitElement } from '../../../../../../shared/lit-element/index.js';
2
2
  export declare class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
3
3
  #private;
4
4
  private _user?;
5
- private _currentUser?;
6
- private languages;
7
5
  constructor();
8
6
  render(): import("lit-html").TemplateResult<1>;
9
7
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
@@ -8,64 +8,21 @@ import { UMB_USER_WORKSPACE_CONTEXT } from '../../user-workspace.context.js';
8
8
  import { html, customElement, state, ifDefined, css } from '../../../../../../external/lit/index.js';
9
9
  import { UmbLitElement } from '../../../../../../shared/lit-element/index.js';
10
10
  import { UmbTextStyles } from '../../../../../../shared/style/index.js';
11
- import { UMB_CURRENT_USER_CONTEXT } from '../../../../current-user/index.js';
12
- import { firstValueFrom } from '../../../../../../external/rxjs/index.js';
13
- import { umbExtensionsRegistry } from '../../../../../core/extension-registry/index.js';
14
11
  export let UmbUserWorkspaceProfileSettingsElement = class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
15
- #currentUserContext;
16
12
  #userWorkspaceContext;
17
13
  constructor() {
18
14
  super();
19
- this.languages = [];
20
- this.consumeContext(UMB_CURRENT_USER_CONTEXT, (instance) => {
21
- this.#currentUserContext = instance;
22
- this.#observeCurrentUser();
23
- });
24
15
  this.consumeContext(UMB_USER_WORKSPACE_CONTEXT, (instance) => {
25
16
  this.#userWorkspaceContext = instance;
26
17
  this.observe(this.#userWorkspaceContext.data, (user) => (this._user = user), 'umbUserObserver');
27
18
  });
28
19
  }
29
20
  #onLanguageChange(event) {
30
- const target = event.composedPath()[0];
21
+ const target = event.target;
31
22
  if (typeof target?.value === 'string') {
32
23
  this.#userWorkspaceContext?.updateProperty('languageIsoCode', target.value);
33
24
  }
34
25
  }
35
- #observeCurrentUser() {
36
- if (!this.#currentUserContext)
37
- return;
38
- this.observe(this.#currentUserContext.currentUser, async (currentUser) => {
39
- this._currentUser = currentUser;
40
- if (!currentUser) {
41
- return;
42
- }
43
- // Find all translations and make a unique list of iso codes
44
- const translations = await firstValueFrom(umbExtensionsRegistry.extensionsOfType('localization'));
45
- this.languages = translations
46
- .filter((isoCode) => isoCode !== undefined)
47
- .map((translation) => ({
48
- value: translation.meta.culture.toLowerCase(),
49
- name: translation.name,
50
- selected: false,
51
- }));
52
- const currentUserLanguageCode = currentUser.languageIsoCode?.toLowerCase();
53
- // Set the current user's language as selected
54
- const currentUserLanguage = this.languages.find((language) => language.value === currentUserLanguageCode);
55
- if (currentUserLanguage) {
56
- currentUserLanguage.selected = true;
57
- }
58
- else {
59
- // If users language code did not fit any of the options. We will create an option that fits, named unknown.
60
- // In this way the user can keep their choice though a given language was not present at this time.
61
- this.languages.push({
62
- value: currentUserLanguageCode ?? 'en-us',
63
- name: currentUserLanguageCode ? `${currentUserLanguageCode} (unknown)` : 'Unknown',
64
- selected: true,
65
- });
66
- }
67
- }, 'umbUserObserver');
68
- }
69
26
  render() {
70
27
  return html `<uui-box>
71
28
  <div slot="headline"><umb-localize key="user_profile">Profile</umb-localize></div>
@@ -89,13 +46,12 @@ export let UmbUserWorkspaceProfileSettingsElement = class UmbUserWorkspaceProfil
89
46
  <umb-workspace-property-layout
90
47
  label="${this.localize.term('user_language')}"
91
48
  description=${this.localize.term('user_languageHelp')}>
92
- <uui-select
49
+ <umb-ui-culture-input
93
50
  slot="editor"
51
+ value=${ifDefined(this._user?.languageIsoCode)}
52
+ @change="${this.#onLanguageChange}"
94
53
  name="language"
95
- label="${this.localize.term('user_language')}"
96
- .options=${this.languages}
97
- @change="${this.#onLanguageChange}">
98
- </uui-select>
54
+ label="${this.localize.term('user_language')}"></umb-ui-culture-input>
99
55
  </umb-workspace-property-layout>
100
56
  `;
101
57
  }
@@ -111,12 +67,6 @@ export let UmbUserWorkspaceProfileSettingsElement = class UmbUserWorkspaceProfil
111
67
  __decorate([
112
68
  state()
113
69
  ], UmbUserWorkspaceProfileSettingsElement.prototype, "_user", void 0);
114
- __decorate([
115
- state()
116
- ], UmbUserWorkspaceProfileSettingsElement.prototype, "_currentUser", void 0);
117
- __decorate([
118
- state()
119
- ], UmbUserWorkspaceProfileSettingsElement.prototype, "languages", void 0);
120
70
  UmbUserWorkspaceProfileSettingsElement = __decorate([
121
71
  customElement('umb-user-workspace-profile-settings')
122
72
  ], UmbUserWorkspaceProfileSettingsElement);