@umbraco-cms/backoffice 14.0.0--preview005-afb72093 → 14.0.0--preview005-268981cb

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/dist-cms/custom-elements.json +14 -0
  2. package/dist-cms/mocks/data/document/document.data.js +1 -1
  3. package/dist-cms/packages/core/components/input-multi-url/input-multi-url.element.js +3 -2
  4. package/dist-cms/packages/core/modal/common/link-picker/link-picker-modal.element.js +7 -8
  5. package/dist-cms/packages/core/modal/token/link-picker-modal.token.d.ts +3 -1
  6. package/dist-cms/packages/core/property-editor/uis/tiny-mce/plugins/tiny-mce-linkpicker.plugin.js +4 -4
  7. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/culture-and-hostnames.action.d.ts +9 -0
  8. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/culture-and-hostnames.action.js +37 -0
  9. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/index.d.ts +2 -0
  10. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/index.js +2 -0
  11. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/manifests.d.ts +2 -0
  12. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/manifests.js +27 -0
  13. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.d.ts +19 -0
  14. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.js +236 -0
  15. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.token.d.ts +10 -0
  16. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.token.js +7 -0
  17. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/modal/index.d.ts +2 -0
  18. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/modal/index.js +2 -0
  19. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.repository.d.ts +18 -0
  20. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.repository.js +47 -0
  21. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.server.data.d.ts +30 -0
  22. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/culture-and-hostnames.server.data.js +53 -0
  23. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/index.d.ts +2 -0
  24. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/index.js +2 -0
  25. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/manifests.d.ts +3 -0
  26. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames/repository/manifests.js +9 -0
  27. package/dist-cms/packages/documents/documents/entity-actions/index.d.ts +1 -0
  28. package/dist-cms/packages/documents/documents/entity-actions/index.js +1 -0
  29. package/dist-cms/packages/documents/documents/entity-actions/manifests.js +2 -14
  30. package/dist-cms/packages/documents/documents/index.d.ts +1 -0
  31. package/dist-cms/packages/documents/documents/index.js +1 -0
  32. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  33. package/dist-cms/vscode-html-custom-data.json +5 -0
  34. package/package.json +2 -2
  35. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames.action.d.ts +0 -7
  36. package/dist-cms/packages/documents/documents/entity-actions/culture-and-hostnames.action.js +0 -10
@@ -6537,6 +6537,20 @@
6537
6537
  }
6538
6538
  ]
6539
6539
  },
