@umbraco-cms/backoffice 14.0.0--preview004-3ba57be2 → 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.
- package/dist-cms/apps/backoffice/components/backoffice-header-sections.element.d.ts +0 -5
- package/dist-cms/apps/backoffice/components/backoffice-header-sections.element.js +7 -52
- package/dist-cms/assets/lang/en-us.js +2 -2
- package/dist-cms/assets/lang/en-us.ts +2 -2
- package/dist-cms/custom-elements.json +22 -0
- package/dist-cms/mocks/data/user/user.data.js +5 -5
- package/dist-cms/packages/core/components/body-layout/body-layout.element.js +2 -1
- package/dist-cms/packages/core/localization/components/index.d.ts +2 -0
- package/dist-cms/packages/core/localization/components/index.js +2 -0
- package/dist-cms/packages/core/localization/components/ui-culture-input/ui-culture-input.element.d.ts +19 -0
- package/dist-cms/packages/core/localization/components/ui-culture-input/ui-culture-input.element.js +79 -0
- package/dist-cms/packages/core/localization/index.d.ts +1 -0
- package/dist-cms/packages/core/localization/index.js +1 -0
- package/dist-cms/packages/core/section/section-main/section-main.element.js +2 -1
- package/dist-cms/packages/user/user/workspace/components/user-workspace-profile-settings/user-workspace-profile-settings.element.d.ts +0 -2
- package/dist-cms/packages/user/user/workspace/components/user-workspace-profile-settings/user-workspace-profile-settings.element.js +5 -55
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +13 -2
- package/package.json +1 -1
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { CSSResultGroup } from '../../../external/lit/index.js';
|
|
2
2
|
import { UmbLitElement } from '../../../shared/lit-element/index.js';
|
|
3
3
|
export declare class UmbBackofficeHeaderSectionsElement extends UmbLitElement {
|
|
4
|
-
private _open;
|
|
5
4
|
private _sections;
|
|
6
|
-
private _extraSections;
|
|
7
5
|
private _currentSectionAlias;
|
|
8
6
|
private _backofficeContext?;
|
|
9
7
|
constructor();
|
|
10
|
-
private _handleMore;
|
|
11
|
-
private _handleLabelClick;
|
|
12
8
|
private _observeSections;
|
|
13
9
|
private _observeCurrentSection;
|
|
14
10
|
private _renderSections;
|
|
15
|
-
private _renderExtraSections;
|
|
16
11
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
12
|
static styles: CSSResultGroup;
|
|
18
13
|
}
|
|
@@ -5,14 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { UMB_BACKOFFICE_CONTEXT_TOKEN } from '../backoffice.context.js';
|
|
8
|
-
import { css, html,
|
|
8
|
+
import { css, html, customElement, state, repeat } from '../../../external/lit/index.js';
|
|
9
9
|
import { UmbLitElement } from '../../../shared/lit-element/index.js';
|
|
10
10
|
export let UmbBackofficeHeaderSectionsElement = class UmbBackofficeHeaderSectionsElement extends UmbLitElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
|
-
this._open = false;
|
|
14
13
|
this._sections = [];
|
|
15
|
-
this._extraSections = [];
|
|
16
14
|
this._currentSectionAlias = '';
|
|
17
15
|
this.consumeContext(UMB_BACKOFFICE_CONTEXT_TOKEN, (backofficeContext) => {
|
|
18
16
|
this._backofficeContext = backofficeContext;
|
|
@@ -20,15 +18,6 @@ export let UmbBackofficeHeaderSectionsElement = class UmbBackofficeHeaderSection
|
|
|
20
18
|
this._observeCurrentSection();
|
|
21
19
|
});
|
|
22
20
|
}
|
|
23
|
-
_handleMore(e) {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
this._open = !this._open;
|
|
26
|
-
}
|
|
27
|
-
_handleLabelClick() {
|
|
28
|
-
const moreTab = this.shadowRoot?.getElementById('moreTab');
|
|
29
|
-
moreTab?.setAttribute('active', 'true');
|
|
30
|
-
this._open = false;
|
|
31
|
-
}
|
|
32
21
|
_observeSections() {
|
|
33
22
|
if (!this._backofficeContext)
|
|
34
23
|
return;
|
|
@@ -54,67 +43,33 @@ export let UmbBackofficeHeaderSectionsElement = class UmbBackofficeHeaderSection
|
|
|
54
43
|
href="${`section/${section.manifest?.meta.pathname}`}"
|
|
55
44
|
label="${section.manifest?.meta.label ?? section.manifest?.name ?? ''}"></uui-tab>
|
|
56
45
|
`)}
|
|
57
|
-
${this._renderExtraSections()}
|
|
58
46
|
</uui-tab-group>
|
|
59
47
|
`;
|
|
60
48
|
}
|
|
61
|
-
_renderExtraSections() {
|
|
62
|
-
return when(this._extraSections.length > 0, () => html `
|
|
63
|
-
<uui-tab id="moreTab">
|
|
64
|
-
<uui-popover .open=${this._open} placement="bottom-start" @close="${() => (this._open = false)}">
|
|
65
|
-
<uui-button slot="trigger" look="primary" label="More" @click="${this._handleMore}" compact>
|
|
66
|
-
<uui-symbol-more></uui-symbol-more>
|
|
67
|
-
</uui-button>
|
|
68
|
-
|
|
69
|
-
<div slot="popover" id="dropdown">
|
|
70
|
-
${this._extraSections.map((section) => html `
|
|
71
|
-
<uui-menu-item
|
|
72
|
-
?active="${this._currentSectionAlias === section.alias}"
|
|
73
|
-
label="${section.meta.label || section.name}"
|
|
74
|
-
@click-label="${this._handleLabelClick}"></uui-menu-item>
|
|
75
|
-
`)}
|
|
76
|
-
</div>
|
|
77
|
-
</uui-popover>
|
|
78
|
-
</uui-tab>
|
|
79
|
-
`);
|
|
80
|
-
}
|
|
81
49
|
render() {
|
|
82
50
|
return html ` ${this._renderSections()} `;
|
|
83
51
|
}
|
|
84
52
|
static { this.styles = [
|
|
85
53
|
css `
|
|
54
|
+
:host {
|
|
55
|
+
display: contents;
|
|
56
|
+
}
|
|
86
57
|
#tabs {
|
|
87
|
-
color: var(--uui-color-header-contrast);
|
|
88
58
|
height: 60px;
|
|
59
|
+
flex-basis: 100%;
|
|
89
60
|
font-size: 16px;
|
|
90
61
|
--uui-tab-text: var(--uui-color-header-contrast);
|
|
91
62
|
--uui-tab-text-hover: var(--uui-color-header-contrast-emphasis);
|
|
92
63
|
--uui-tab-text-active: var(--uui-color-header-contrast-emphasis);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
#dropdown {
|
|
97
|
-
background-color: white;
|
|
98
|
-
border-radius: var(--uui-border-radius);
|
|
99
|
-
width: 100%;
|
|
100
|
-
height: 100%;
|
|
101
|
-
box-sizing: border-box;
|
|
102
|
-
box-shadow: var(--uui-shadow-depth-3);
|
|
103
|
-
min-width: 200px;
|
|
104
|
-
color: black; /* Change to variable */
|
|
64
|
+
background-color: var(--uui-color-header-background);
|
|
65
|
+
--uui-tab-group-dropdown-background: var(--uui-color-header-surface);
|
|
105
66
|
}
|
|
106
67
|
`,
|
|
107
68
|
]; }
|
|
108
69
|
};
|
|
109
|
-
__decorate([
|
|
110
|
-
state()
|
|
111
|
-
], UmbBackofficeHeaderSectionsElement.prototype, "_open", void 0);
|
|
112
70
|
__decorate([
|
|
113
71
|
state()
|
|
114
72
|
], UmbBackofficeHeaderSectionsElement.prototype, "_sections", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
state()
|
|
117
|
-
], UmbBackofficeHeaderSectionsElement.prototype, "_extraSections", void 0);
|
|
118
73
|
__decorate([
|
|
119
74
|
state()
|
|
120
75
|
], UmbBackofficeHeaderSectionsElement.prototype, "_currentSectionAlias", void 0);
|
|
@@ -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: '
|
|
1650
|
-
languageHelp: 'Set the
|
|
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: '
|
|
1786
|
-
languageHelp: 'Set the
|
|
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-
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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',
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { UmbTextStyles } from
|
|
7
|
+
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, LitElement, nothing, customElement, property, state, query, } from '../../../../external/lit/index.js';
|
|
9
9
|
//TODO: Add the following attributes to JSDocs: header-transparent, main-no-padding, header-no-padding, header-fit-height
|
|
10
10
|
/**
|
|
@@ -169,6 +169,7 @@ export let UmbBodyLayoutElement = class UmbBodyLayoutElement extends LitElement
|
|
|
169
169
|
height: 100%;
|
|
170
170
|
align-items: center;
|
|
171
171
|
box-sizing: border-box;
|
|
172
|
+
min-width: 0;
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
#navigation-slot,
|
|
@@ -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
|
+
}
|
package/dist-cms/packages/core/localization/components/ui-culture-input/ui-culture-input.element.js
ADDED
|
@@ -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;
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { UmbTextStyles } from
|
|
7
|
+
import { UmbTextStyles } from '../../../../shared/style/index.js';
|
|
8
8
|
import { css, html, LitElement, customElement } from '../../../../external/lit/index.js';
|
|
9
9
|
export let UmbSectionMainElement = class UmbSectionMainElement extends LitElement {
|
|
10
10
|
render() {
|
|
@@ -20,6 +20,7 @@ export let UmbSectionMainElement = class UmbSectionMainElement extends LitElemen
|
|
|
20
20
|
:host {
|
|
21
21
|
flex: 1 1 auto;
|
|
22
22
|
height: 100%;
|
|
23
|
+
min-width: 0;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
main {
|
|
@@ -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.
|
|
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
|
-
<
|
|
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);
|