@umbraco-cms/backoffice 19.0.0-rc1 → 19.0.0-rc2

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 (87) hide show
  1. package/custom-elements.json +1 -1
  2. package/dist-cms/apps/app/app-auth-callback.element.d.ts +6 -4
  3. package/dist-cms/apps/app/app-auth-callback.element.js +16 -14
  4. package/dist-cms/assets/lang/ar.js +9 -0
  5. package/dist-cms/assets/lang/bs.js +8 -0
  6. package/dist-cms/assets/lang/cs.js +9 -0
  7. package/dist-cms/assets/lang/cy.js +9 -0
  8. package/dist-cms/assets/lang/da.js +9 -0
  9. package/dist-cms/assets/lang/de.js +9 -0
  10. package/dist-cms/assets/lang/en.js +8 -0
  11. package/dist-cms/assets/lang/es.js +3 -0
  12. package/dist-cms/assets/lang/fr.js +9 -0
  13. package/dist-cms/assets/lang/he.js +3 -0
  14. package/dist-cms/assets/lang/hr.js +8 -0
  15. package/dist-cms/assets/lang/it.js +9 -0
  16. package/dist-cms/assets/lang/ja.js +8 -0
  17. package/dist-cms/assets/lang/ko.js +3 -0
  18. package/dist-cms/assets/lang/nb.js +8 -0
  19. package/dist-cms/assets/lang/nl.js +9 -0
  20. package/dist-cms/assets/lang/pl.js +3 -0
  21. package/dist-cms/assets/lang/pt-br.js +3 -0
  22. package/dist-cms/assets/lang/pt.js +9 -0
  23. package/dist-cms/assets/lang/ru.js +3 -0
  24. package/dist-cms/assets/lang/sv.js +3 -0
  25. package/dist-cms/assets/lang/tr.js +8 -0
  26. package/dist-cms/assets/lang/uk.js +3 -0
  27. package/dist-cms/assets/lang/vi.js +9 -0
  28. package/dist-cms/assets/lang/zh-tw.js +3 -0
  29. package/dist-cms/assets/lang/zh.js +8 -0
  30. package/dist-cms/external/uui/package.json +1 -1
  31. package/dist-cms/libs/localization-api/known-keys.const.generated.js +6 -0
  32. package/dist-cms/libs/localization-api/known-keys.types.generated.d.ts +6 -0
  33. package/dist-cms/packages/block/block/context/block-entries.context.d.ts +24 -0
  34. package/dist-cms/packages/block/block/context/block-entries.context.js +24 -0
  35. package/dist-cms/packages/block/block/context/block-entry.context.js +13 -7
  36. package/dist-cms/packages/block/block/context/block-manager.context.d.ts +15 -0
  37. package/dist-cms/packages/block/block/context/block-manager.context.js +21 -1
  38. package/dist-cms/packages/block/block/modals/transfer-to-element-library/transfer-to-element-library-modal.element.js +15 -21
  39. package/dist-cms/packages/block/block/workspace/context/block-workspace.context.d.ts +6 -0
  40. package/dist-cms/packages/block/block/workspace/context/block-workspace.context.js +14 -8
  41. package/dist-cms/packages/block/block-grid/components/block-grid-block-inline/block-grid-block-inline.element.js +6 -6
  42. package/dist-cms/packages/block/block-list/components/inline-list-block/inline-list-block.element.js +7 -7
  43. package/dist-cms/packages/block/block-single/components/inline-single-block/inline-single-block.element.js +6 -6
  44. package/dist-cms/packages/content/content/manager/content-data-manager.js +5 -1
  45. package/dist-cms/packages/content/content/publishing/publish/entity-action/content-publish.action.js +25 -19
  46. package/dist-cms/packages/content/content/publishing/publish/entity-action/types.d.ts +15 -3
  47. package/dist-cms/packages/content/content/publishing/publish/modal/content-publish-modal.element.js +1 -1
  48. package/dist-cms/packages/content/content/publishing/publish/modal/types.d.ts +2 -0
  49. package/dist-cms/packages/content/content-type/workspace/views/design/content-type-design-editor.element.js +6 -4
  50. package/dist-cms/packages/core/auth/auth-provider.extension.d.ts +1 -0
  51. package/dist-cms/packages/core/auth/auth.context.js +8 -4
  52. package/dist-cms/packages/core/entity-item/entity-item-ref/entity-item-ref-frame.mixin.js +1 -1
  53. package/dist-cms/packages/core/utils/string/index.d.ts +1 -0
  54. package/dist-cms/packages/core/utils/string/index.js +1 -0
  55. package/dist-cms/packages/core/utils/string/truncate-string/index.d.ts +1 -0
  56. package/dist-cms/packages/core/utils/string/truncate-string/index.js +1 -0
  57. package/dist-cms/packages/core/utils/string/truncate-string/truncate-string.function.d.ts +9 -0
  58. package/dist-cms/packages/core/utils/string/truncate-string/truncate-string.function.js +18 -0
  59. package/dist-cms/packages/elements/index.d.ts +1 -0
  60. package/dist-cms/packages/elements/index.js +1 -0
  61. package/dist-cms/packages/elements/publishing/publish/entity-action/constants.js +1 -2
  62. package/dist-cms/packages/elements/publishing/publish/entity-bulk-action/publish.bulk-action.js +4 -4
  63. package/dist-cms/packages/elements/publishing/unpublish/entity-bulk-action/unpublish.bulk-action.js +3 -4
  64. package/dist-cms/packages/elements/publishing/workspace-context/element-publishing.workspace-context.js +1 -0
  65. package/dist-cms/packages/elements/user-permissions/constants.d.ts +1 -0
  66. package/dist-cms/packages/elements/user-permissions/constants.js +1 -0
  67. package/dist-cms/packages/elements/user-permissions/manifests.js +7 -1
  68. package/dist-cms/packages/elements/user-permissions/repository/constants.d.ts +1 -0
  69. package/dist-cms/packages/elements/user-permissions/repository/constants.js +1 -0
  70. package/dist-cms/packages/elements/user-permissions/repository/element-current-user-permission.repository.d.ts +18 -0
  71. package/dist-cms/packages/elements/user-permissions/repository/element-current-user-permission.repository.js +22 -0
  72. package/dist-cms/packages/elements/user-permissions/repository/element-current-user-permission.server.data-source.d.ts +23 -0
  73. package/dist-cms/packages/elements/user-permissions/repository/element-current-user-permission.server.data-source.js +32 -0
  74. package/dist-cms/packages/elements/user-permissions/repository/index.d.ts +2 -0
  75. package/dist-cms/packages/elements/user-permissions/repository/index.js +2 -0
  76. package/dist-cms/packages/elements/user-permissions/repository/manifests.d.ts +1 -0
  77. package/dist-cms/packages/elements/user-permissions/repository/manifests.js +9 -0
  78. package/dist-cms/packages/elements/user-permissions/repository/types.d.ts +6 -0
  79. package/dist-cms/packages/elements/user-permissions/repository/types.js +1 -0
  80. package/dist-cms/packages/elements/user-permissions/types.d.ts +1 -0
  81. package/dist-cms/packages/user/current-user/history/current-user-history-user-profile-app.element.js +2 -13
  82. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  83. package/package.json +2 -2
  84. package/umbraco-package-schema.json +10 -2
  85. package/vscode-html-custom-data.json +1 -1
  86. package/dist-cms/packages/block/block/utils/element-permission-verbs.function.d.ts +0 -28
  87. package/dist-cms/packages/block/block/utils/element-permission-verbs.function.js +0 -29