6540
+ {
6541
+ "name": "umb-culture-and-hostnames-modal",
6542
+ "path": "./../src/packages/documents/documents/entity-actions/culture-and-hostnames/modal/culture-and-hostnames-modal.element.ts",
6543
+ "properties": [
6544
+ {
6545
+ "name": "popoverContainerElement"
6546
+ },
6547
+ {
6548
+ "name": "styles",
6549
+ "type": "array",
6550
+ "default": "[\"UmbTextStyles\",null]"
6551
+ }
6552
+ ]
6553
+ },
6540
6554
  {
6541
6555
  "name": "umb-permissions-modal",
6542
6556
  "path": "./../src/packages/documents/documents/entity-actions/permissions/permissions-modal.element.ts",
@@ -28,7 +28,7 @@ export const data = [
28
28
  blocks: {},
29
29
  markup: `
30
30
  <p>
31
- Some value for the RTE with an <a href="https://google.com">external link</a> and an <a href="/{localLink:umb://document/c05da24d7740447b9cdcbd8ce2172e38}">internal link</a> foo foo
31
+ Some value for the RTE with an <a href="https://google.com">external link</a> and an <a type="document" href="/{localLink:c05da24d-7740-447b-9cdc-bd8ce2172e38}">internal link</a> foo foo
32
32
  </p>
33
33
  <div class="umb-macro-holder TestMacro umb-macro-mce_1 mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="TestMacro" /> --><ins>Macro alias: <strong>TestMacro</strong></ins></div>
34
34
  <p>The following tests the embed plugin:</p>
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { css, html, customElement, property, state } from '../../../../external/lit/index.js';
8
8
  import { FormControlMixin } from '../../../../external/uui/index.js';
9
9
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
10
- import { UMB_LINK_PICKER_MODAL, UmbModalRouteRegistrationController, } from '../../modal/index.js';
10
+ import { UMB_LINK_PICKER_MODAL, UmbModalRouteRegistrationController } from '../../modal/index.js';
11
11
  /**
12
12
  * @element umb-input-multi-url
13
13
  * @fires change - when the value of the input changes
@@ -91,7 +91,8 @@ let UmbInputMultiUrlElement = class UmbInputMultiUrlElement extends FormControlM
91
91
  queryString: data?.queryString,
92
92
  target: data?.target,
93
93
  trashed: data?.trashed,
94
- udi: data?.udi,
94
+ type: data?.type,
95
+ unique: data?.unique,
95
96
  url: data?.url,
96
97
  },
97
98
  },
@@ -12,7 +12,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _UmbLinkPickerModalElement_instances, _UmbLinkPickerModalElement_handleQueryString, _UmbLinkPickerModalElement_handleSelectionChange, _UmbLinkPickerModalElement_partialUpdateLink;
13
13
  import { css, html, nothing, customElement, query, state, styleMap } from '../../../../../external/lit/index.js';
14
14
  import { UmbModalBaseElement } from '../../index.js';
15
- import { buildUdi, getKeyFromUdi } from '../../../../../shared/utils/index.js';
16
15
  import { UMB_DOCUMENT_TREE_ALIAS } from '../../../../documents/documents/index.js';
17
16
  let UmbLinkPickerModalElement = class UmbLinkPickerModalElement extends UmbModalBaseElement {
18
17
  constructor() {
@@ -41,7 +40,7 @@ let UmbLinkPickerModalElement = class UmbLinkPickerModalElement extends UmbModal
41
40
  if (this.modalContext) {
42
41
  this.observe(this.modalContext.value, (value) => {
43
42
  this._link = value.link;
44
- this._selectedKey = this._link?.udi ? getKeyFromUdi(this._link.udi) : undefined;
43
+ this._selectedKey = this._link?.unique ?? undefined;
45
44
  this._selectionConfiguration.selection = this._selectedKey ? [this._selectedKey] : [];
46
45
  });
47
46
  }
@@ -92,9 +91,9 @@ let UmbLinkPickerModalElement = class UmbLinkPickerModalElement extends UmbModal
92
91
  id="link-input"
93
92
  placeholder=${this.localize.term('general_url')}
94
93
  label=${this.localize.term('general_url')}
95
- .value="${this._link.udi ?? this._link.url ?? ''}"
96
- @input=${() => __classPrivateFieldGet(this, _UmbLinkPickerModalElement_instances, "m", _UmbLinkPickerModalElement_partialUpdateLink).call(this, { url: this._linkInput.value })}
97
- ?disabled="${this._link.udi ? true : false}"></uui-input>
94
+ .value="${this._link.unique ?? this._link.url ?? ''}"
95
+ @input=${() => __classPrivateFieldGet(this, _UmbLinkPickerModalElement_instances, "m", _UmbLinkPickerModalElement_partialUpdateLink).call(this, { type: 'external', url: this._linkInput.value })}
96
+ ?disabled="${this._link.unique ? true : false}"></uui-input>
98
97
  </span>`;
99
98
  }
100
99
  _renderAnchorInput() {
@@ -168,16 +167,16 @@ _UmbLinkPickerModalElement_handleSelectionChange = function _UmbLinkPickerModalE
168
167
  const selection = element.getSelection();
169
168
  const selectedKey = selection[selection.length - 1];
170
169
  if (!selectedKey) {
171
- __classPrivateFieldGet(this, _UmbLinkPickerModalElement_instances, "m", _UmbLinkPickerModalElement_partialUpdateLink).call(this, { udi: '', url: undefined });
170
+ __classPrivateFieldGet(this, _UmbLinkPickerModalElement_instances, "m", _UmbLinkPickerModalElement_partialUpdateLink).call(this, { type: undefined, unique: '', url: undefined });
172
171
  this._selectedKey = undefined;
173
172
  this._selectionConfiguration.selection = [];
174
173
  this.requestUpdate();
175
174
  return;
176
175
  }
177
- const udi = buildUdi(entityType, selectedKey);
176
+ const linkType = entityType ?? 'external';
178
177
  this._selectedKey = selectedKey;
179
178
  this._selectionConfiguration.selection = [this._selectedKey];
180
- __classPrivateFieldGet(this, _UmbLinkPickerModalElement_instances, "m", _UmbLinkPickerModalElement_partialUpdateLink).call(this, { udi: udi, url: udi });
179
+ __classPrivateFieldGet(this, _UmbLinkPickerModalElement_instances, "m", _UmbLinkPickerModalElement_partialUpdateLink).call(this, { type: linkType, unique: selectedKey, url: selectedKey });
181
180
  this.requestUpdate();
182
181
  };
183
182
  _UmbLinkPickerModalElement_partialUpdateLink = function _UmbLinkPickerModalElement_partialUpdateLink(linkObject) {
@@ -14,9 +14,11 @@ export interface UmbLinkPickerLink {
14
14
  queryString?: string | null;
15
15
  target?: string | null;
16
16
  trashed?: boolean | null;
17
- udi?: string | null;
17
+ type?: UmbLinkPickerLinkType | null;
18
+ unique?: string | null;
18
19
  url?: string | null;
19
20
  }
21
+ export type UmbLinkPickerLinkType = 'document' | 'external' | 'media';
20
22
  export interface UmbLinkPickerConfig {
21
23
  hideAnchor?: boolean;
22
24
  ignoreUserStartNodes?: boolean;
@@ -66,7 +66,7 @@ class UmbTinyMceLinkPickerPlugin extends UmbTinyMcePluginBase {
66
66
  };
67
67
  if (__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_anchorElement, "f").href.includes('localLink:')) {
68
68
  const href = __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_anchorElement, "f").getAttribute('href');
69
- currentTarget.udi = href.split('localLink:')[1].slice(0, -1);
69
+ currentTarget.unique = href.split('localLink:')[1].slice(0, -1);
70
70
  }
71
71
  else if (__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_anchorElement, "f").host.length) {
72
72
  currentTarget.url = __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_anchorElement, "f").protocol ? __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_anchorElement, "f").protocol + '//' : undefined;
