move menu item conditions
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import type { ManifestTypes } from '../models/index.js';
|
||||
import { manifest as menuAliasConditionManifest } from './menu-alias.condition.js';
|
||||
import { manifest as multipleAppLanguagesConditionManifest } from './multiple-app-languages.condition.js';
|
||||
import { manifest as sectionAliasConditionManifest } from './section-alias.condition.js';
|
||||
import { manifest as switchConditionManifest } from './switch.condition.js';
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [
|
||||
menuAliasConditionManifest,
|
||||
multipleAppLanguagesConditionManifest,
|
||||
sectionAliasConditionManifest,
|
||||
switchConditionManifest,
|
||||
|
||||
@@ -65,16 +65,16 @@ export class UmbUiCultureInputElement extends UUIFormControlMixin(UmbLitElement,
|
||||
}
|
||||
|
||||
override render() {
|
||||
return html`
|
||||
<uui-select
|
||||
return html`
|
||||
<uui-select
|
||||
style="margin-top: var(--uui-size-space-1)"
|
||||
@change=${this.#onCustomValidationChange}
|
||||
.options=${this._options.map(e => ({
|
||||
.options=${this._options.map((e) => ({
|
||||
name: e.name,
|
||||
value: e.value,
|
||||
selected: e.value == this.value
|
||||
selected: e.value == this.value,
|
||||
}))}></uui-select>
|
||||
`;
|
||||
`;
|
||||
}
|
||||
|
||||
static override styles = [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type { ManifestTypes, UmbBackofficeManifestKind } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes | UmbBackofficeManifestKind> = [
|
||||
export const manifests: Array<UmbExtensionManifest> = [
|
||||
{
|
||||
type: 'kind',
|
||||
alias: 'Umb.Kind.MenuItem.Link',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { manifests as linkManifests } from './link/manifests.js';
|
||||
import type { ManifestTypes, UmbBackofficeManifestKind } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes | UmbBackofficeManifestKind> = [...linkManifests];
|
||||
export const manifests: Array<UmbExtensionManifest> = [...linkManifests];
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
import { UMB_MENU_CONTEXT } from '../../menu/components/menu/menu.context.js';
|
||||
import { UmbConditionBase } from './condition-base.controller.js';
|
||||
import { UMB_MENU_CONTEXT } from '../components/menu/menu.context.js';
|
||||
import { UmbConditionBase } from '../../extension-registry/conditions/condition-base.controller.js';
|
||||
import type { MenuAliasConditionConfig } from './types.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type {
|
||||
ManifestCondition,
|
||||
UmbConditionConfigBase,
|
||||
UmbConditionControllerArguments,
|
||||
UmbExtensionCondition,
|
||||
} from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
export type MenuAliasConditionConfig = UmbConditionConfigBase & {
|
||||
match: string;
|
||||
};
|
||||
|
||||
export class UmbMenuAliasCondition extends UmbConditionBase<MenuAliasConditionConfig> implements UmbExtensionCondition {
|
||||
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<MenuAliasConditionConfig>) {
|
||||
super(host, args);
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { UmbConditionConfigBase } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
export type MenuAliasConditionConfig = UmbConditionConfigBase & {
|
||||
match: string;
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import { manifests as menuItemManifests } from './components/menu-item/manifests.js';
|
||||
import type { ManifestTypes, UmbBackofficeManifestKind } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { manifest as menuAliasConditionManifest } from './conditions/menu-alias.condition.js';
|
||||
|
||||
export const manifests: Array<ManifestTypes | UmbBackofficeManifestKind> = [...menuItemManifests];
|
||||
export const manifests: Array<UmbExtensionManifest> = [...menuItemManifests, menuAliasConditionManifest];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';
|
||||
export type * from './conditions/types.js';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
export interface UmbStructureItemModelBase extends UmbEntityModel {}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { UmbExtensionsManifestInitializer, createExtensionElement } from '@umbra
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { pathFolderName } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
// TODO: this might need a new name, since it's both views and dashboards
|
||||
@customElement('umb-section-main-views')
|
||||
export class UmbSectionMainViewElement extends UmbLitElement {
|
||||
@property({ type: String, attribute: 'section-alias' })
|
||||
@@ -48,12 +47,12 @@ export class UmbSectionMainViewElement extends UmbLitElement {
|
||||
}
|
||||
|
||||
#constructDashboardPath(manifest: ManifestDashboard) {
|
||||
const dashboardName = manifest.meta.label ?? manifest.name;
|
||||
const dashboardName = manifest.meta.label ?? manifest.name ?? manifest.alias;
|
||||
return 'dashboard/' + (manifest.meta.pathname ? manifest.meta.pathname : pathFolderName(dashboardName));
|
||||
}
|
||||
|
||||
#constructViewPath(manifest: ManifestSectionView) {
|
||||
const viewName = manifest.meta.label ?? manifest.name;
|
||||
const viewName = manifest.meta.label ?? manifest.name ?? manifest.alias;
|
||||
return 'view/' + (manifest.meta.pathname ? manifest.meta.pathname : pathFolderName(viewName));
|
||||
}
|
||||
|
||||
@@ -119,7 +118,9 @@ export class UmbSectionMainViewElement extends UmbLitElement {
|
||||
return html`
|
||||
<uui-tab
|
||||
href="${this._routerPath}/${dashboardPath}"
|
||||
label="${dashboard.meta.label ? this.localize.string(dashboard.meta.label) : dashboard.name}"
|
||||
label="${dashboard.meta.label
|
||||
? this.localize.string(dashboard.meta.label)
|
||||
: (dashboard.name ?? dashboard.alias)}"
|
||||
?active="${this._activePath === dashboardPath}"></uui-tab>
|
||||
`;
|
||||
})}
|
||||
@@ -134,7 +135,7 @@ export class UmbSectionMainViewElement extends UmbLitElement {
|
||||
? html`
|
||||
<uui-tab-group slot="navigation" id="views">
|
||||
${this._views.map((view) => {
|
||||
const viewName = view.meta.label ? this.localize.string(view.meta.label) : view.name;
|
||||
const viewName = view.meta.label ? this.localize.string(view.meta.label) : (view.name ?? view.alias);
|
||||
const viewPath = this.#constructViewPath(view);
|
||||
return html`
|
||||
<uui-tab
|
||||
|
||||
Reference in New Issue
Block a user