@@ -8,6 +8,8 @@ import { UMB_ACTION_EVENT_CONTEXT } from '../../../../../core/action/index.js';
8
8
  import { UMB_APP_LANGUAGE_CONTEXT, UmbLanguageCollectionRepository } from '../../../../../language/index.js';
9
9
  import { UMB_CURRENT_USER_CONTEXT } from '../../../../../user/current-user/index.js';
10
10
  import { UMB_NOTIFICATION_CONTEXT } from '../../../../../core/notification/index.js';
11
+ import { escapeHTML, truncateString } from '../../../../../core/utils/index.js';
12
+ const MAX_NOTIFICATION_NAME_LENGTH = 30;
11
13
  /**
12
14
  * @description - Shared entity action for publishing content-like entities (Document, Element, ...).
13
15
  * Resolves its detail/publishing repositories by alias from `meta`, so a single implementation can serve every
@@ -28,6 +30,7 @@ export class UmbContentPublishEntityAction extends UmbEntityActionBase {
28
30
  const result = await umbOpenModal(this, UMB_CONTENT_PUBLISH_MODAL, {
29
31
  data: {
30
32
  confirmLabel: '#actions_publish',
33
+ description: this.args.meta.publishConfirmationMessage,
31
34
  options,
32
35
  pickableFilter: (option) => this.#isLanguagePickable(option, currentUserAllowedLanguages, currentUserHasAccessToAllLanguages),
33
36
  unique,
@@ -43,7 +46,7 @@ export class UmbContentPublishEntityAction extends UmbEntityActionBase {
43
46
  if (!publishableVariantIds.length)
44
47
  return;
45
48
  await this.#publish(unique, publishableVariantIds);
46
- await this.#notifyPublished(options, detailData, result.selection);
49
+ await this.#notifyPublished(options, detailData, result.selection, appCulture);
47
50
  await this.#dispatchReloadEvent(unique);
48
51
  }
49
52
  async #resolveDetailData(unique) {
@@ -121,28 +124,31 @@ export class UmbContentPublishEntityAction extends UmbEntityActionBase {
121
124
  throw error;
122
125
  }
123
126
  }
124
- async #notifyPublished(options, detailData, selection) {
127
+ async #notifyPublished(options, detailData, selection, appCulture) {
125
128
  const notificationContext = await this.getContext(UMB_NOTIFICATION_CONTEXT);
126
129
  const localize = new UmbLocalizationController(this);
130
+ const headline = localize.string(this.args.meta.publishedNotificationHeadline || '#publish_publishedNotificationTitle');
127
131
  // If the content is invariant, we need to show a different notification
128
132
  const isInvariant = options.length === 1 && options[0].culture === null;
129
- if (isInvariant) {
130
- notificationContext?.peek('positive', {
131
- data: {
132
- headline: localize.term('speechBubbles_editContentPublishedHeader'),
133
- message: localize.string(this.args.meta.publishedNotificationMessage || '#speechBubbles_editContentPublishedText'),
134
- },
135
- });
136
- }
137
- else {
138
- const publishedVariants = detailData.variants.filter((variant) => selection.includes(variant.culture));
139
- notificationContext?.peek('positive', {
140
- data: {
141
- headline: localize.term('speechBubbles_editContentPublishedHeader'),
142
- message: localize.string(this.args.meta.variantPublishedNotificationMessage || '#speechBubbles_editVariantPublishedText', localize.list(publishedVariants.map((v) => new UmbVariantId(v.culture, null).toString() ?? v.name))),
143
- },
144
- });
145
- }
133
+ const publishedVariants = isInvariant
134
+ ? detailData.variants
135
+ : detailData.variants.filter((variant) => selection.includes(variant.culture));
136
+ const namedVariant = publishedVariants.find((v) => v.culture === appCulture) ?? publishedVariants[0];
137
+ const name = truncateString(namedVariant?.name, MAX_NOTIFICATION_NAME_LENGTH);
138
+ const cultures = isInvariant
139
+ ? undefined
140
+ : localize.list(publishedVariants.map((v) => new UmbVariantId(v.culture, null).toString() ?? v.name));
141
+ const term = isInvariant
142
+ ? this.args.meta.publishedNotificationMessage || '#publish_publishedNotificationDescription'
143
+ : this.args.meta.variantPublishedNotificationMessage || '#publish_publishedVariantNotificationDescription';
144
+ const format = (formattedName, formattedCultures) => isInvariant ? localize.string(term, formattedName) : localize.string(term, formattedCultures, formattedName);
145
+ notificationContext?.peek('positive', {
146
+ data: {
147
+ headline,
148
+ message: format(name, cultures),
149
+ htmlMessage: format(`<strong>${escapeHTML(name)}</strong>`, escapeHTML(cultures)),
150
+ },
151
+ });
146
152
  }
147
153
  async #dispatchReloadEvent(unique) {
148
154
  const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
@@ -13,15 +13,27 @@ export interface ManifestEntityActionContentPublishKind extends ManifestEntityAc
13
13
  * Meta configuration for the `contentPublish` entity action kind.
14
14
  */