@@ -152,13 +152,13 @@ _UmbTinyMceLinkPickerPlugin_modalContext = new WeakMap(), _UmbTinyMceLinkPickerP
152
152
  __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f").link.queryString = urlParts[1] + urlParts[2];
153
153
  }
154
154
  }
155
- if (!__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.url && !__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.queryString && !__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.udi) {
155
+ if (!__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.url && !__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.queryString && !__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.unique) {
156
156
  this.editor.execCommand('unlink');
157
157
  return;
158
158
  }
159
159
  //if we have an id, it must be a locallink:id
160
- if (__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.udi) {
161
- __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f").link.url = '/{localLink:' + __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f").link.udi + '}';
160
+ if (__classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f")?.link.unique) {
161
+ __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f").link.url = '/{localLink:' + __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_linkPickerData, "f").link.unique + '}';
162
162
  __classPrivateFieldGet(this, _UmbTinyMceLinkPickerPlugin_instances, "m", _UmbTinyMceLinkPickerPlugin_insertLink).call(this);
163
163
  return;
164
164
  }
@@ -0,0 +1,9 @@
1
+ import { UmbEntityActionBase } from '../../../../core/entity-action/index.js';
2
+ import type { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
3
+ import { type UmbDocumentDetailRepository } from '../../index.js';
4
+ export declare class UmbDocumentCultureAndHostnamesEntityAction extends UmbEntityActionBase<UmbDocumentDetailRepository> {
5
+ #private;
6
+ constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string);
7
+ execute(): Promise<void>;
8
+ private _openModal;
9
+ }
@@ -0,0 +1,37 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _UmbDocumentCultureAndHostnamesEntityAction_modalContext;
13
+ import { UmbEntityActionBase } from '../../../../core/entity-action/index.js';
14
+ import { UMB_MODAL_MANAGER_CONTEXT } from '../../../../core/modal/index.js';
15
+ import { UMB_CULTURE_AND_HOSTNAMES_MODAL } from '../../index.js';
16
+ export class UmbDocumentCultureAndHostnamesEntityAction extends UmbEntityActionBase {
17
+ constructor(host, repositoryAlias, unique, entityType) {
18
+ super(host, repositoryAlias, unique, entityType);
19
+ _UmbDocumentCultureAndHostnamesEntityAction_modalContext.set(this, void 0);
20
+ this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => {
21
+ __classPrivateFieldSet(this, _UmbDocumentCultureAndHostnamesEntityAction_modalContext, instance, "f");
22
+ });
23
+ }
24
+ async execute() {
25
+ if (!this.repository)
26
+ return;
27
+ this._openModal(this.unique || null);
28
+ }
29
+ async _openModal(unique) {
30
+ if (!__classPrivateFieldGet(this, _UmbDocumentCultureAndHostnamesEntityAction_modalContext, "f"))
31
+ return;
32
+ __classPrivateFieldGet(this, _UmbDocumentCultureAndHostnamesEntityAction_modalContext, "f").open(UMB_CULTURE_AND_HOSTNAMES_MODAL, {
33
+ data: { unique },
34
+ });
35
+ }
36
+ }
37
+ _UmbDocumentCultureAndHostnamesEntityAction_modalContext = new WeakMap();
@@ -0,0 +1,2 @@
1
+ export * from './modal/index.js';
2
+ export * from './repository/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './modal/index.js';
2
+ export * from './repository/index.js';
@@ -0,0 +1,2 @@
1
+ import type { ManifestEntityAction, ManifestModal } from '../../../../core/extension-registry/index.js';
2
+ export declare const manifests: (ManifestModal | ManifestEntityAction)[];
@@ -0,0 +1,27 @@
1
+ import { UMB_DOCUMENT_ENTITY_TYPE } from '../../entity.js';
2
+ import { UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS } from '../../repository/index.js';
3
+ import { UmbDocumentCultureAndHostnamesEntityAction } from './culture-and-hostnames.action.js';
4
+ const entityActions = [
5
+ {
6
+ type: 'entityAction',
7
+ alias: 'Umb.EntityAction.Document.CultureAndHostnames',
8
+ name: 'Culture And Hostnames Document Entity Action',
9
+ weight: 400,
10
+ api: UmbDocumentCultureAndHostnamesEntityAction,
11
+ meta: {
12
+ icon: 'icon-home',
13
+ label: 'Culture and Hostnames',
14
+ repositoryAlias: UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS,
15
+ entityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
16
+ },
17
+ },
18
+ ];
19
+ const manifestModals = [
20
+ {
21
+ type: 'modal',
22
+ alias: 'Umb.Modal.CultureAndHostnames',
23
+ name: 'Culture And Hostnames Modal',
24
+ js: () => import('./modal/culture-and-hostnames-modal.element.js'),
25
+ },
26
+ ];
27
+ export const manifests = [...entityActions, ...manifestModals];
@@ -0,0 +1,19 @@
1
+ import { UmbModalBaseElement } from '../../../../../core/modal/index.js';
2
+ import { type UmbCultureAndHostnamesModalData, type UmbCultureAndHostnamesModalValue } from '../../../index.js';
3
+ import type { UUIPopoverContainerElement } from '../../../../../../external/uui/index.js';
4
+ export declare class UmbCultureAndHostnamesModalElement extends UmbModalBaseElement<UmbCultureAndHostnamesModalData, UmbCultureAndHostnamesModalValue> {
5
+ #private;
6
+ private _languageModel;
7
+ private _defaultIsoCode?;
8
+ private _domains;
9
+ popoverContainerElement?: UUIPopoverContainerElement;
10
+ firstUpdated(): void;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ static styles: import("../../../../../../external/lit/index.js").CSSResult[];
13
+ }
14
+ export default UmbCultureAndHostnamesModalElement;
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'umb-culture-and-hostnames-modal': UmbCultureAndHostnamesModalElement;
18
+ }
19
+ }
@@ -0,0 +1,236 @@
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
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
16
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
+ };
18
+ var _UmbCultureAndHostnamesModalElement_instances, _UmbCultureAndHostnamesModalElement_documentRepository, _UmbCultureAndHostnamesModalElement_languageRepository, _UmbCultureAndHostnamesModalElement_unique, _UmbCultureAndHostnamesModalElement_readDomains, _UmbCultureAndHostnamesModalElement_requestLanguages, _UmbCultureAndHostnamesModalElement_handleSave, _UmbCultureAndHostnamesModalElement_handleClose, _UmbCultureAndHostnamesModalElement_onChangeLanguage, _UmbCultureAndHostnamesModalElement_onChangeDomainLanguage, _UmbCultureAndHostnamesModalElement_onChangeDomainHostname, _UmbCultureAndHostnamesModalElement_onRemoveDomain, _UmbCultureAndHostnamesModalElement_onAddDomain, _UmbCultureAndHostnamesModalElement_renderCultureSection, _UmbCultureAndHostnamesModalElement_renderDomainSection, _UmbCultureAndHostnamesModalElement_renderDomains, _UmbCultureAndHostnamesModalElement_renderLanguageModelOptions, _UmbCultureAndHostnamesModalElement_renderAddNewDomainButton;
19
+ import { html, customElement, state, css, repeat, query } from '../../../../../../external/lit/index.js';
20
+ import { UmbTextStyles } from '../../../../../../shared/style/index.js';
21
+ import { UmbModalBaseElement } from '../../../../../core/modal/index.js';
22
+ import { UmbLanguageRepository } from '../../../../../settings/languages/index.js';
23
+ import { UmbDocumentCultureAndHostnamesRepository, } from '../../../index.js';
24
+ let UmbCultureAndHostnamesModalElement = class UmbCultureAndHostnamesModalElement extends UmbModalBaseElement {
25
+ constructor() {
26
+ super(...arguments);
27
+ _UmbCultureAndHostnamesModalElement_instances.add(this);
28
+ _UmbCultureAndHostnamesModalElement_documentRepository.set(this, new UmbDocumentCultureAndHostnamesRepository(this));
29
+ _UmbCultureAndHostnamesModalElement_languageRepository.set(this, new UmbLanguageRepository(this));
30
+ _UmbCultureAndHostnamesModalElement_unique.set(this, void 0);
31
+ this._languageModel = [];
32
+ this._domains = [];
33
+ }
34
+ // Init
35
+ firstUpdated() {
36
+ __classPrivateFieldSet(this, _UmbCultureAndHostnamesModalElement_unique, this.data?.unique, "f");
37
+ __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_requestLanguages).call(this);
38
+ __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_readDomains).call(this);
39
+ }
40
+ // Renders
41
+ render() {
42
+ return html `
43
+ <umb-body-layout headline=${this.localize.term('actions_assigndomain')}>
44
+ ${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_renderCultureSection).call(this)} ${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_renderDomainSection).call(this)}
45
+ <uui-button
46
+ slot="actions"
47
+ id="close"
48
+ label=${this.localize.term('general_close')}
49
+ @click="${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_handleClose)}"></uui-button>
50
+ <uui-button
51
+ slot="actions"
52
+ id="save"
53
+ look="primary"
54
+ color="positive"
55
+ label=${this.localize.term('buttons_save')}
56
+ @click="${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_handleSave)}"></uui-button>
57
+ </umb-body-layout>
58
+ `;
59
+ }
60
+ };
61
+ _UmbCultureAndHostnamesModalElement_documentRepository = new WeakMap();
62
+ _UmbCultureAndHostnamesModalElement_languageRepository = new WeakMap();
63
+ _UmbCultureAndHostnamesModalElement_unique = new WeakMap();
64
+ _UmbCultureAndHostnamesModalElement_instances = new WeakSet();
65
+ _UmbCultureAndHostnamesModalElement_readDomains = async function _UmbCultureAndHostnamesModalElement_readDomains() {
66
+ if (!__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_unique, "f"))
67
+ return;
68
+ const { data } = await __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_documentRepository, "f").readCultureAndHostnames(__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_unique, "f"));
69
+ if (!data)
70
+ return;
71
+ this._defaultIsoCode = data.defaultIsoCode;
72
+ this._domains = data.domains;
73
+ };
74
+ _UmbCultureAndHostnamesModalElement_requestLanguages = async function _UmbCultureAndHostnamesModalElement_requestLanguages() {
75
+ const { data } = await __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_languageRepository, "f").requestLanguages();
76
+ if (!data)
77
+ return;
78
+ this._languageModel = data.items;
79
+ };
80
+ _UmbCultureAndHostnamesModalElement_handleSave =
81
+ // Modal
82
+ async function _UmbCultureAndHostnamesModalElement_handleSave() {
83
+ this.value = { defaultIsoCode: this._defaultIsoCode, domains: this._domains };
84
+ await __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_documentRepository, "f").updateCultureAndHostnames(__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_unique, "f"), this.value);
85
+ };
86
+ _UmbCultureAndHostnamesModalElement_handleClose = function _UmbCultureAndHostnamesModalElement_handleClose() {
87
+ this.modalContext?.submit();
88
+ };
89
+ _UmbCultureAndHostnamesModalElement_onChangeLanguage = function _UmbCultureAndHostnamesModalElement_onChangeLanguage(e) {
90
+ const defaultIsoCode = e.target.value;
91
+ if (defaultIsoCode === 'inherit') {
92
+ this._defaultIsoCode = null;
93
+ }
94
+ else {
95
+ this._defaultIsoCode = defaultIsoCode;
96
+ }
97
+ };
98
+ _UmbCultureAndHostnamesModalElement_onChangeDomainLanguage = function _UmbCultureAndHostnamesModalElement_onChangeDomainLanguage(e, index) {
99
+ const isoCode = e.target.value;
100
+ this._domains = this._domains.map((domain, i) => (index === i ? { ...domain, isoCode } : domain));
101
+ };
102
+ _UmbCultureAndHostnamesModalElement_onChangeDomainHostname = function _UmbCultureAndHostnamesModalElement_onChangeDomainHostname(e, index) {
103
+ const domainName = e.target.value;
104
+ this._domains = this._domains.map((domain, i) => (index === i ? { ...domain, domainName } : domain));
105
+ };
106
+ _UmbCultureAndHostnamesModalElement_onRemoveDomain = async function _UmbCultureAndHostnamesModalElement_onRemoveDomain(index) {
107
+ this._domains = this._domains.filter((d, i) => index !== i);
108
+ };
109
+ _UmbCultureAndHostnamesModalElement_onAddDomain = function _UmbCultureAndHostnamesModalElement_onAddDomain(useCurrentDomain) {
110
+ const defaultModel = this._languageModel.find((model) => model.isDefault);
111
+ if (useCurrentDomain) {
112
+ // TODO: This ignorer is just needed for JSON SCHEMA TO WORK, As its not updated with latest TS jet.
113
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
114
+ // @ts-ignore
115
+ this.popoverContainerElement?.hidePopover();
116
+ this._domains = [...this._domains, { isoCode: defaultModel?.isoCode ?? '', domainName: window.location.host }];
117
+ }
118
+ else {
119
+ this._domains = [...this._domains, { isoCode: defaultModel?.isoCode ?? '', domainName: '' }];
120
+ }
121
+ };
122
+ _UmbCultureAndHostnamesModalElement_renderCultureSection = function _UmbCultureAndHostnamesModalElement_renderCultureSection() {
123
+ return html `<uui-box headline=${this.localize.term('assignDomain_setLanguage')}>
124
+ <uui-label for="select">${this.localize.term('assignDomain_language')}</uui-label>
125
+ <uui-combobox
126
+ id="select"
127
+ label=${this.localize.term('assignDomain_language')}
128
+ .value=${this._defaultIsoCode ?? 'inherit'}
129
+ @change=${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_onChangeLanguage)}>
130
+ <uui-combobox-list>
131
+ <uui-combobox-list-option .value=${'inherit'}>
132
+ ${this.localize.term('assignDomain_inherit')}
133
+ </uui-combobox-list-option>
134
+ ${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_renderLanguageModelOptions).call(this)}
135
+ </uui-combobox-list>
136
+ </uui-combobox>
137
+ </uui-box>`;
138
+ };
139
+ _UmbCultureAndHostnamesModalElement_renderDomainSection = function _UmbCultureAndHostnamesModalElement_renderDomainSection() {
140
+ return html `<uui-box headline=${this.localize.term('assignDomain_setDomains')}>
141
+ <umb-localize key="assignDomain_domainHelpWithVariants">
142
+ Valid domain names are: "example.com", "www.example.com", "example.com:8080", or "https://www.example.com/".<br />Furthermore
143
+ also one-level paths in domains are supported, eg. "example.com/en" or "/en".
144
+ </umb-localize>
145
+ ${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_renderDomains).call(this)} ${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_renderAddNewDomainButton).call(this)}
146
+ </uui-box>`;
147
+ };
148
+ _UmbCultureAndHostnamesModalElement_renderDomains = function _UmbCultureAndHostnamesModalElement_renderDomains() {
149
+ if (!this._domains?.length)
150
+ return;
151
+ return html `<div id="domains">
152
+ ${repeat(this._domains, (domain) => domain.isoCode, (domain, index) => html `
153
+ <uui-input
154
+ label=${this.localize.term('assignDomain_domain')}
155
+ .value=${domain.domainName}
156
+ @change=${(e) => __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_onChangeDomainHostname).call(this, e, index)}></uui-input>
157
+ <uui-combobox
158
+ .value=${domain.isoCode}
159
+ label=${this.localize.term('assignDomain_language')}
160
+ @change=${(e) => __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_onChangeDomainLanguage).call(this, e, index)}>
161
+ <uui-combobox-list> ${__classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_renderLanguageModelOptions).call(this)} </uui-combobox-list>
162
+ </uui-combobox>
163
+ <uui-button
164
+ look="outline"
165
+ color="danger"
166
+ label=${this.localize.term('assignDomain_remove')}
167
+ @click=${() => __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_onRemoveDomain).call(this, index)}>
168
+ <uui-icon name="icon-trash"></uui-icon>
169
+ </uui-button>
170
+ `)}
171
+ </div>`;
172
+ };
173
+ _UmbCultureAndHostnamesModalElement_renderLanguageModelOptions = function _UmbCultureAndHostnamesModalElement_renderLanguageModelOptions() {
174
+ return html `${repeat(this._languageModel, (model) => model.isoCode, (model) => html `<uui-combobox-list-option .value=${model.isoCode}>${model.name}</uui-combobox-list-option>`)}`;
175
+ };
176
+ _UmbCultureAndHostnamesModalElement_renderAddNewDomainButton = function _UmbCultureAndHostnamesModalElement_renderAddNewDomainButton() {
177
+ return html `<uui-button-group>
178
+ <uui-button
179
+ label=${this.localize.term('assignDomain_addNew')}
180
+ look="placeholder"
181
+ @click=${() => __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_onAddDomain).call(this)}></uui-button>
182
+ <uui-button
183
+ id="dropdown"
184
+ label=${this.localize.term('buttons_select')}
185
+ look="placeholder"
186
+ popovertarget="more-options">
187
+ <uui-icon name="icon-navigation-down"></uui-icon>
188
+ </uui-button>
189
+ <uui-popover-container id="more-options" placement="bottom-end">
190
+ <umb-popover-layout>
191
+ <uui-button label=${this.localize.term('assignDomain_addCurrent')} @click=${() => __classPrivateFieldGet(this, _UmbCultureAndHostnamesModalElement_instances, "m", _UmbCultureAndHostnamesModalElement_onAddDomain).call(this, true)}></uui-button>
192
+ </umb-popover-layout>
193
+ </uui-popover-container>
194
+ </uui-button-group> `;
195
+ };
196
+ UmbCultureAndHostnamesModalElement.styles = [
197
+ UmbTextStyles,
198
+ css `
199
+ uui-button-group {
200
+ width: 100%;
201
+ }
202
+
203
+ uui-box:first-child {
204
+ margin-bottom: var(--uui-size-layout-1);
205
+ }
206
+
207
+ #dropdown {
208
+ flex-grow: 0;
209
+ }
210
+
211
+ #domains {
212
+ margin-top: var(--uui-size-layout-1);
213
+ margin-bottom: var(--uui-size-2);
214
+ display: grid;
215
+ grid-template-columns: 1fr 1fr auto;
216
+ grid-gap: var(--uui-size-1);
217
+ }
218
+ `,
219
+ ];
220
+ __decorate([
221
+ state()
222
+ ], UmbCultureAndHostnamesModalElement.prototype, "_languageModel", void 0);
223
+ __decorate([
224
+ state()
225
+ ], UmbCultureAndHostnamesModalElement.prototype, "_defaultIsoCode", void 0);
226
+ __decorate([
227
+ state()
228
+ ], UmbCultureAndHostnamesModalElement.prototype, "_domains", void 0);
229
+ __decorate([
230
+ query('#more-options')
231
+ ], UmbCultureAndHostnamesModalElement.prototype, "popoverContainerElement", void 0);
232
+ UmbCultureAndHostnamesModalElement = __decorate([
233
+ customElement('umb-culture-and-hostnames-modal')
234
+ ], UmbCultureAndHostnamesModalElement);
235
+ export { UmbCultureAndHostnamesModalElement };
236
+ export default UmbCultureAndHostnamesModalElement;
@@ -0,0 +1,10 @@
1
+ import type { DomainPresentationModel } from '../../../../../../external/backend-api/index.js';
2
+ import { UmbModalToken } from '../../../../../core/modal/index.js';
3
+ export interface UmbCultureAndHostnamesModalData {
4
+ unique: string | null;
5
+ }
6
+ export interface UmbCultureAndHostnamesModalValue {
7
+ defaultIsoCode?: string | null;
8
+ domains: Array<DomainPresentationModel>;
9
+ }
10
+ export declare const UMB_CULTURE_AND_HOSTNAMES_MODAL: UmbModalToken<UmbCultureAndHostnamesModalData, UmbCultureAndHostnamesModalValue>;
@@ -0,0 +1,7 @@
1
+ import { UmbModalToken } from '../../../../../core/modal/index.js';
2
+ export const UMB_CULTURE_AND_HOSTNAMES_MODAL = new UmbModalToken('Umb.Modal.CultureAndHostnames', {
3
+ modal: {
4
+ type: 'sidebar',
5
+ size: 'medium',
6
+ },
7
+ });
@@ -0,0 +1,2 @@
1
+ export * from './culture-and-hostnames-modal.token.js';
2
+ export * from './culture-and-hostnames-modal.element.js';
@@ -0,0 +1,2 @@
1
+ export * from './culture-and-hostnames-modal.token.js';
2
+ export * from './culture-and-hostnames-modal.element.js';
@@ -0,0 +1,18 @@
1
+ import type { UmbControllerHost } from '../../../../../../libs/controller-api/index.js';
2
+ import { UmbBaseController } from '../../../../../../libs/class-api/index.js';
3
+ import type { UmbApi } from '../../../../../../libs/extension-api/index.js';
4
+ import type { DomainsPresentationModelBaseModel } from '../../../../../../external/backend-api/index.js';
5
+ export declare class UmbDocumentCultureAndHostnamesRepository extends UmbBaseController implements UmbApi {
6
+ #private;
7
+ constructor(host: UmbControllerHost);
8
+ readCultureAndHostnames(unique: string): Promise<{
9
+ data: DomainsPresentationModelBaseModel | undefined;
10
+ error?: undefined;
11
+ } | {
12
+ error: import("../../../../../../external/backend-api/index.js").ApiError | import("../../../../../../external/backend-api/index.js").CancelError;
13
+ data?: undefined;
14
+ }>;
15
+ updateCultureAndHostnames(unique: string, data: DomainsPresentationModelBaseModel): Promise<{
16
+ error: import("../../../../../../external/backend-api/index.js").ApiError | import("../../../../../../external/backend-api/index.js").CancelError | undefined;
17
+ }>;
18
+ }
@@ -0,0 +1,47 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _UmbDocumentCultureAndHostnamesRepository_dataSource, _UmbDocumentCultureAndHostnamesRepository_notificationContext;
13
+ import { UmbDocumentCultureAndHostnamesServerDataSource } from './culture-and-hostnames.server.data.js';
14
+ import { UmbBaseController } from '../../../../../../libs/class-api/index.js';
15
+ import { UMB_NOTIFICATION_CONTEXT } from '../../../../../core/notification/index.js';
16
+ export class UmbDocumentCultureAndHostnamesRepository extends UmbBaseController {
17
+ constructor(host) {
18
+ super(host);
19
+ _UmbDocumentCultureAndHostnamesRepository_dataSource.set(this, new UmbDocumentCultureAndHostnamesServerDataSource(this));
20
+ _UmbDocumentCultureAndHostnamesRepository_notificationContext.set(this, void 0);
21
+ this.consumeContext(UMB_NOTIFICATION_CONTEXT, (instance) => {
22
+ __classPrivateFieldSet(this, _UmbDocumentCultureAndHostnamesRepository_notificationContext, instance, "f");
23
+ });
24
+ }
25
+ async readCultureAndHostnames(unique) {
26
+ if (!unique)
27
+ throw new Error('Unique is missing');
28
+ const { data, error } = await __classPrivateFieldGet(this, _UmbDocumentCultureAndHostnamesRepository_dataSource, "f").read(unique);
29
+ if (!error) {
30
+ return { data };
31
+ }
32
+ return { error };
33
+ }
34
+ async updateCultureAndHostnames(unique, data) {
35
+ if (!unique)
36
+ throw new Error('Unique is missing');
37
+ if (!data)
38
+ throw new Error('Data is missing');
39
+ const { error } = await __classPrivateFieldGet(this, _UmbDocumentCultureAndHostnamesRepository_dataSource, "f").update(unique, data);
40
+ if (!error) {
41
+ const notification = { data: { message: `Cultures and hostnames saved` } };
42
+ __classPrivateFieldGet(this, _UmbDocumentCultureAndHostnamesRepository_notificationContext, "f")?.peek('positive', notification);
43
+ }
44
+ return { error };
45
+ }
46
+ }
47
+ _UmbDocumentCultureAndHostnamesRepository_dataSource = new WeakMap(), _UmbDocumentCultureAndHostnamesRepository_notificationContext = new WeakMap();
@@ -0,0 +1,30 @@
1
+ import type { DomainsPresentationModelBaseModel } from '../../../../../../external/backend-api/index.js';
2
+ import type { UmbControllerHost } from '../../../../../../libs/controller-api/index.js';
3
+ /**
4
+ * A data source for the Document Culture and Hostnames that fetches data from the server
5
+ * @export
6
+ * @class UmbDocumentCultureAndHostnamesServerDataSource
7
+ * @implements {RepositoryDetailDataSource}
8
+ */
9
+ export declare class UmbDocumentCultureAndHostnamesServerDataSource {
10
+ #private;
11
+ /**
12
+ * Creates an instance of UmbDocumentCultureAndHostnamesServerDataSource.
13
+ * @param {UmbControllerHost} host
14
+ * @memberof UmbDocumentCultureAndHostnamesServerDataSource
15
+ */
16
+ constructor(host: UmbControllerHost);
17
+ /**
18
+ * Fetches the Culture and Hostnames for the given Document unique
19
+ * @param {string} unique
20
+ * @memberof UmbDocumentCultureAndHostnamesServerDataSource
21
+ */
22
+ read(unique: string): Promise<import("../../../../../core/repository/index.js").DataSourceResponse<DomainsPresentationModelBaseModel>>;
23
+ /**
24
+ * Updates Culture and Hostnames for the given Document unique
25
+ * @param {string} unique
26
+ * @param {DomainsPresentationModelBaseModel} data
27
+ * @memberof UmbDocumentCultureAndHostnamesServerDataSource
28
+ */
29
+ update(unique: string, data: DomainsPresentationModelBaseModel): Promise<import("../../../../../core/repository/index.js").DataSourceResponse<any>>;
30
+ }