15
15
  export interface MetaEntityActionContentPublishKind extends MetaEntityActionDefaultKind {
16
+ /**
17
+ * Overrides the confirmation text shown in the publish modal.
18
+ * Use a localization key, e.g. `#prompt_confirmPublish`.
19
+ */
20
+ publishConfirmationMessage?: string;
21
+ /**
22
+ * Overrides the success notification headline.
23
+ * Use a localization key, e.g. `#publish_publishedNotificationTitle`.
24
+ */
25
+ publishedNotificationHeadline?: string;
16
26
  /**
17
27
  * Overrides the success notification message when invariant content is published.
18
- * Use a localization key, e.g. `#speechBubbles_editContentPublishedText`.
28
+ * Use a localization key, e.g. `#publish_publishedNotificationDescription` — the content name (shortened when
29
+ * long) is passed as the first term argument.
19
30
  */
20
31
  publishedNotificationMessage?: string;
21
32
  /**
22
33
  * Overrides the success notification message when one or more variants are published.
23
- * Use a localization key, e.g. `#speechBubbles_editVariantPublishedText` — the list of published variants
24
- * is passed as the first term argument, so a plain (non-key) string will not include it.
34
+ * Use a localization key, e.g. `#publish_publishedVariantNotificationDescription` — the list of published
35
+ * variants is passed as the first term argument and the content name (shortened when long) as the second, so a
36
+ * plain (non-key) string will not include them.
25
37
  */
26
38
  variantPublishedNotificationMessage?: string;
27
39
  /**
@@ -83,7 +83,7 @@ let UmbContentPublishModalElement = class UmbContentPublishModalElement extends
83
83
  const headline = this.data?.headline ?? this.localize.term('content_publishModalTitle');
84
84
  return html `
85
85
  <uui-dialog-layout headline=${headline}>
86
- <p><umb-localize key="prompt_confirmPublish"></umb-localize></p>
86
+ <p>${this.localize.string(this.data?.description || '#prompt_confirmPublish')}</p>
87
87
  ${when(!this._isInvariant, () => html `
88
88
  <umb-content-variant-language-picker
89
89
  .selectionManager=${this.#selectionManager}
@@ -3,6 +3,8 @@ import type { UmbEntityVariantOptionModel } from '../../../../../core/variant/in
3
3
  import type { UmbEntityModel } from '../../../../../core/entity/index.js';
4
4
  export interface UmbContentPublishModalData<VariantOptionModelType extends UmbEntityVariantOptionModel = UmbEntityVariantOptionModel> extends UmbContentVariantPickerData<VariantOptionModelType> {
5
5
  headline?: string;
6
+ /** The confirmation text shown above the variant picker. Use a localization key, e.g. `#prompt_confirmPublish`. */
7
+ description?: string;
6
8
  confirmLabel?: string;
7
9
  unique?: string;
8
10
  itemRepositoryAlias?: string;
@@ -462,12 +462,14 @@ let UmbContentTypeDesignEditorElement = class UmbContentTypeDesignEditorElement
462
462
  </uui-tab>
463
463
  `;
464
464
  }
465
+ #isDefaultRouteTab(tab) {
466
+ if (tab !== this._tabs?.[0] || this._hasRootGroups || this._hasRootProperties)
467
+ return false;
468
+ return this._routerPath + '/' === this._activePath;
469
+ }
465
470
  renderTab(tab) {
466
471
  const path = this._routerPath + '/tab/' + encodeFolderName(tab.name && tab.name !== '' ? tab.name : '-');
467
- let tabActive = path === this._activePath;
468
- if (!tabActive && !this._hasRootGroups && !this._hasRootProperties) {
469
- tabActive = this._routerPath + '/' === this._activePath;
470
- }
472
+ const tabActive = path === this._activePath || this.#isDefaultRouteTab(tab);
471
473
  const ownedTab = tab.ownerId ? true : false;
472
474
  return html `<uui-tab
473
475
  label=${tab.name && tab.name !== '' ? tab.name : this.localize.term('general_unnamed')}
@@ -60,6 +60,7 @@ export interface MetaAuthProvider {
60
60
  * The features of the popup that is opened when the user logs in.
61
61
  * @default "width=600,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"
62
62
  * @remarks This is the features of the window that is opened when the user logs in.
63
+ * `noopener` and `noreferrer` are not supported: the backoffice needs the reference `window.open()` returns to close the popup after sign-in.
63
64
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open#features
64
65
  */
65
66
  popupFeatures?: string;
@@ -21,6 +21,7 @@ export class UmbAuthContext extends UmbContextBase {
21
21
  #sessionWindowInMs;
22
22
  // Cross-tab coordination
23
23
  #channel;
24
+ #signInPopup;
24
25
  // The user the client state of this page belongs to, see bindUser().
25
26
  #boundUser;
26
27
  // Set once the session has passed to another user. The page holds the previous user's state, so no
@@ -97,6 +98,9 @@ export class UmbAuthContext extends UmbContextBase {
97
98
  this.#channel.onmessage = (evt) => {
98
99
  switch (evt.data?.type) {
99
100
  case 'authorized': {
101
+ // Only this window can tell its sign-in popup from a tab the user opened, so it closes it.
102
+ this.#signInPopup?.close();
103
+ this.#signInPopup = undefined;
100
104
  // Apply locally — the sender already broadcast to all tabs.
101
105
  void this.#applySession(true, () => this.#setSessionLocally(evt.data.expiresIn, evt.data.issuedAt));
102
106
  break;
@@ -165,8 +169,8 @@ export class UmbAuthContext extends UmbContextBase {
165
169
  let target;
166
170
  if (identityProvider.toLowerCase() === 'umbraco') {
167
171
  target = new URL(`${this.#serverUrl}/umbraco/login`);
168
- // A popup must land on the auth-callback lander (it broadcasts `authorized` and closes the
169
- // popup); a full-page redirect returns to the deep link instead.
172
+ // A popup must land on the auth-callback lander (it broadcasts `authorized`, and this window
173
+ // closes the popup); a full-page redirect returns to the deep link instead.
170
174
  const returnUrl = redirect ? deepLink : new URL('auth-callback', document.baseURI).pathname;
171
175
  if (returnUrl) {
172
176
  target.searchParams.set('ReturnUrl', returnUrl);
@@ -174,7 +178,7 @@ export class UmbAuthContext extends UmbContextBase {
174
178
  }
175
179
  else {
176
180
  // External login always routes through the server callback to the auth-callback lander;
177
- // carry the deep link so the lander's full-page fallback can return there.
181
+ // carry the deep link so the lander can return a full-page sign-in there.
178
182
  const challengeUrl = new URL(this.#externalLoginEndpoint);
179
183
  challengeUrl.searchParams.set('provider', identityProvider);
180
184
  target = challengeUrl;
@@ -189,7 +193,7 @@ export class UmbAuthContext extends UmbContextBase {
189
193
  const popupTarget = manifest?.meta?.behavior?.popupTarget ?? 'umbracoAuthPopup';
190
194
  const popupFeatures = manifest?.meta?.behavior?.popupFeatures ??
191
195
  'width=600,height=600,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,toolbar=no';
192
- window.open(target.href, popupTarget, popupFeatures);
196
+ this.#signInPopup = window.open(target.href, popupTarget, popupFeatures);
193
197
  }
194
198
  /**
195
199
  * Checks if the user is authorized. If Authorization is bypassed, the user is always authorized.
@@ -18,7 +18,6 @@ export const UmbEntityItemRefFrameMixin = (superClass) => {
18
18
  return html `<umb-entity-frame aria-hidden="true"><uui-icon name="link"></uui-icon></umb-entity-frame>`;
19
19
  }
20
20
  static { this.styles = [
21
- superClass.styles ?? [],
22
21
  css `
23
22
  :host {
24
23
  --umb-entity-frame-opacity: 0;
@@ -34,6 +33,7 @@ export const UmbEntityItemRefFrameMixin = (superClass) => {
34
33
  --umb-entity-frame-opacity: 1;
35
34
  }
36
35
  `,
36
+ superClass.styles ?? [],
37
37
  ]; }
38
38
  }
39
39
  return UmbEntityItemRefFrameMixinClass;
@@ -6,3 +6,4 @@ export * from './string-or-string-array-contains/index.js';
6
6
  export * from './to-camel-case/index.js';
7
7
  export * from './fuzzy/index.js';
8
8
  export * from './levenshtein/index.js';
9
+ export * from './truncate-string/index.js';
@@ -6,3 +6,4 @@ export * from './string-or-string-array-contains/index.js';
6
6
  export * from './to-camel-case/index.js';
7
7
  export * from './fuzzy/index.js';
8
8
  export * from './levenshtein/index.js';
9
+ export * from './truncate-string/index.js';
@@ -0,0 +1 @@
1
+ export * from './truncate-string.function.js';
@@ -0,0 +1 @@
1
+ export * from './truncate-string.function.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shortens a string to a maximum length by replacing its middle with a separator, keeping the start and the end.
3
+ * @example truncateString('A very long document name', 15) // "A very…nt name"
4
+ * @param {string | undefined} input The string to shorten.
5
+ * @param {number} maxLength The maximum length of the result, including the separator.
6
+ * @param {string} [separator] The text that replaces the removed characters.
7
+ * @returns {string} The input if it fits within `maxLength`, otherwise the shortened string. An empty string if no input is given.
8
+ */
9
+ export declare function truncateString(input: string | undefined, maxLength: number, separator?: string): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shortens a string to a maximum length by replacing its middle with a separator, keeping the start and the end.
3
+ * @example truncateString('A very long document name', 15) // "A very…nt name"
4
+ * @param {string | undefined} input The string to shorten.
5
+ * @param {number} maxLength The maximum length of the result, including the separator.
6
+ * @param {string} [separator] The text that replaces the removed characters.
7
+ * @returns {string} The input if it fits within `maxLength`, otherwise the shortened string. An empty string if no input is given.
8
+ */
9
+ export function truncateString(input, maxLength, separator = '…') {
10
+ if (!input)
11
+ return '';
12
+ if (input.length <= maxLength)
13
+ return input;
14
+ const charsToShow = Math.max(maxLength - separator.length, 0);
15
+ const frontChars = Math.ceil(charsToShow / 2);
16
+ const backChars = Math.floor(charsToShow / 2);
17
+ return input.substring(0, frontChars) + separator + input.substring(input.length - backChars);
18
+ }
@@ -15,5 +15,6 @@ export * from './recycle-bin/index.js';
15
15
  export * from './reference/index.js';
16
16
  export * from './repository/index.js';
17
17
  export * from './rollback/index.js';
18
+ export * from './user-permissions/repository/index.js';
18
19
  export * from './variant-state.js';
19
20
  export type * from './types.js';
@@ -15,4 +15,5 @@ export * from './recycle-bin/index.js';
15
15
  export * from './reference/index.js';
16
16
  export * from './repository/index.js';
17
17
  export * from './rollback/index.js';
18
+ export * from './user-permissions/repository/index.js';
18
19
  export * from './variant-state.js';
@@ -9,6 +9,5 @@ export const UmbElementPublishManifestEntityActionMeta = {
9
9
  publishingRepositoryAlias: UMB_ELEMENT_PUBLISHING_REPOSITORY_ALIAS,
10
10
  itemRepositoryAlias: UMB_ELEMENT_ITEM_REPOSITORY_ALIAS,
11
11
  referenceRepositoryAlias: UMB_ELEMENT_REFERENCE_REPOSITORY_ALIAS,
12
- publishedNotificationMessage: '#speechBubbles_editElementPublishedHeader',
13
- variantPublishedNotificationMessage: '#speechBubbles_editVariantElementPublishedText',
12
+ publishConfirmationMessage: '#elements_confirmPublishDescription',
14
13
  };
@@ -65,12 +65,11 @@ export class UmbElementPublishEntityBulkAction extends UmbEntityBulkActionBase {
65
65
  });
66
66
  // If there is only one language available, we can skip the modal and publish directly:
67
67
  if (options.length === 1) {
68
- const localizationController = new UmbLocalizationController(this._host);
69
68
  const confirm = await umbConfirmModal(this, {
70
- headline: localizationController.term('content_readyToPublish'),
71
- content: localizationController.term('prompt_confirmListViewPublish'),
69
+ headline: '#content_readyToPublish',
70
+ content: '#elements_confirmBulkPublishDescription',
72
71
  color: 'positive',
73
- confirmLabel: localizationController.term('actions_publish'),
72
+ confirmLabel: '#actions_publish',
74
73
  }).catch(() => false);
75
74
  if (confirm !== false) {
76
75
  const variantId = new UmbVariantId(options[0].language.unique, null);
@@ -106,6 +105,7 @@ export class UmbElementPublishEntityBulkAction extends UmbEntityBulkActionBase {
106
105
  }
107
106
  const result = await umbOpenModal(this, UMB_CONTENT_PUBLISH_MODAL, {
108
107
  data: {
108
+ description: '#elements_confirmBulkPublishDescription',
109
109
  options,
110
110
  },
111
111
  value: { selection },
@@ -65,12 +65,11 @@ export class UmbElementUnpublishEntityBulkAction extends UmbEntityBulkActionBase
65
65
  });
66
66
  // If there is only one language available, we can skip the modal and unpublish directly:
67
67
  if (options.length === 1) {
68
- const localizationController = new UmbLocalizationController(this._host);
69
68
  const confirm = await umbConfirmModal(this, {
70
- headline: localizationController.term('actions_unpublish'),
71
- content: localizationController.term('prompt_confirmListViewUnpublish'),
69
+ headline: '#actions_unpublish',
70
+ content: '#elements_confirmBulkUnpublishDescription',
72
71
  color: 'warning',
73
- confirmLabel: localizationController.term('actions_unpublish'),
72
+ confirmLabel: '#actions_unpublish',
74
73
  }).catch(() => false);
75
74
  if (confirm !== false) {
76
75
  const variantId = new UmbVariantId(options[0].language.unique, null);
@@ -283,6 +283,7 @@ export class UmbElementPublishingWorkspaceContext extends UmbContextBase {
283
283
  const result = await umbOpenModal(this, UMB_CONTENT_PUBLISH_MODAL, {
284
284
  data: {
285
285
  headline: this.#localize.term('content_saveAndPublishModalTitle'),
286
+ description: '#elements_confirmPublishDescription',
286
287
  options,
287
288
  pickableFilter: (option) => this.#publishableVariantsFilter(option),
288
289
  unique,
@@ -8,3 +8,4 @@ export declare const UMB_USER_PERMISSION_ELEMENT_ROLLBACK = "Umb.Element.Rollbac
8
8
  export declare const UMB_USER_PERMISSION_ELEMENT_UNPUBLISH = "Umb.Element.Unpublish";
9
9
  export declare const UMB_USER_PERMISSION_ELEMENT_UPDATE = "Umb.Element.Update";
10
10
  export * from './conditions/constants.js';
11
+ export * from './repository/constants.js';
@@ -8,3 +8,4 @@ export const UMB_USER_PERMISSION_ELEMENT_ROLLBACK = 'Umb.Element.Rollback';
8
8
  export const UMB_USER_PERMISSION_ELEMENT_UNPUBLISH = 'Umb.Element.Unpublish';
9
9
  export const UMB_USER_PERMISSION_ELEMENT_UPDATE = 'Umb.Element.Update';
10
10
  export * from './conditions/constants.js';
11
+ export * from './repository/constants.js';
@@ -1,6 +1,7 @@
1
1
  import { UMB_ELEMENT_ENTITY_TYPE } from '../entity.js';
2
2
  import { UMB_USER_PERMISSION_ELEMENT_CREATE, UMB_USER_PERMISSION_ELEMENT_DELETE, UMB_USER_PERMISSION_ELEMENT_DUPLICATE, UMB_USER_PERMISSION_ELEMENT_MOVE, UMB_USER_PERMISSION_ELEMENT_PUBLISH, UMB_USER_PERMISSION_ELEMENT_READ, UMB_USER_PERMISSION_ELEMENT_ROLLBACK, UMB_USER_PERMISSION_ELEMENT_UNPUBLISH, UMB_USER_PERMISSION_ELEMENT_UPDATE, } from './constants.js';
3
3
  import { manifests as conditions } from './conditions/manifests.js';
4
+ import { manifests as repositoryManifests } from './repository/manifests.js';
4
5
  const entityUserPermissions = [
5
6
  {
6
7
  type: 'entityUserPermission',
@@ -123,4 +124,9 @@ const granularPermissions = [
123
124
  },
124
125
  },
125
126
  ];
126
- export const manifests = [...conditions, ...entityUserPermissions, ...granularPermissions];
127
+ export const manifests = [
128
+ ...conditions,
129
+ ...entityUserPermissions,
130
+ ...granularPermissions,
131
+ ...repositoryManifests,
132
+ ];
@@ -0,0 +1 @@
1
+ export declare const UMB_ELEMENT_CURRENT_USER_PERMISSION_REPOSITORY_ALIAS = "Umb.Repository.Element.CurrentUserPermission";
@@ -0,0 +1 @@
1
+ export const UMB_ELEMENT_CURRENT_USER_PERMISSION_REPOSITORY_ALIAS = 'Umb.Repository.Element.CurrentUserPermission';
@@ -0,0 +1,18 @@
1
+ import type { UmbElementCurrentUserPermissionsModel } from './types.js';
2
+ import { UmbRepositoryBase, type UmbRepositoryResponse } from '../../../core/repository/index.js';
3
+ /**
4
+ * A repository for the current user's element permissions, as resolved by the server.
5
+ * @class UmbElementCurrentUserPermissionRepository
6
+ */
7
+ export declare class UmbElementCurrentUserPermissionRepository extends UmbRepositoryBase {
8
+ #private;
9
+ /**
10
+ * Requests the permissions the current user has at the given elements or element folders.
11
+ * The request is all-or-nothing: if any of the uniques cannot be found, the response contains an error and no data.
12
+ * @param {Array<string>} uniques - The uniques of the elements or element folders
13
+ * @returns {Promise<UmbRepositoryResponse<Array<UmbElementCurrentUserPermissionsModel>>>} The permissions for each unique
14
+ * @memberof UmbElementCurrentUserPermissionRepository
15
+ */
16
+ requestPermissions(uniques: Array<string>): Promise<UmbRepositoryResponse<Array<UmbElementCurrentUserPermissionsModel>>>;
17
+ }
18
+ export { UmbElementCurrentUserPermissionRepository as api };
@@ -0,0 +1,22 @@
1
+ import { UmbElementCurrentUserPermissionServerDataSource } from './element-current-user-permission.server.data-source.js';
2
+ import { UmbRepositoryBase } from '../../../core/repository/index.js';
3
+ /**
4
+ * A repository for the current user's element permissions, as resolved by the server.
5
+ * @class UmbElementCurrentUserPermissionRepository
6
+ */
7
+ export class UmbElementCurrentUserPermissionRepository extends UmbRepositoryBase {
8
+ #dataSource = new UmbElementCurrentUserPermissionServerDataSource(this);
9
+ /**
10
+ * Requests the permissions the current user has at the given elements or element folders.
11
+ * The request is all-or-nothing: if any of the uniques cannot be found, the response contains an error and no data.
12
+ * @param {Array<string>} uniques - The uniques of the elements or element folders
13
+ * @returns {Promise<UmbRepositoryResponse<Array<UmbElementCurrentUserPermissionsModel>>>} The permissions for each unique
14
+ * @memberof UmbElementCurrentUserPermissionRepository
15
+ */
16
+ async requestPermissions(uniques) {
17
+ if (uniques.length === 0)
18
+ return { data: [] };
19
+ return this.#dataSource.requestPermissions(uniques);
20
+ }
21
+ }
22
+ export { UmbElementCurrentUserPermissionRepository as api };
@@ -0,0 +1,23 @@
1
+ import type { UmbElementCurrentUserPermissionsModel } from './types.js';
2
+ import type { UmbControllerHost } from '../../../../libs/controller-api/index.js';
3
+ import type { UmbDataSourceResponse } from '../../../core/repository/index.js';
4
+ /**
5
+ * A server data source for the current user's element permissions.
6
+ * @class UmbElementCurrentUserPermissionServerDataSource
7
+ */
8
+ export declare class UmbElementCurrentUserPermissionServerDataSource {
9
+ #private;
10
+ /**
11
+ * Creates an instance of UmbElementCurrentUserPermissionServerDataSource.
12
+ * @param {UmbControllerHost} host - The controller host for this controller to be appended to
13
+ * @memberof UmbElementCurrentUserPermissionServerDataSource
14
+ */
15
+ constructor(host: UmbControllerHost);
16
+ /**
17
+ * Requests the permissions the current user has at the given elements or element folders, as resolved by the server.
18
+ * @param {Array<string>} uniques - The uniques of the elements or element folders
19
+ * @returns {Promise<UmbDataSourceResponse<Array<UmbElementCurrentUserPermissionsModel>>>} The permissions for each unique
20
+ * @memberof UmbElementCurrentUserPermissionServerDataSource
21
+ */
22
+ requestPermissions(uniques: Array<string>): Promise<UmbDataSourceResponse<Array<UmbElementCurrentUserPermissionsModel>>>;
23
+ }
@@ -0,0 +1,32 @@
1
+ import { tryExecute } from '../../../core/resources/index.js';
2
+ import { UserService } from '../../../core/backend-api/index.js';
3
+ /**
4
+ * A server data source for the current user's element permissions.
5
+ * @class UmbElementCurrentUserPermissionServerDataSource
6
+ */
7
+ export class UmbElementCurrentUserPermissionServerDataSource {
8
+ #host;
9
+ /**
10
+ * Creates an instance of UmbElementCurrentUserPermissionServerDataSource.
11
+ * @param {UmbControllerHost} host - The controller host for this controller to be appended to
12
+ * @memberof UmbElementCurrentUserPermissionServerDataSource
13
+ */
14
+ constructor(host) {
15
+ this.#host = host;
16
+ }
17
+ /**
18
+ * Requests the permissions the current user has at the given elements or element folders, as resolved by the server.
19
+ * @param {Array<string>} uniques - The uniques of the elements or element folders
20
+ * @returns {Promise<UmbDataSourceResponse<Array<UmbElementCurrentUserPermissionsModel>>>} The permissions for each unique
21
+ * @memberof UmbElementCurrentUserPermissionServerDataSource
22
+ */
23
+ async requestPermissions(uniques) {
24
+ const { data, error } = await tryExecute(this.#host, UserService.getUserCurrentPermissionsElement({ query: { id: uniques } }), { disableNotifications: true });
25
+ if (error || !data) {
26
+ return { error };
27
+ }
28
+ return {
29
+ data: data.permissions.map((item) => ({ unique: item.nodeKey, verbs: item.permissions })),
30
+ };
31
+ }
32
+ }
@@ -0,0 +1,2 @@
1
+ export { UmbElementCurrentUserPermissionRepository } from './element-current-user-permission.repository.js';
2
+ export { UMB_ELEMENT_CURRENT_USER_PERMISSION_REPOSITORY_ALIAS } from './constants.js';
@@ -0,0 +1,2 @@
1
+ export { UmbElementCurrentUserPermissionRepository } from './element-current-user-permission.repository.js';
2
+ export { UMB_ELEMENT_CURRENT_USER_PERMISSION_REPOSITORY_ALIAS } from './constants.js';
@@ -0,0 +1 @@
1
+ export declare const manifests: Array<UmbExtensionManifest>;
@@ -0,0 +1,9 @@
1
+ import { UMB_ELEMENT_CURRENT_USER_PERMISSION_REPOSITORY_ALIAS } from './constants.js';
2
+ export const manifests = [
3
+ {
4
+ type: 'repository',
5
+ alias: UMB_ELEMENT_CURRENT_USER_PERMISSION_REPOSITORY_ALIAS,
6
+ name: 'Element Current User Permission Repository',
7
+ api: () => import('./element-current-user-permission.repository.js'),
8
+ },
9
+ ];
@@ -0,0 +1,6 @@
1
+ export interface UmbElementCurrentUserPermissionsModel {
2
+ /** The unique of the element or element folder. */
3
+ unique: string;
4
+ /** The permission verbs the current user has at that element or element folder. */
5
+ verbs: Array<string>;
6
+ }
@@ -1,5 +1,6 @@
1
1
  import type { UmbUserPermissionModel } from '../../user/user-permission/index.js';
2
2
  export type * from './conditions/types.js';
3
+ export type * from './repository/types.js';
3
4
  export interface UmbElementUserPermissionModel extends UmbUserPermissionModel {
4
5
  element: {
5
6
  id: string;
@@ -8,7 +8,7 @@ import { UMB_CURRENT_USER_HISTORY_STORE_CONTEXT } from './current-user-history.s
8
8
  import { html, customElement, state, nothing, css, repeat } from '../../../../external/lit/index.js';
9
9
  import { UmbLitElement } from '../../../core/lit-element/index.js';
10
10
  import { UmbTextStyles } from '../../../core/style/index.js';
11
- import { UmbPaginationManager } from '../../../core/utils/index.js';
11
+ import { truncateString, UmbPaginationManager } from '../../../core/utils/index.js';
12
12
  const PAGE_SIZE = 10;
13
13
  let UmbCurrentUserHistoryUserProfileAppElement = class UmbCurrentUserHistoryUserProfileAppElement extends UmbLitElement {
14
14
  #currentUserHistoryStore;
@@ -42,17 +42,6 @@ let UmbCurrentUserHistoryUserProfileAppElement = class UmbCurrentUserHistoryUser
42
42
  const skip = this.#pagination.getSkip();
43
43
  return this._history.slice(skip, skip + PAGE_SIZE);
44
44
  }
45
- #truncate(input, length, separator = '...') {
46
- if (!input)
47
- return '';
48
- if (input.length <= length)
49
- return input;
50
- const separatorLength = separator.length;
51
- const charsToShow = length - separatorLength;
52
- const frontChars = Math.ceil(charsToShow / 2);
53
- const backChars = Math.floor(charsToShow / 2);
54
- return input.substring(0, frontChars) + separator + input.substring(input.length - backChars);
55
- }
56
45
  render() {
57
46
  return html `
58
47
  <uui-box headline=${this.localize.term('user_yourHistory')}>
@@ -65,7 +54,7 @@ let UmbCurrentUserHistoryUserProfileAppElement = class UmbCurrentUserHistoryUser
65
54
  }
66
55
  #renderItem(item) {
67
56
  return html `
68
- <uui-ref-node name=${item.label} detail=${this.#truncate(item.displayPath, 50)} href=${item.path}>
57
+ <uui-ref-node name=${item.label} detail=${truncateString(item.displayPath, 50, '...')} href=${item.path}>
69
58
  <uui-icon slot="icon" name="icon-link"></uui-icon>
70
59
  </uui-ref-node>
71
60
  `;