From 950ce0f17fe03267b73dc86fc9f1d33cedf42a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 10:02:06 +0200 Subject: [PATCH 1/7] align code across content workspaces --- .../workspace/block-type-workspace.context.ts | 3 +- .../workspace/block-workspace.context.ts | 3 +- .../property-type-workspace.context.ts | 3 +- .../workspace-is-new-redirect.controller.ts | 6 +- .../documents/document-blueprints/entity.ts | 5 + .../documents/document-blueprints/paths.ts | 21 ++++ .../documents/document-blueprints/utils.ts | 16 +++ .../document-blueprint-workspace.context.ts | 104 ++++++++++++------ .../document-type-workspace.context.ts | 3 +- .../workspace/document-workspace.context.ts | 90 ++++++++------- .../language/language-workspace.context.ts | 3 +- .../webhook/webhook-workspace.context.ts | 3 +- 12 files changed, 183 insertions(+), 77 deletions(-) create mode 100644 src/packages/documents/document-blueprints/paths.ts create mode 100644 src/packages/documents/document-blueprints/utils.ts diff --git a/src/packages/block/block-type/workspace/block-type-workspace.context.ts b/src/packages/block/block-type/workspace/block-type-workspace.context.ts index 478e9473e9..8b9d425241 100644 --- a/src/packages/block/block-type/workspace/block-type-workspace.context.ts +++ b/src/packages/block/block-type/workspace/block-type-workspace.context.ts @@ -11,6 +11,7 @@ import { UmbSubmittableWorkspaceContextBase, UmbInvariantWorkspacePropertyDatasetContext, UmbWorkspaceIsNewRedirectController, + UmbWorkspaceIsNewRedirectControllerAlias, } from '@umbraco-cms/backoffice/workspace'; import { UmbObjectState, appendToFrozenArray } from '@umbraco-cms/backoffice/observable-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; @@ -70,7 +71,7 @@ export class UmbBlockTypeWorkspaceContext, router: UmbRouterSlotElement, ) { - super(host, 'isNewRedirectController'); + super(host, UmbWorkspaceIsNewRedirectControllerAlias); // Navigate to edit route when language is created: this.observe(workspaceContext.isNew, (isNew) => { @@ -37,5 +39,7 @@ export class UmbWorkspaceIsNewRedirectController extends UmbControllerBase { } } }); + + // TODO: If workspace route changes cause of other reasons then this controller should be destroyed. } } diff --git a/src/packages/documents/document-blueprints/entity.ts b/src/packages/documents/document-blueprints/entity.ts index 8aa8201389..73297b923f 100644 --- a/src/packages/documents/document-blueprints/entity.ts +++ b/src/packages/documents/document-blueprints/entity.ts @@ -5,3 +5,8 @@ export const UMB_DOCUMENT_BLUEPRINT_FOLDER_ENTITY_TYPE = 'document-blueprint-fol export type UmbDocumentBlueprintRootEntityType = typeof UMB_DOCUMENT_BLUEPRINT_ROOT_ENTITY_TYPE; export type UmbDocumentBlueprintEntityType = typeof UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE; export type UmbDocumentBlueprintFolderEntityType = typeof UMB_DOCUMENT_BLUEPRINT_FOLDER_ENTITY_TYPE; + +export type UmbDocumentBlueprintEntityTypeUnion = + | UmbDocumentBlueprintRootEntityType + | UmbDocumentBlueprintEntityType + | UmbDocumentBlueprintFolderEntityType; diff --git a/src/packages/documents/document-blueprints/paths.ts b/src/packages/documents/document-blueprints/paths.ts new file mode 100644 index 0000000000..0a045e893b --- /dev/null +++ b/src/packages/documents/document-blueprints/paths.ts @@ -0,0 +1,21 @@ +import { UMB_DOCUMENTS_SECTION_PATHNAME } from '../section/paths.js'; +import { UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE, type UmbDocumentBlueprintEntityTypeUnion } from './entity.js'; +import type { UmbEntityUnique } from '@umbraco-cms/backoffice/entity'; +import { UmbPathPattern } from '@umbraco-cms/backoffice/router'; +import { UMB_WORKSPACE_PATH_PATTERN } from '@umbraco-cms/backoffice/workspace'; + +export const UMB_DOCUMENT_BLUEPRINT_WORKSPACE_PATH = UMB_WORKSPACE_PATH_PATTERN.generateAbsolute({ + sectionName: UMB_DOCUMENTS_SECTION_PATHNAME, + entityType: UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE, +}); + +export const UMB_CREATE_DOCUMENT_BLUEPRINT_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ + parentEntityType: UmbDocumentBlueprintEntityTypeUnion; + parentUnique?: UmbEntityUnique; + documentTypeUnique: string; +}>('create/parent/:parentEntityType/:parentUnique/:documentTypeUnique', UMB_DOCUMENT_BLUEPRINT_WORKSPACE_PATH); + +export const UMB_EDIT_BLUEPRINT_DOCUMENT_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ unique: string }>( + 'edit/:unique', + UMB_DOCUMENT_BLUEPRINT_WORKSPACE_PATH, +); diff --git a/src/packages/documents/document-blueprints/utils.ts b/src/packages/documents/document-blueprints/utils.ts new file mode 100644 index 0000000000..18bd0fdeb9 --- /dev/null +++ b/src/packages/documents/document-blueprints/utils.ts @@ -0,0 +1,16 @@ +import type { UmbDocumentBlueprintVariantOptionModel } from './types.js'; + +type VariantType = UmbDocumentBlueprintVariantOptionModel; + +export const sortVariants = (a: VariantType, b: VariantType) => { + const compareDefault = (a: VariantType, b: VariantType) => + (a.language?.isDefault ? -1 : 1) - (b.language?.isDefault ? -1 : 1); + + // Make sure mandatory variants goes on top. + const compareMandatory = (a: VariantType, b: VariantType) => + (a.language?.isMandatory ? -1 : 1) - (b.language?.isMandatory ? -1 : 1); + + const compareName = (a: VariantType, b: VariantType) => a.variant?.name.localeCompare(b.variant?.name || '') || 99; + + return compareDefault(a, b) || compareMandatory(a, b) || compareName(a, b); +}; diff --git a/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts b/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts index 9ef91ae72d..c3acbd81d2 100644 --- a/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts +++ b/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts @@ -7,6 +7,8 @@ import type { UmbDocumentBlueprintVariantModel, UmbDocumentBlueprintVariantOptionModel, } from '../types.js'; +import { sortVariants } from '../utils.js'; +import { UMB_CREATE_DOCUMENT_BLUEPRINT_WORKSPACE_PATH_PATTERN } from '../paths.js'; import { UMB_DOCUMENT_BLUEPRINT_WORKSPACE_ALIAS } from './manifests.js'; import { appendToFrozenArray, @@ -17,6 +19,7 @@ import { import { UmbSubmittableWorkspaceContextBase, UmbWorkspaceIsNewRedirectController, + UmbWorkspaceIsNewRedirectControllerAlias, UmbWorkspaceSplitViewManager, } from '@umbraco-cms/backoffice/workspace'; import { UmbContentTypeStructureManager } from '@umbraco-cms/backoffice/content-type'; @@ -35,8 +38,15 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import type { UmbLanguageDetailModel } from '@umbraco-cms/backoffice/language'; import { UmbContentWorkspaceDataManager, type UmbContentWorkspaceContext } from '@umbraco-cms/backoffice/content'; import { UmbReadOnlyVariantStateManager } from '@umbraco-cms/backoffice/utils'; -import { UMB_DOCUMENT_DETAIL_MODEL_VARIANT_SCAFFOLD } from '@umbraco-cms/backoffice/document'; +import { + UMB_DOCUMENT_COLLECTION_ALIAS, + UMB_DOCUMENT_DETAIL_MODEL_VARIANT_SCAFFOLD, + UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN, +} from '@umbraco-cms/backoffice/document'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; +import { Observable, map } from '@umbraco-cms/backoffice/external/rxjs'; +import { UmbEntityContext, type UmbEntityModel } from '@umbraco-cms/backoffice/entity'; +import { UMB_SETTINGS_SECTION_PATH } from '@umbraco-cms/backoffice/settings'; type EntityModel = UmbDocumentBlueprintDetailModel; @@ -119,27 +129,46 @@ export class UmbDocumentBlueprintWorkspaceContext } return []; }, - ); + ).pipe(map((results) => results.sort(sortVariants))); + + // TODO: this should be set up for all entity workspace contexts in a base class + #entityContext = new UmbEntityContext(this); constructor(host: UmbControllerHost) { super(host, UMB_DOCUMENT_BLUEPRINT_WORKSPACE_ALIAS); - this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique)); - - this.observe(this.variesByCulture, (varies) => { - this.#data.setVariesByCulture(varies); - this.#variesByCulture = varies; - }); - this.observe(this.variesBySegment, (varies) => { - this.#data.setVariesBySegment(varies); - this.#variesBySegment = varies; - }); - this.observe(this.varies, (varies) => (this.#varies = varies)); - - this.observe(this.structure.contentTypeDataTypeUniques, (dataTypeUniques: Array) => { - this.#dataTypeItemManager.setUniques(dataTypeUniques); - }); - + this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique), null); + this.observe( + this.varies, + (varies) => { + this.#data.setVaries(varies); + this.#varies = varies; + }, + null, + ); + this.observe( + this.variesByCulture, + (varies) => { + this.#data.setVariesByCulture(varies); + this.#variesByCulture = varies; + }, + null, + ); + this.observe( + this.variesBySegment, + (varies) => { + this.#data.setVariesBySegment(varies); + this.#variesBySegment = varies; + }, + null, + ); + this.observe( + this.structure.contentTypeDataTypeUniques, + (dataTypeUniques: Array) => { + this.#dataTypeItemManager.setUniques(dataTypeUniques); + }, + null, + ); this.observe(this.#dataTypeItemManager.items, (dataTypes) => { // Make a map of the data type unique and editorAlias: this.#dataTypeSchemaAliasMap = new Map( @@ -148,14 +177,15 @@ export class UmbDocumentBlueprintWorkspaceContext }), ); }); + this.loadLanguages(); this.routes.setRoutes([ { - path: 'create/parent/:entityType/:parentUnique/:documentTypeUnique', + path: UMB_CREATE_DOCUMENT_BLUEPRINT_WORKSPACE_PATH_PATTERN.toString(), component: () => import('./document-blueprint-workspace-editor.element.js'), setup: async (_component, info) => { - const parentEntityType = info.match.params.entityType; + const parentEntityType = info.match.params.parentEntityType; const parentUnique = info.match.params.parentUnique === 'null' ? null : info.match.params.parentUnique; const documentTypeUnique = info.match.params.documentTypeUnique; this.create({ entityType: parentEntityType, unique: parentUnique }, documentTypeUnique); @@ -168,10 +198,10 @@ export class UmbDocumentBlueprintWorkspaceContext }, }, { - path: 'edit/:unique', + path: UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN.toString(), component: () => import('./document-blueprint-workspace-editor.element.js'), setup: (_component, info) => { - this.removeUmbControllerByAlias('isNewRedirectController'); + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); const unique = info.match.params.unique; this.load(unique); }, @@ -181,8 +211,7 @@ export class UmbDocumentBlueprintWorkspaceContext override resetState() { super.resetState(); - this.#data.setPersisted(undefined); - this.#data.setCurrent(undefined); + this.#data.clear(); } async loadLanguages() { @@ -194,42 +223,50 @@ export class UmbDocumentBlueprintWorkspaceContext async load(unique: string) { this.resetState(); this.#getDataPromise = this.repository.requestByUnique(unique); - const { data, asObservable } = await this.repository.requestByUnique(unique); + type GetDataType = Awaited>; + const { data, asObservable } = (await this.#getDataPromise) as GetDataType; if (data) { + this.#entityContext.setEntityType(UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE); + this.#entityContext.setUnique(unique); this.setIsNew(false); this.#data.setPersisted(data); this.#data.setCurrent(data); } - if (asObservable) { - this.observe(asObservable(), (entity) => this.#onStoreChange(entity), 'UmbDocumentBlueprintStoreObserver'); - } + this.observe(asObservable(), (entity) => this.#onStoreChange(entity), 'UmbDocumentBlueprintStoreObserver'); } #onStoreChange(entity: EntityModel | undefined) { if (!entity) { //TODO: This solution is alright for now. But reconsider when we introduce signal-r - history.pushState(null, '', 'section/document-blueprint'); + history.pushState(null, '', UMB_SETTINGS_SECTION_PATH); } } - async create(parent: { entityType: string; unique: string | null }, documentTypeUnique: string) { + async create(parent: UmbEntityModel, documentTypeUnique: string) { this.resetState(); this.#parent.setValue(parent); - const { data } = await this.repository.createScaffold({ + this.#getDataPromise = this.repository.createScaffold({ documentType: { unique: documentTypeUnique, collection: null }, }); + const { data } = await this.#getDataPromise; if (!data) return undefined; + this.#entityContext.setEntityType(UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE); + this.#entityContext.setUnique(data.unique); this.setIsNew(true); this.#data.setPersisted(undefined); this.#data.setCurrent(data); return data; } + getCollectionAlias() { + return UMB_DOCUMENT_COLLECTION_ALIAS; + } + getData() { return this.#data.getCurrent(); } @@ -294,7 +331,10 @@ export class UmbDocumentBlueprintWorkspaceContext * @returns {Promise | undefined>} * @description Get an Observable for the value of this property. */ - async propertyValueByAlias(propertyAlias: string, variantId?: UmbVariantId) { + async propertyValueByAlias( + propertyAlias: string, + variantId?: UmbVariantId, + ): Promise | undefined> { return this.#data.createObservablePartOfCurrent( (data) => data?.values?.find((x) => x?.alias === propertyAlias && (variantId ? variantId.compare(x as any) : true)) diff --git a/src/packages/documents/document-types/workspace/document-type-workspace.context.ts b/src/packages/documents/document-types/workspace/document-type-workspace.context.ts index a18f945efd..2088d49858 100644 --- a/src/packages/documents/document-types/workspace/document-type-workspace.context.ts +++ b/src/packages/documents/document-types/workspace/document-type-workspace.context.ts @@ -18,6 +18,7 @@ import { import { UmbSubmittableWorkspaceContextBase, UmbWorkspaceIsNewRedirectController, + UmbWorkspaceIsNewRedirectControllerAlias, } from '@umbraco-cms/backoffice/workspace'; import { UmbTemplateDetailRepository } from '@umbraco-cms/backoffice/template'; import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; @@ -132,7 +133,7 @@ export class UmbDocumentTypeWorkspaceContext path: UMB_EDIT_DOCUMENT_TYPE_WORKSPACE_PATH_PATTERN.toString(), component: UmbDocumentTypeWorkspaceEditorElement, setup: (_component, info) => { - this.removeUmbControllerByAlias('isNewRedirectController'); + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); const unique = info.match.params.unique; this.load(unique); }, diff --git a/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/packages/documents/documents/workspace/document-workspace.context.ts index a4f7449d35..58be94458c 100644 --- a/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -27,7 +27,7 @@ import { UMB_DOCUMENTS_SECTION_PATH } from '../../section/paths.js'; import { UmbDocumentPreviewRepository } from '../repository/preview/index.js'; import { sortVariants } from '../utils.js'; import { UMB_DOCUMENT_DETAIL_MODEL_VARIANT_SCAFFOLD, UMB_DOCUMENT_WORKSPACE_ALIAS } from './constants.js'; -import { UmbEntityContext } from '@umbraco-cms/backoffice/entity'; +import { UmbEntityContext, type UmbEntityModel } from '@umbraco-cms/backoffice/entity'; import { UMB_INVARIANT_CULTURE, UmbVariantId } from '@umbraco-cms/backoffice/variant'; import { UmbContentTypeStructureManager } from '@umbraco-cms/backoffice/content-type'; import { @@ -35,6 +35,7 @@ import { UmbSubmittableWorkspaceContextBase, UmbWorkspaceIsNewRedirectController, UmbWorkspaceSplitViewManager, + UmbWorkspaceIsNewRedirectControllerAlias, } from '@umbraco-cms/backoffice/workspace'; import { appendToFrozenArray, @@ -72,6 +73,7 @@ import type { UmbDocumentTypeDetailModel } from '@umbraco-cms/backoffice/documen import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin'; import { UmbReadOnlyVariantStateManager } from '@umbraco-cms/backoffice/utils'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; +import { UMB_DOCUMENT_COLLECTION_ALIAS } from '../collection/index.js'; type EntityModel = UmbDocumentDetailModel; type EntityTypeModel = UmbDocumentTypeDetailModel; @@ -183,34 +185,51 @@ export class UmbDocumentWorkspaceContext new UmbVariantValuesValidationPathTranslator(this); new UmbVariantsValidationPathTranslator(this); - this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique)); - this.observe(this.varies, (varies) => { - this.#data.setVaries(varies); - }); - this.observe(this.variesByCulture, (varies) => { - this.#data.setVariesByCulture(varies); - this.#variesByCulture = varies; - }); - this.observe(this.variesBySegment, (varies) => { - this.#data.setVariesBySegment(varies); - this.#variesBySegment = varies; - }); - this.observe(this.varies, (varies) => { - this.#varies = varies; - }); - - this.observe(this.structure.contentTypeDataTypeUniques, (dataTypeUniques: Array) => { - this.#dataTypeItemManager.setUniques(dataTypeUniques); - }); + this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique), null); + this.observe( + this.varies, + (varies) => { + this.#data.setVaries(varies); - this.observe(this.#dataTypeItemManager.items, (dataTypes) => { - // Make a map of the data type unique and editorAlias: - this.#dataTypeSchemaAliasMap = new Map( - dataTypes.map((dataType) => { - return [dataType.unique, dataType.propertyEditorSchemaAlias]; - }), - ); - }); + this.#varies = varies; + }, + null, + ); + this.observe( + this.variesByCulture, + (varies) => { + this.#data.setVariesByCulture(varies); + this.#variesByCulture = varies; + }, + null, + ); + this.observe( + this.variesBySegment, + (varies) => { + this.#data.setVariesBySegment(varies); + this.#variesBySegment = varies; + }, + null, + ); + this.observe( + this.structure.contentTypeDataTypeUniques, + (dataTypeUniques: Array) => { + this.#dataTypeItemManager.setUniques(dataTypeUniques); + }, + null, + ); + this.observe( + this.#dataTypeItemManager.items, + (dataTypes) => { + // Make a map of the data type unique and editorAlias: + this.#dataTypeSchemaAliasMap = new Map( + dataTypes.map((dataType) => { + return [dataType.unique, dataType.propertyEditorSchemaAlias]; + }), + ); + }, + null, + ); this.loadLanguages(); @@ -253,6 +272,7 @@ export class UmbDocumentWorkspaceContext path: UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN.toString(), component: () => import('./document-workspace-editor.element.js'), setup: (_component, info) => { + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); const unique = info.match.params.unique; this.load(unique); }, @@ -262,8 +282,7 @@ export class UmbDocumentWorkspaceContext override resetState() { super.resetState(); - this.#data.setPersisted(undefined); - this.#data.setCurrent(undefined); + this.#data.clear(); } async loadLanguages() { @@ -297,11 +316,7 @@ export class UmbDocumentWorkspaceContext } } - async create( - parent: { entityType: string; unique: string | null }, - documentTypeUnique: string, - blueprintUnique?: string, - ) { + async create(parent: UmbEntityModel, documentTypeUnique: string, blueprintUnique?: string) { this.resetState(); this.#parent.setValue(parent); @@ -336,7 +351,7 @@ export class UmbDocumentWorkspaceContext } getCollectionAlias() { - return 'Umb.Collection.Document'; + return UMB_DOCUMENT_COLLECTION_ALIAS; } getData() { @@ -384,7 +399,6 @@ export class UmbDocumentWorkspaceContext } setName(name: string, variantId?: UmbVariantId) { - // TODO: We should move this type of logic to the act of saving [NL] this.#data.updateVariantData(variantId ?? UmbVariantId.CreateInvariant(), { name }); } @@ -438,7 +452,7 @@ export class UmbDocumentWorkspaceContext * @returns The value or undefined if not set or found. */ getPropertyValue(alias: string, variantId?: UmbVariantId) { - const currentData = this.getData(); + const currentData = this.#data.getCurrent(); if (currentData) { const newDataSet = currentData.values?.find( (x) => x.alias === alias && (variantId ? variantId.compare(x) : true), diff --git a/src/packages/language/workspace/language/language-workspace.context.ts b/src/packages/language/workspace/language/language-workspace.context.ts index a0c0db4d18..97b2dc8507 100644 --- a/src/packages/language/workspace/language/language-workspace.context.ts +++ b/src/packages/language/workspace/language/language-workspace.context.ts @@ -8,6 +8,7 @@ import { UmbWorkspaceIsNewRedirectController, type UmbRoutableWorkspaceContext, UmbEntityDetailWorkspaceContextBase, + UmbWorkspaceIsNewRedirectControllerAlias, } from '@umbraco-cms/backoffice/workspace'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; @@ -44,7 +45,7 @@ export class UmbLanguageWorkspaceContext path: 'edit/:unique', component: UmbLanguageWorkspaceEditorElement, setup: (_component, info) => { - this.removeUmbControllerByAlias('isNewRedirectController'); + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); this.load(info.match.params.unique); }, }, diff --git a/src/packages/webhook/workspace/webhook/webhook-workspace.context.ts b/src/packages/webhook/workspace/webhook/webhook-workspace.context.ts index 3eaebfc49a..d817275122 100644 --- a/src/packages/webhook/workspace/webhook/webhook-workspace.context.ts +++ b/src/packages/webhook/workspace/webhook/webhook-workspace.context.ts @@ -8,6 +8,7 @@ import { UmbWorkspaceIsNewRedirectController, type UmbRoutableWorkspaceContext, UmbEntityDetailWorkspaceContextBase, + UmbWorkspaceIsNewRedirectControllerAlias, } from '@umbraco-cms/backoffice/workspace'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; @@ -40,7 +41,7 @@ export class UmbWebhookWorkspaceContext path: 'edit/:unique', component: UmbWebhookWorkspaceEditorElement, setup: (_component, info) => { - this.removeUmbControllerByAlias('isNewRedirectController'); + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); this.load(info.match.params.unique); }, }, From bbe8e36cd70d76749a38b4dcd6ef55c0968b2b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 10:26:23 +0200 Subject: [PATCH 2/7] blueprint save alignment --- .../document-blueprint-workspace.context.ts | 46 +++++++++++++------ .../workspace/document-workspace.context.ts | 12 +---- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts b/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts index c3acbd81d2..a54759a714 100644 --- a/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts +++ b/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts @@ -396,7 +396,7 @@ export class UmbDocumentBlueprintWorkspaceContext this.#data.finishPropertyValueChange(); }; - async #createOrSave() { + async #handleSave() { const current = this.#data.getCurrent(); if (!current?.unique) throw new Error('Unique is missing'); @@ -404,34 +404,49 @@ export class UmbDocumentBlueprintWorkspaceContext const parent = this.#parent.getValue(); if (!parent) throw new Error('Parent is not set'); - if ((await this.repository.create(current, parent.unique)).data !== undefined) { - this.setIsNew(false); - - // TODO: this might not be the right place to alert the tree, but it works for now - const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); - const event = new UmbRequestReloadChildrenOfEntityEvent({ - entityType: parent.entityType, - unique: parent.unique, - }); - eventContext.dispatchEvent(event); + const { data, error } = await this.repository.create(current, parent.unique); + if (!data || error) { + console.error('Error creating document', error); + throw new Error('Error creating document'); } + + this.setIsNew(false); + this.#data.setPersisted(data); + // We do not know about the variant IDs, so lets update everything. + this.#data.setCurrent(data); + + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const event = new UmbRequestReloadChildrenOfEntityEvent({ + entityType: parent.entityType, + unique: parent.unique, + }); + eventContext.dispatchEvent(event); } else { - await this.repository.save(current); + // Save: + const { data, error } = await this.repository.save(current); + if (!data || error) { + console.error('Error saving document', error); + throw new Error('Error saving document'); + } + + this.#data.setPersisted(data); + // We do not know about the variant IDs, so lets update everything. + this.#data.setCurrent(data); - const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); const event = new UmbRequestReloadStructureForEntityEvent({ unique: this.getUnique()!, entityType: this.getEntityType(), }); - actionEventContext.dispatchEvent(event); + eventContext.dispatchEvent(event); } } async submit() { const data = this.getData(); if (!data) throw new Error('Data is missing'); - await this.#createOrSave(); + await this.#handleSave(); } async delete() { @@ -451,6 +466,7 @@ export class UmbDocumentBlueprintWorkspaceContext public override destroy(): void { this.#data.destroy(); this.structure.destroy(); + this.#languageRepository.destroy(); super.destroy(); } } diff --git a/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/packages/documents/documents/workspace/document-workspace.context.ts index 58be94458c..f1cfb421d7 100644 --- a/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -433,17 +433,6 @@ export class UmbDocumentWorkspaceContext ?.value as PropertyValueType, ); } - // TODO: Re-evaluate if this is begin used, i wrote this as part of a POC... [NL] - /* - async propertyIndexByAlias( - propertyAlias: string, - variantId?: UmbVariantId, - ): Promise | undefined> { - return this.#data.current.asObservablePart((data) => - data?.values?.findIndex((x) => x?.alias === propertyAlias && (variantId ? variantId.compare(x) : true)), - ); - } - */ /** * Get the current value of the property with the given alias and variantId. @@ -870,6 +859,7 @@ export class UmbDocumentWorkspaceContext } public override destroy(): void { + this.#data.destroy(); this.structure.destroy(); this.#languageRepository.destroy(); super.destroy(); From 658ae0da777b18f323cf3875173249f47ef7aae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 10:39:36 +0200 Subject: [PATCH 3/7] use types --- .../repository/detail/detail-repository-base.ts | 13 +++++++++---- src/packages/core/repository/index.ts | 2 +- src/packages/core/repository/types.ts | 2 +- .../workspace/document-workspace.context.ts | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/packages/core/repository/detail/detail-repository-base.ts b/src/packages/core/repository/detail/detail-repository-base.ts index 33bc4e0864..5f7d695eaa 100644 --- a/src/packages/core/repository/detail/detail-repository-base.ts +++ b/src/packages/core/repository/detail/detail-repository-base.ts @@ -1,4 +1,5 @@ import { UmbRepositoryBase } from '../repository-base.js'; +import type { UmbRepositoryResponse, UmbRepositoryResponseWithAsObservable } from '../types.js'; import type { UmbDetailDataSource, UmbDetailDataSourceConstructor } from './detail-data-source.interface.js'; import type { UmbDetailRepository } from './detail-repository.interface.js'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; @@ -51,7 +52,7 @@ export abstract class UmbDetailRepositoryBase< * @returns {*} * @memberof UmbDetailRepositoryBase */ - async createScaffold(preset?: Partial) { + async createScaffold(preset?: Partial): Promise> { return this.detailDataSource.createScaffold(preset); } @@ -61,7 +62,7 @@ export abstract class UmbDetailRepositoryBase< * @returns {*} * @memberof UmbDetailRepositoryBase */ - async requestByUnique(unique: string) { + async requestByUnique(unique: string): Promise> { if (!unique) throw new Error('Unique is missing'); await this.#init; @@ -71,7 +72,11 @@ export abstract class UmbDetailRepositoryBase< this.#detailStore!.append(data); } - return { data, error, asObservable: () => this.#detailStore!.byUnique(unique) }; + return { + data, + error, + asObservable: () => this.#detailStore!.byUnique(unique), + }; } /** @@ -81,7 +86,7 @@ export abstract class UmbDetailRepositoryBase< * @returns {*} * @memberof UmbDetailRepositoryBase */ - async create(model: DetailModelType, parentUnique: string | null) { + async create(model: DetailModelType, parentUnique: string | null): Promise> { if (!model) throw new Error('Data is missing'); await this.#init; diff --git a/src/packages/core/repository/index.ts b/src/packages/core/repository/index.ts index de9d2f55c2..3d2bf2606a 100644 --- a/src/packages/core/repository/index.ts +++ b/src/packages/core/repository/index.ts @@ -5,4 +5,4 @@ export * from './item/index.js'; export * from './detail/index.js'; export type { UmbDataSourceResponse, UmbDataSourceErrorResponse } from './data-source-response.interface.js'; -export type { UmbPagedModel, UmbRepositoryResponse, UmbRepositoryErrorResponse } from './types.js'; +export type * from './types.js'; diff --git a/src/packages/core/repository/types.ts b/src/packages/core/repository/types.ts index 5dd91e0392..958077f2aa 100644 --- a/src/packages/core/repository/types.ts +++ b/src/packages/core/repository/types.ts @@ -12,5 +12,5 @@ export interface UmbRepositoryResponse extends UmbDataSourceResponse {} export interface UmbRepositoryErrorResponse extends UmbDataSourceErrorResponse {} export interface UmbRepositoryResponseWithAsObservable extends UmbRepositoryResponse { - asObservable?: () => Observable; + asObservable: () => Observable; } diff --git a/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/packages/documents/documents/workspace/document-workspace.context.ts index f1cfb421d7..1f0bcc268a 100644 --- a/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -26,6 +26,7 @@ import { import { UMB_DOCUMENTS_SECTION_PATH } from '../../section/paths.js'; import { UmbDocumentPreviewRepository } from '../repository/preview/index.js'; import { sortVariants } from '../utils.js'; +import { UMB_DOCUMENT_COLLECTION_ALIAS } from '../collection/index.js'; import { UMB_DOCUMENT_DETAIL_MODEL_VARIANT_SCAFFOLD, UMB_DOCUMENT_WORKSPACE_ALIAS } from './constants.js'; import { UmbEntityContext, type UmbEntityModel } from '@umbraco-cms/backoffice/entity'; import { UMB_INVARIANT_CULTURE, UmbVariantId } from '@umbraco-cms/backoffice/variant'; @@ -73,7 +74,7 @@ import type { UmbDocumentTypeDetailModel } from '@umbraco-cms/backoffice/documen import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin'; import { UmbReadOnlyVariantStateManager } from '@umbraco-cms/backoffice/utils'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; -import { UMB_DOCUMENT_COLLECTION_ALIAS } from '../collection/index.js'; +import type { UmbRepositoryResponse } from '@umbraco-cms/backoffice/repository'; type EntityModel = UmbDocumentDetailModel; type EntityTypeModel = UmbDocumentTypeDetailModel; @@ -95,8 +96,8 @@ export class UmbDocumentWorkspaceContext readonly parentEntityType = this.#parent.asObservablePart((parent) => (parent ? parent.entityType : undefined)); readonly #data = new UmbContentWorkspaceDataManager(this, UMB_DOCUMENT_DETAIL_MODEL_VARIANT_SCAFFOLD); + #getDataPromise?: Promise>; - #getDataPromise?: Promise; // TODo: Optimize this so it uses either a App Language Context? [NL] #languageRepository = new UmbLanguageCollectionRepository(this); #languages = new UmbArrayState([], (x) => x.unique); From 51fb7249dbe152aa3109e7d108a073603fc468b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 11:07:40 +0200 Subject: [PATCH 4/7] align member --- .../workspace/document-workspace.context.ts | 12 +- src/packages/members/member/index.ts | 6 +- src/packages/members/member/utils.ts | 16 ++ .../member/member-workspace.context.ts | 160 ++++++++++++------ src/packages/members/section/index.ts | 1 + 5 files changed, 137 insertions(+), 58 deletions(-) create mode 100644 src/packages/members/member/utils.ts diff --git a/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/packages/documents/documents/workspace/document-workspace.context.ts index 1f0bcc268a..3dca29a82e 100644 --- a/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -91,7 +91,7 @@ export class UmbDocumentWorkspaceContext public readonly repository = new UmbDocumentDetailRepository(this); public readonly publishingRepository = new UmbDocumentPublishingRepository(this); - #parent = new UmbObjectState<{ entityType: string; unique: string | null } | undefined>(undefined); + #parent = new UmbObjectState(undefined); readonly parentUnique = this.#parent.asObservablePart((parent) => (parent ? parent.unique : undefined)); readonly parentEntityType = this.#parent.asObservablePart((parent) => (parent ? parent.entityType : undefined)); @@ -106,7 +106,7 @@ export class UmbDocumentWorkspaceContext #serverValidation = new UmbServerModelValidatorContext(this); #validationRepository?: UmbDocumentValidationRepository; - public readOnlyState = new UmbReadOnlyVariantStateManager(this); + public readonly readOnlyState = new UmbReadOnlyVariantStateManager(this); public isLoaded() { return this.#getDataPromise; @@ -124,9 +124,6 @@ export class UmbDocumentWorkspaceContext readonly variants = this.#data.createObservablePartOfCurrent((data) => data?.variants ?? []); - readonly urls = this.#data.createObservablePartOfCurrent((data) => data?.urls || []); - readonly templateId = this.#data.createObservablePartOfCurrent((data) => data?.template?.unique || null); - readonly structure = new UmbContentTypeStructureManager(this, new UmbDocumentTypeDetailRepository(this)); readonly variesByCulture = this.structure.ownerContentTypeObservablePart((x) => x?.variesByCulture); readonly variesBySegment = this.structure.ownerContentTypeObservablePart((x) => x?.variesBySegment); @@ -137,6 +134,9 @@ export class UmbDocumentWorkspaceContext #variesByCulture?: boolean; #variesBySegment?: boolean; + readonly urls = this.#data.createObservablePartOfCurrent((data) => data?.urls || []); + readonly templateId = this.#data.createObservablePartOfCurrent((data) => data?.template?.unique || null); + readonly #dataTypeItemManager = new UmbDataTypeItemRepositoryManager(this); #dataTypeSchemaAliasMap = new Map(); @@ -518,7 +518,6 @@ export class UmbDocumentWorkspaceContext const { data, error } = await this.repository.create(saveData, parent.unique); if (!data || error) { - console.error('Error creating document', error); throw new Error('Error creating document'); } @@ -547,7 +546,6 @@ export class UmbDocumentWorkspaceContext // Save: const { data, error } = await this.repository.save(saveData); if (!data || error) { - console.error('Error saving document', error); throw new Error('Error saving document'); } diff --git a/src/packages/members/member/index.ts b/src/packages/members/member/index.ts index e5bebd5e5d..d94f511fa1 100644 --- a/src/packages/members/member/index.ts +++ b/src/packages/members/member/index.ts @@ -1,6 +1,8 @@ import './components/index.js'; -export * from './entity.js'; +export * from './collection/index.js'; export * from './components/index.js'; +export * from './entity.js'; +export * from './paths.js'; export * from './repository/index.js'; -export * from './collection/index.js'; +export type * from './types.js'; diff --git a/src/packages/members/member/utils.ts b/src/packages/members/member/utils.ts new file mode 100644 index 0000000000..9cc33707b6 --- /dev/null +++ b/src/packages/members/member/utils.ts @@ -0,0 +1,16 @@ +import type { UmbMemberVariantOptionModel } from './types.js'; + +type VariantType = UmbMemberVariantOptionModel; + +export const sortVariants = (a: VariantType, b: VariantType) => { + const compareDefault = (a: VariantType, b: VariantType) => + (a.language?.isDefault ? -1 : 1) - (b.language?.isDefault ? -1 : 1); + + // Make sure mandatory variants goes on top. + const compareMandatory = (a: VariantType, b: VariantType) => + (a.language?.isMandatory ? -1 : 1) - (b.language?.isMandatory ? -1 : 1); + + const compareName = (a: VariantType, b: VariantType) => a.variant?.name.localeCompare(b.variant?.name || '') || 99; + + return compareDefault(a, b) || compareMandatory(a, b) || compareName(a, b); +}; diff --git a/src/packages/members/member/workspace/member/member-workspace.context.ts b/src/packages/members/member/workspace/member/member-workspace.context.ts index effe6818f4..d611adab9d 100644 --- a/src/packages/members/member/workspace/member/member-workspace.context.ts +++ b/src/packages/members/member/workspace/member/member-workspace.context.ts @@ -6,6 +6,9 @@ import type { UmbMemberVariantOptionModel, } from '../../types.js'; import { UmbMemberPropertyDatasetContext } from '../../property-dataset-context/member-property-dataset-context.js'; +import { UMB_MEMBER_ENTITY_TYPE, UMB_MEMBER_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { sortVariants } from '../../utils.js'; +import { UMB_MEMBER_MANAGEMENT_SECTION_PATH } from '../../../section/index.js'; import { UMB_MEMBER_WORKSPACE_ALIAS } from './manifests.js'; import { UmbMemberWorkspaceEditorElement } from './member-workspace-editor.element.js'; import { UMB_MEMBER_DETAIL_MODEL_VARIANT_SCAFFOLD } from './constants.js'; @@ -13,10 +16,16 @@ import { UmbMemberTypeDetailRepository, type UmbMemberTypeDetailModel } from '@u import { UmbSubmittableWorkspaceContextBase, UmbWorkspaceIsNewRedirectController, + UmbWorkspaceIsNewRedirectControllerAlias, UmbWorkspaceSplitViewManager, } from '@umbraco-cms/backoffice/workspace'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -import { UmbArrayState, appendToFrozenArray, mergeObservables } from '@umbraco-cms/backoffice/observable-api'; +import { + UmbArrayState, + UmbObjectState, + appendToFrozenArray, + mergeObservables, +} from '@umbraco-cms/backoffice/observable-api'; import { UmbContentTypeStructureManager } from '@umbraco-cms/backoffice/content-type'; import { UMB_INVARIANT_CULTURE, UmbVariantId } from '@umbraco-cms/backoffice/variant'; import type { UmbLanguageDetailModel } from '@umbraco-cms/backoffice/language'; @@ -25,6 +34,13 @@ import type { UmbDataSourceResponse } from '@umbraco-cms/backoffice/repository'; import { UmbContentWorkspaceDataManager, type UmbContentWorkspaceContext } from '@umbraco-cms/backoffice/content'; import { UmbReadOnlyVariantStateManager } from '@umbraco-cms/backoffice/utils'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; +import { map } from '@umbraco-cms/backoffice/external/rxjs'; +import { UmbEntityContext, type UmbEntityModel } from '@umbraco-cms/backoffice/entity'; +import { + UmbRequestReloadChildrenOfEntityEvent, + UmbRequestReloadStructureForEntityEvent, +} from '@umbraco-cms/backoffice/entity-action'; +import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; type EntityModel = UmbMemberDetailModel; export class UmbMemberWorkspaceContext @@ -35,6 +51,10 @@ export class UmbMemberWorkspaceContext public readonly repository = new UmbMemberDetailRepository(this); + #parent = new UmbObjectState({ entityType: UMB_MEMBER_ROOT_ENTITY_TYPE, unique: null }); + readonly parentUnique = this.#parent.asObservablePart((parent) => (parent ? parent.unique : undefined)); + readonly parentEntityType = this.#parent.asObservablePart((parent) => (parent ? parent.entityType : undefined)); + readonly #data = new UmbContentWorkspaceDataManager(this, UMB_MEMBER_DETAIL_MODEL_VARIANT_SCAFFOLD); #getDataPromise?: Promise>; @@ -43,7 +63,7 @@ export class UmbMemberWorkspaceContext #languages = new UmbArrayState([], (x) => x.unique); public readonly languages = this.#languages.asObservable(); - readOnlyState = new UmbReadOnlyVariantStateManager(this); + public readonly readOnlyState = new UmbReadOnlyVariantStateManager(this); public isLoaded() { return this.#getDataPromise; @@ -54,7 +74,8 @@ export class UmbMemberWorkspaceContext readonly createDate = this.#data.createObservablePartOfCurrent((data) => data?.variants[0].createDate); readonly updateDate = this.#data.createObservablePartOfCurrent((data) => data?.variants[0].updateDate); readonly contentTypeUnique = this.#data.createObservablePartOfCurrent((data) => data?.memberType.unique); - readonly kind = this.#data.createObservablePartOfCurrent((data) => data?.kind); + + readonly variants = this.#data.createObservablePartOfCurrent((data) => data?.variants ?? []); readonly structure = new UmbContentTypeStructureManager(this, new UmbMemberTypeDetailRepository(this)); readonly variesByCulture = this.structure.ownerContentTypeObservablePart((x) => x?.variesByCulture); @@ -66,7 +87,7 @@ export class UmbMemberWorkspaceContext #variesByCulture?: boolean; #variesBySegment?: boolean; - readonly variants = this.#data.createObservablePartOfCurrent((data) => data?.variants ?? []); + readonly kind = this.#data.createObservablePartOfCurrent((data) => data?.kind); readonly #dataTypeItemManager = new UmbDataTypeItemRepositoryManager(this); #dataTypeSchemaAliasMap = new Map(); @@ -102,35 +123,51 @@ export class UmbMemberWorkspaceContext } return [] as Array; }, - ); + ).pipe(map((results) => results.sort(sortVariants))); + + // TODO: this should be set up for all entity workspace contexts in a base class + #entityContext = new UmbEntityContext(this); constructor(host: UmbControllerHost) { super(host, UMB_MEMBER_WORKSPACE_ALIAS); - this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique)); - - this.observe(this.variesByCulture, (varies) => { - this.#data.setVariesByCulture(varies); - this.#variesByCulture = varies; - }); - this.observe(this.variesBySegment, (varies) => { - this.#data.setVariesBySegment(varies); - this.#variesBySegment = varies; - }); - this.observe(this.varies, (varies) => (this.#varies = varies)); - - this.observe(this.structure.contentTypeDataTypeUniques, (dataTypeUniques: Array) => { - this.#dataTypeItemManager.setUniques(dataTypeUniques); - }); - - this.observe(this.#dataTypeItemManager.items, (dataTypes) => { - // Make a map of the data type unique and editorAlias: - this.#dataTypeSchemaAliasMap = new Map( - dataTypes.map((dataType) => { - return [dataType.unique, dataType.propertyEditorSchemaAlias]; - }), - ); - }); + this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique), null); + this.observe(this.varies, (varies) => (this.#varies = varies), null); + this.observe( + this.variesByCulture, + (varies) => { + this.#data.setVariesByCulture(varies); + this.#variesByCulture = varies; + }, + null, + ); + this.observe( + this.variesBySegment, + (varies) => { + this.#data.setVariesBySegment(varies); + this.#variesBySegment = varies; + }, + null, + ); + this.observe( + this.structure.contentTypeDataTypeUniques, + (dataTypeUniques: Array) => { + this.#dataTypeItemManager.setUniques(dataTypeUniques); + }, + null, + ); + this.observe( + this.#dataTypeItemManager.items, + (dataTypes) => { + // Make a map of the data type unique and editorAlias: + this.#dataTypeSchemaAliasMap = new Map( + dataTypes.map((dataType) => { + return [dataType.unique, dataType.propertyEditorSchemaAlias]; + }), + ); + }, + null, + ); this.loadLanguages(); this.routes.setRoutes([ @@ -152,6 +189,7 @@ export class UmbMemberWorkspaceContext path: 'edit/:unique', component: () => new UmbMemberWorkspaceEditorElement(), setup: (_component, info) => { + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); const unique = info.match.params.unique; this.load(unique); }, @@ -161,8 +199,7 @@ export class UmbMemberWorkspaceContext override resetState() { super.resetState(); - this.#data.setPersisted(undefined); - this.#data.setCurrent(undefined); + this.#data.clear(); } async loadLanguages() { @@ -178,6 +215,8 @@ export class UmbMemberWorkspaceContext const { data, asObservable } = (await this.#getDataPromise) as GetDataType; if (data) { + this.#entityContext.setEntityType(UMB_MEMBER_ENTITY_TYPE); + this.#entityContext.setUnique(unique); this.setIsNew(false); this.#data.setPersisted(data); this.#data.setCurrent(data); @@ -189,7 +228,7 @@ export class UmbMemberWorkspaceContext #onMemberStoreChange(member: EntityModel | undefined) { if (!member) { //TODO: This solution is alright for now. But reconsider when we introduce signal-r - history.pushState(null, '', 'section/member-management'); + history.pushState(null, '', UMB_MEMBER_MANAGEMENT_SECTION_PATH); } } @@ -203,6 +242,8 @@ export class UmbMemberWorkspaceContext const { data } = await this.#getDataPromise; if (!data) return undefined; + this.#entityContext.setEntityType(UMB_MEMBER_ENTITY_TYPE); + this.#entityContext.setUnique(data.unique); this.setIsNew(true); this.#data.setPersisted(undefined); this.#data.setCurrent(data); @@ -214,11 +255,11 @@ export class UmbMemberWorkspaceContext } getUnique() { - return this.getData()?.unique || ''; + return this.getData()?.unique; } getEntityType() { - return 'member'; + return UMB_MEMBER_ENTITY_TYPE; } getContentTypeId() { @@ -336,35 +377,56 @@ export class UmbMemberWorkspaceContext this.#data.finishPropertyValueChange(); }; - async submit() { + async #handleSave() { const current = this.#data.getCurrent(); if (!current) throw new Error('Data is missing'); if (!current.unique) throw new Error('Unique is missing'); - let newData = undefined; - if (this.getIsNew()) { - const { data } = await this.repository.create(current); - if (!data) { + // Create: + const parent = this.#parent.getValue(); + if (!parent) throw new Error('Parent is not set'); + + const { data, error } = await this.repository.create(current); + if (!data || error) { throw new Error('Could not create member.'); } - newData = data; + this.setIsNew(false); + this.#data.setPersisted(data); + // TODO: Missing variant data filtering. + this.#data.setCurrent(data); + + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const event = new UmbRequestReloadChildrenOfEntityEvent({ + entityType: parent.entityType, + unique: parent.unique, + }); + eventContext.dispatchEvent(event); } else { - const { data } = await this.repository.save(current); - if (!data) { - throw new Error('Could not create member.'); + // Save: + const { data, error } = await this.repository.save(current); + if (!data || error) { + throw new Error('Could not update member.'); } - newData = data; - } + this.#data.setPersisted(data); + // TODO: Missing variant data filtering. + this.#data.setCurrent(data); + + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const event = new UmbRequestReloadStructureForEntityEvent({ + entityType: this.getEntityType(), + unique: this.getUnique()!, + }); - if (newData) { - this.#data.setPersisted(newData); - // TODO: Only update the variants that was chosen to be saved: - //this.#data.setCurrentData(newData); + eventContext.dispatchEvent(event); } } + async submit() { + return this.#handleSave(); + } + async delete() { const id = this.getUnique(); if (id) { diff --git a/src/packages/members/section/index.ts b/src/packages/members/section/index.ts index 4f07201dcf..14b140114e 100644 --- a/src/packages/members/section/index.ts +++ b/src/packages/members/section/index.ts @@ -1 +1,2 @@ export * from './constants.js'; +export * from './paths.js'; From 0d02dc7ac2751f360dffbd25d2b04edf7d89566c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 11:21:09 +0200 Subject: [PATCH 5/7] set varies on data --- .../workspace/document-workspace.context.ts | 1 - .../workspace/media-workspace.context.ts | 68 ++++++++++++------- .../member/member-workspace.context.ts | 9 ++- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/packages/documents/documents/workspace/document-workspace.context.ts index 3dca29a82e..a082d780ae 100644 --- a/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -191,7 +191,6 @@ export class UmbDocumentWorkspaceContext this.varies, (varies) => { this.#data.setVaries(varies); - this.#varies = varies; }, null, diff --git a/src/packages/media/media/workspace/media-workspace.context.ts b/src/packages/media/media/workspace/media-workspace.context.ts index 1d9131eafb..1818c7b126 100644 --- a/src/packages/media/media/workspace/media-workspace.context.ts +++ b/src/packages/media/media/workspace/media-workspace.context.ts @@ -133,30 +133,50 @@ export class UmbMediaWorkspaceContext constructor(host: UmbControllerHost) { super(host, 'Umb.Workspace.Media'); - this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique)); - - this.observe(this.variesByCulture, (varies) => { - this.#data.setVariesByCulture(varies); - this.#variesByCulture = varies; - }); - this.observe(this.variesBySegment, (varies) => { - this.#data.setVariesBySegment(varies); - this.#variesBySegment = varies; - }); - this.observe(this.varies, (varies) => (this.#varies = varies)); - - this.observe(this.structure.contentTypeDataTypeUniques, (dataTypeUniques: Array) => { - this.#dataTypeItemManager.setUniques(dataTypeUniques); - }); - - this.observe(this.#dataTypeItemManager.items, (dataTypes) => { - // Make a map of the data type unique and editorAlias: - this.#dataTypeSchemaAliasMap = new Map( - dataTypes.map((dataType) => { - return [dataType.unique, dataType.propertyEditorSchemaAlias]; - }), - ); - }); + this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique), null); + this.observe( + this.varies, + (varies) => { + this.#data.setVaries(varies); + this.#varies = varies; + }, + null, + ); + this.observe( + this.variesByCulture, + (varies) => { + this.#data.setVariesByCulture(varies); + this.#variesByCulture = varies; + }, + null, + ); + this.observe( + this.variesBySegment, + (varies) => { + this.#data.setVariesBySegment(varies); + this.#variesBySegment = varies; + }, + null, + ); + this.observe( + this.structure.contentTypeDataTypeUniques, + (dataTypeUniques: Array) => { + this.#dataTypeItemManager.setUniques(dataTypeUniques); + }, + null, + ); + this.observe( + this.#dataTypeItemManager.items, + (dataTypes) => { + // Make a map of the data type unique and editorAlias: + this.#dataTypeSchemaAliasMap = new Map( + dataTypes.map((dataType) => { + return [dataType.unique, dataType.propertyEditorSchemaAlias]; + }), + ); + }, + null, + ); this.loadLanguages(); this.routes.setRoutes([ diff --git a/src/packages/members/member/workspace/member/member-workspace.context.ts b/src/packages/members/member/workspace/member/member-workspace.context.ts index d611adab9d..12ecd26c37 100644 --- a/src/packages/members/member/workspace/member/member-workspace.context.ts +++ b/src/packages/members/member/workspace/member/member-workspace.context.ts @@ -132,7 +132,14 @@ export class UmbMemberWorkspaceContext super(host, UMB_MEMBER_WORKSPACE_ALIAS); this.observe(this.contentTypeUnique, (unique) => this.structure.loadType(unique), null); - this.observe(this.varies, (varies) => (this.#varies = varies), null); + this.observe( + this.varies, + (varies) => { + this.#data.setVaries(varies); + this.#varies = varies; + }, + null, + ); this.observe( this.variesByCulture, (varies) => { From abc5b0d763d1290953b6561927497164c4025ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 11:30:45 +0200 Subject: [PATCH 6/7] align media --- src/packages/media/media/paths.ts | 4 +- .../workspace/media-workspace.context.ts | 155 +++++------------- 2 files changed, 47 insertions(+), 112 deletions(-) diff --git a/src/packages/media/media/paths.ts b/src/packages/media/media/paths.ts index f1e66dce97..82939b2b4d 100644 --- a/src/packages/media/media/paths.ts +++ b/src/packages/media/media/paths.ts @@ -11,7 +11,7 @@ export const UMB_MEDIA_WORKSPACE_PATH = UMB_WORKSPACE_PATH_PATTERN.generateAbsol export const UMB_CREATE_MEDIA_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ parentEntityType: UmbMediaEntityTypeUnion; parentUnique?: string | null; - documentTypeUnique: string; -}>('create/parent/:parentEntityType/:parentUnique/:documentTypeUnique', UMB_MEDIA_WORKSPACE_PATH); + mediaTypeUnique: string; +}>('create/parent/:parentEntityType/:parentUnique/:mediaTypeUnique', UMB_MEDIA_WORKSPACE_PATH); export const UMB_EDIT_MEDIA_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ unique: string }>('edit/:unique'); diff --git a/src/packages/media/media/workspace/media-workspace.context.ts b/src/packages/media/media/workspace/media-workspace.context.ts index 1818c7b126..dab4a14ab6 100644 --- a/src/packages/media/media/workspace/media-workspace.context.ts +++ b/src/packages/media/media/workspace/media-workspace.context.ts @@ -8,12 +8,15 @@ import type { UmbMediaVariantModel, UmbMediaVariantOptionModel, } from '../types.js'; +import { UMB_CREATE_MEDIA_WORKSPACE_PATH_PATTERN, UMB_EDIT_MEDIA_WORKSPACE_PATH_PATTERN } from '../paths.js'; +import { UMB_MEDIA_SECTION_PATH } from '../../media-section/paths.js'; import { UMB_MEMBER_DETAIL_MODEL_VARIANT_SCAFFOLD } from './constants.js'; import { UMB_INVARIANT_CULTURE, UmbVariantId } from '@umbraco-cms/backoffice/variant'; import { UmbContentTypeStructureManager } from '@umbraco-cms/backoffice/content-type'; import { UmbSubmittableWorkspaceContextBase, UmbWorkspaceIsNewRedirectController, + UmbWorkspaceIsNewRedirectControllerAlias, UmbWorkspaceSplitViewManager, } from '@umbraco-cms/backoffice/workspace'; import { @@ -39,6 +42,7 @@ import { UmbEntityContext } from '@umbraco-cms/backoffice/entity'; import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin'; import { UmbReadOnlyVariantStateManager } from '@umbraco-cms/backoffice/utils'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; +import { UMB_MEDIA_COLLECTION_ALIAS } from '../collection/index.js'; type ContentModel = UmbMediaDetailModel; type ContentTypeModel = UmbMediaTypeDetailModel; @@ -181,7 +185,7 @@ export class UmbMediaWorkspaceContext this.routes.setRoutes([ { - path: 'create/parent/:entityType/:parentUnique/:mediaTypeUnique', + path: UMB_CREATE_MEDIA_WORKSPACE_PATH_PATTERN.toString(), component: () => import('./media-workspace-editor.element.js'), setup: async (_component, info) => { const parentEntityType = info.match.params.entityType; @@ -197,9 +201,10 @@ export class UmbMediaWorkspaceContext }, }, { - path: 'edit/:unique', + path: UMB_EDIT_MEDIA_WORKSPACE_PATH_PATTERN.toString(), component: () => import('./media-workspace-editor.element.js'), setup: (_component, info) => { + this.removeUmbControllerByAlias(UmbWorkspaceIsNewRedirectControllerAlias); const unique = info.match.params.unique; this.load(unique); }, @@ -209,8 +214,7 @@ export class UmbMediaWorkspaceContext override resetState() { super.resetState(); - this.#data.setPersisted(undefined); - this.#data.setCurrent(undefined); + this.#data.clear(); } async loadLanguages() { @@ -240,7 +244,7 @@ export class UmbMediaWorkspaceContext #onStoreChange(entity: ContentModel | undefined) { if (!entity) { //TODO: This solution is alright for now. But reconsider when we introduce signal-r - history.pushState(null, '', 'section/media'); + history.pushState(null, '', UMB_MEDIA_SECTION_PATH); } } @@ -260,7 +264,7 @@ export class UmbMediaWorkspaceContext } getCollectionAlias() { - return 'Umb.Collection.Media'; + return UMB_MEDIA_COLLECTION_ALIAS; } getData() { @@ -308,7 +312,7 @@ export class UmbMediaWorkspaceContext } setName(name: string, variantId?: UmbVariantId) { - this.#updateVariantData(variantId ?? UmbVariantId.CreateInvariant(), { name }); + this.#data.updateVariantData(variantId ?? UmbVariantId.CreateInvariant(), { name }); } name(variantId?: UmbVariantId) { @@ -330,22 +334,22 @@ export class UmbMediaWorkspaceContext async propertyValueByAlias(propertyAlias: string, variantId?: UmbVariantId) { return this.#data.createObservablePartOfCurrent( (data) => - data?.values?.find((x) => x?.alias === propertyAlias && (variantId ? variantId.compare(x as any) : true)) + data?.values?.find((x) => x?.alias === propertyAlias && (variantId ? variantId.compare(x) : true)) ?.value as PropertyValueType, ); } /** * Get the current value of the property with the given alias and variantId. - * @param alias - * @param variantId + * @param {string} alias + * @param {UmbVariantId} variantId * @returns The value or undefined if not set or found. */ getPropertyValue(alias: string, variantId?: UmbVariantId) { const currentData = this.#data.getCurrent(); if (currentData) { const newDataSet = currentData.values?.find( - (x) => x.alias === alias && (variantId ? variantId.compare(x as any) : true), + (x) => x.alias === alias && (variantId ? variantId.compare(x) : true), ); return newDataSet?.value as ReturnType; } @@ -390,108 +394,47 @@ export class UmbMediaWorkspaceContext this.#data.finishPropertyValueChange(); }; - /* #calculateChangedVariants() { - const persisted = this.#persistedData.getValue(); - const current = this.#data.current.getValue(); - if (!current) throw new Error('Current data is missing'); - - const changedVariants = current?.variants.map((variant) => { - const persistedVariant = persisted?.variants.find((x) => UmbVariantId.Create(variant).compare(x)); - return { - culture: variant.culture, - segment: variant.segment, - equal: persistedVariant ? jsonStringComparison(variant, persistedVariant) : false, - }; - }); - - const changedProperties = current?.values.map((value) => { - const persistedValues = persisted?.values.find((x) => UmbVariantId.Create(value).compare(x)); - return { - culture: value.culture, - segment: value.segment, - equal: persistedValues ? jsonStringComparison(value, persistedValues) : false, - }; - }); - - // calculate the variantIds of those who either have a change in properties or in variants: - return ( - changedVariants - ?.concat(changedProperties ?? []) - .filter((x) => x.equal === false) - .map((x) => new UmbVariantId(x.culture, x.segment)) ?? [] - ); - } */ - - #updateVariantData(variantId: UmbVariantId, update?: Partial) { - const currentData = this.getData(); - if (!currentData) throw new Error('Data is missing'); - if (this.#varies === true) { - // If variant Id is invariant, we don't to have the variant appended to our data. - if (variantId.isInvariant()) return; - const variant = currentData.variants.find((x) => variantId.compare(x)); - const newVariants = appendToFrozenArray( - currentData.variants, - { - name: '', - createDate: null, - updateDate: null, - ...variantId.toObject(), - ...variant, - ...update, - }, - (x) => variantId.compare(x), - ); - this.#data.updateCurrent({ variants: newVariants }); - } else if (this.#varies === false) { - // TODO: Beware about segments, in this case we need to also consider segments, if its allowed to vary by segments. - const invariantVariantId = UmbVariantId.CreateInvariant(); - const variant = currentData.variants.find((x) => invariantVariantId.compare(x)); - // Cause we are invariant, we will just overwrite all variants with this one: - const newVariants = [ - { - name: '', - createDate: null, - updateDate: null, - ...invariantVariantId.toObject(), - ...variant, - ...update, - }, - ]; - this.#data.updateCurrent({ variants: newVariants }); - } else { - throw new Error('Varies by culture is missing'); - } - } - - async #createOrSave() { - const data = this.#data.getCurrent(); - if (!data?.unique) throw new Error('Unique is missing'); + async #handleSave() { + const saveData = this.#data.getCurrent(); + if (!saveData?.unique) throw new Error('Unique is missing'); if (this.getIsNew()) { const parent = this.#parent.getValue(); if (!parent) throw new Error('Parent is not set'); - if ((await this.repository.create(data, parent.unique)).data !== undefined) { - this.setIsNew(false); - - // TODO: this might not be the right place to alert the tree, but it works for now - const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); - const event = new UmbRequestReloadChildrenOfEntityEvent({ - entityType: parent.entityType, - unique: parent.unique, - }); - eventContext.dispatchEvent(event); + const { data, error } = await this.repository.create(saveData, parent.unique); + if (!data || error) { + throw new Error('Error creating document'); } + + this.setIsNew(false); + this.#data.setPersisted(data); + this.#data.setCurrent(data); + + // TODO: this might not be the right place to alert the tree, but it works for now + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const event = new UmbRequestReloadChildrenOfEntityEvent({ + entityType: parent.entityType, + unique: parent.unique, + }); + eventContext.dispatchEvent(event); } else { - await this.repository.save(data); + // Save: + const { data, error } = await this.repository.save(saveData); + if (!data || error) { + throw new Error('Error saving document'); + } - const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + this.#data.setPersisted(data); + this.#data.setCurrent(data); + + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); const event = new UmbRequestReloadStructureForEntityEvent({ unique: this.getUnique()!, entityType: this.getEntityType(), }); - actionEventContext.dispatchEvent(event); + eventContext.dispatchEvent(event); } } @@ -500,8 +443,7 @@ export class UmbMediaWorkspaceContext if (!data) { throw new Error('Data is missing'); } - await this.#createOrSave(); - this.setIsNew(false); + await this.#handleSave(); } async delete() { @@ -511,14 +453,6 @@ export class UmbMediaWorkspaceContext } } - /* - concept notes: - - public saveAndPreview() { - - } - */ - public createPropertyDatasetContext( host: UmbControllerHost, variantId: UmbVariantId, @@ -529,6 +463,7 @@ export class UmbMediaWorkspaceContext public override destroy(): void { this.#data.destroy(); this.structure.destroy(); + this.#languageRepository.destroy(); super.destroy(); } } From feb741d8fd1b8ae501c15df8e6ea3e0dfbc9683a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2024 11:46:47 +0200 Subject: [PATCH 7/7] lint fix --- src/assets/lang/en.ts | 2 +- src/mocks/handlers/document/tree.handlers.ts | 2 +- ...operty-editor-ui-block-grid-areas-config.element.ts | 6 ++++-- ...roperty-editor-ui-block-grid-column-span.element.ts | 4 ++-- .../property-editor-ui-block-grid.element.ts | 6 ++++-- ...editor-ui-block-grid-group-configuration.element.ts | 4 ++-- ...y-editor-ui-block-grid-layout-stylesheet.element.ts | 4 ++-- ...-editor-ui-block-grid-type-configuration.element.ts | 10 +++++----- .../property-editor-ui-block-list.element.ts | 6 ++++-- ...-editor-ui-block-list-type-configuration.element.ts | 4 ++-- .../property-editor-ui-code-editor.element.ts | 6 ++++-- .../core/property/property/property.context.ts | 6 ++++-- .../core/property/property/property.element.ts | 2 +- .../dictionary/entity-action/create/create.action.ts | 2 +- .../workspace/document-blueprint-workspace.context.ts | 3 ++- .../property-editor-ui-document-type-picker.element.ts | 6 ++++-- .../property-editor-ui-document-picker.element.ts | 6 ++++-- .../property-editor-ui-markdown-editor.element.ts | 6 ++++-- .../property-editor-ui-media-type-picker.element.ts | 6 ++++-- .../action/create-media-collection-action.element.ts | 2 +- .../input-upload-field/input-upload-field.element.ts | 2 +- .../property-editor-ui-image-cropper.element.ts | 6 +++--- .../property-editor-ui-media-entity-picker.element.ts | 6 ++++-- .../property-editor-ui-media-picker.element.ts | 6 ++++-- .../property-editor-ui-upload-field.element.ts | 4 ++-- .../media/media/workspace/media-workspace.context.ts | 2 +- .../property-editor-ui-member-group-picker.element.ts | 6 ++++-- .../property-editor-ui-member-picker.element.ts | 6 ++++-- .../property-editor-ui-multi-url-picker.element.ts | 6 ++++-- .../property-editor-ui-checkbox-list.element.ts | 6 ++++-- .../bulk-action-permissions/permissions.element.ts | 6 ++++-- .../config/column/column-configuration.element.ts | 6 ++++-- .../config/layout/layout-configuration.element.ts | 6 ++++-- .../collection/config/order-by/order-by.element.ts | 6 ++++-- .../property-editor-ui-collection.element.ts | 6 ++++-- .../property-editor-ui-color-picker.element.ts | 6 ++++-- ...property-editor-ui-color-swatches-editor.element.ts | 6 ++++-- ...property-editor-ui-content-picker-source.element.ts | 4 ++-- .../property-editor-ui-content-picker.element.ts | 6 ++++-- .../property-editor-ui-date-picker.element.ts | 6 ++++-- .../dropdown/property-editor-ui-dropdown.element.ts | 6 ++++-- .../property-editor-ui-eye-dropper.element.ts | 6 ++++-- .../label/property-editor-ui-label.element.ts | 6 ++++-- .../property-editor-ui-multiple-text-string.element.ts | 6 ++++-- .../property-editor-ui-number-range.element.ts | 6 ++++-- .../number/property-editor-ui-number.element.ts | 6 ++++-- .../property-editor-ui-order-direction.element.ts | 6 ++++-- .../property-editor-ui-overlay-size.element.ts | 4 ++-- .../property-editor-ui-radio-button-list.element.ts | 6 ++++-- .../select/property-editor-ui-select.element.ts | 6 ++++-- .../slider/property-editor-ui-slider.element.ts | 6 ++++-- .../text-box/property-editor-ui-text-box.element.ts | 4 ++-- .../textarea/property-editor-ui-textarea.element.ts | 6 ++++-- .../toggle/property-editor-ui-toggle.element.ts | 6 ++++-- .../property-editor-ui-value-type.element.ts | 4 ++-- .../input-tiny-mce/input-tiny-mce.sanitizer.ts | 1 - .../rte/tiptap/extensions/toolbar/link.extension.ts | 4 ++++ .../property-editor-ui-static-file-picker.element.ts | 8 ++++---- .../tags/property-editor-ui-tags.element.ts | 2 +- .../property-editor-ui-user-picker.element.ts | 6 ++++-- 60 files changed, 192 insertions(+), 114 deletions(-) diff --git a/src/assets/lang/en.ts b/src/assets/lang/en.ts index 8f9dd5999a..88e2129900 100644 --- a/src/assets/lang/en.ts +++ b/src/assets/lang/en.ts @@ -2633,5 +2633,5 @@ export default { extGroup_interactive: 'Interactive elements', extGroup_media: 'Embeds and media', extGroup_structure: 'Content structure', - } + }, } as UmbLocalizationDictionary; diff --git a/src/mocks/handlers/document/tree.handlers.ts b/src/mocks/handlers/document/tree.handlers.ts index df3400b392..518e475b00 100644 --- a/src/mocks/handlers/document/tree.handlers.ts +++ b/src/mocks/handlers/document/tree.handlers.ts @@ -1,7 +1,7 @@ const { rest } = window.MockServiceWorker; import { umbDocumentMockDb } from '../../data/document/document.db.js'; -import type { GetTreeDocumentAncestorsResponse } from '@umbraco-cms/backoffice/external/backend-api'; import { UMB_SLUG } from './slug.js'; +import type { GetTreeDocumentAncestorsResponse } from '@umbraco-cms/backoffice/external/backend-api'; import { umbracoPath } from '@umbraco-cms/backoffice/utils'; export const treeHandlers = [ diff --git a/src/packages/block/block-grid/property-editors/block-grid-areas-config/property-editor-ui-block-grid-areas-config.element.ts b/src/packages/block/block-grid/property-editors/block-grid-areas-config/property-editor-ui-block-grid-areas-config.element.ts index 68e14f67fe..8e173fd0d8 100644 --- a/src/packages/block/block-grid/property-editors/block-grid-areas-config/property-editor-ui-block-grid-areas-config.element.ts +++ b/src/packages/block/block-grid/property-editors/block-grid-areas-config/property-editor-ui-block-grid-areas-config.element.ts @@ -4,9 +4,11 @@ import type { UmbBlockGridTypeAreaType } from '../../index.js'; import { UmbBlockGridAreaTypeEntriesContext } from './block-grid-area-type-entries.context.js'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { html, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorUiElement, + UmbPropertyEditorConfigCollection, +} from '@umbraco-cms/backoffice/property-editor'; import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; import { incrementString } from '@umbraco-cms/backoffice/utils'; diff --git a/src/packages/block/block-grid/property-editors/block-grid-column-span/property-editor-ui-block-grid-column-span.element.ts b/src/packages/block/block-grid/property-editors/block-grid-column-span/property-editor-ui-block-grid-column-span.element.ts index 4e34f2ee4b..d604f01593 100644 --- a/src/packages/block/block-grid/property-editors/block-grid-column-span/property-editor-ui-block-grid-column-span.element.ts +++ b/src/packages/block/block-grid/property-editors/block-grid-column-span/property-editor-ui-block-grid-column-span.element.ts @@ -1,11 +1,11 @@ import type { UmbBlockGridTypeColumnSpanOption } from '../../types.js'; import { html, customElement, property, css, state, repeat } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; @customElement('umb-property-editor-ui-block-grid-column-span') diff --git a/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts b/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts index 61807c1e23..81f385df53 100644 --- a/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts +++ b/src/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.ts @@ -11,8 +11,10 @@ import { ref, } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorUiElement, + UmbPropertyEditorConfigCollection, +} from '@umbraco-cms/backoffice/property-editor'; import '../../components/block-grid-entries/index.js'; import { observeMultiple } from '@umbraco-cms/backoffice/observable-api'; import { UMB_PROPERTY_CONTEXT, UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property'; diff --git a/src/packages/block/block-grid/property-editors/block-grid-group-configuration/property-editor-ui-block-grid-group-configuration.element.ts b/src/packages/block/block-grid/property-editors/block-grid-group-configuration/property-editor-ui-block-grid-group-configuration.element.ts index f5677cd80e..3dac2a5abf 100644 --- a/src/packages/block/block-grid/property-editors/block-grid-group-configuration/property-editor-ui-block-grid-group-configuration.element.ts +++ b/src/packages/block/block-grid/property-editors/block-grid-group-configuration/property-editor-ui-block-grid-group-configuration.element.ts @@ -1,10 +1,10 @@ import { html, customElement, property, css } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbId } from '@umbraco-cms/backoffice/id'; import type { UmbBlockGridTypeGroupType } from '@umbraco-cms/backoffice/block-grid'; diff --git a/src/packages/block/block-grid/property-editors/block-grid-layout-stylesheet/property-editor-ui-block-grid-layout-stylesheet.element.ts b/src/packages/block/block-grid/property-editors/block-grid-layout-stylesheet/property-editor-ui-block-grid-layout-stylesheet.element.ts index 57833db447..f0f5785c66 100644 --- a/src/packages/block/block-grid/property-editors/block-grid-layout-stylesheet/property-editor-ui-block-grid-layout-stylesheet.element.ts +++ b/src/packages/block/block-grid/property-editors/block-grid-layout-stylesheet/property-editor-ui-block-grid-layout-stylesheet.element.ts @@ -4,12 +4,12 @@ import type { UmbInputStaticFileElement } from '@umbraco-cms/backoffice/static-f import '@umbraco-cms/backoffice/static-file'; import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbServerFilePathUniqueSerializer } from '@umbraco-cms/backoffice/server-file-system'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; diff --git a/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts b/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts index fc00255657..ae743a577d 100644 --- a/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts +++ b/src/packages/block/block-grid/property-editors/block-grid-type-configuration/property-editor-ui-block-grid-type-configuration.element.ts @@ -1,6 +1,10 @@ import type { UmbBlockTypeWithGroupKey, UmbInputBlockTypeElement } from '../../../block-type/index.js'; import '../../../block-type/components/input-block-type/index.js'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import { + type UmbPropertyEditorUiElement, + UmbPropertyValueChangeEvent, + type UmbPropertyEditorConfigCollection, +} from '@umbraco-cms/backoffice/property-editor'; import { html, customElement, @@ -11,10 +15,6 @@ import { css, ifDefined, } from '@umbraco-cms/backoffice/external/lit'; -import { - UmbPropertyValueChangeEvent, - type UmbPropertyEditorConfigCollection, -} from '@umbraco-cms/backoffice/property-editor'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { diff --git a/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts b/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts index e2a2285761..3accdffc9c 100644 --- a/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts +++ b/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts @@ -6,8 +6,10 @@ import { UMB_BLOCK_LIST_PROPERTY_EDITOR_SCHEMA_ALIAS } from './manifests.js'; import { UmbLitElement, umbDestroyOnDisconnect } from '@umbraco-cms/backoffice/lit-element'; import { html, customElement, property, state, repeat, css, nothing } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; import type { UmbModalRouteBuilder } from '@umbraco-cms/backoffice/router'; import type { UmbSorterConfig } from '@umbraco-cms/backoffice/sorter'; diff --git a/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts b/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts index ce16cd5e74..772b8068c2 100644 --- a/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts +++ b/src/packages/block/block-list/property-editors/block-list-type-configuration/property-editor-ui-block-list-type-configuration.element.ts @@ -1,12 +1,12 @@ import '../../../block-type/components/input-block-type/index.js'; import { UMB_BLOCK_LIST_TYPE } from '../../types.js'; import type { UmbBlockTypeBaseModel, UmbInputBlockTypeElement } from '@umbraco-cms/backoffice/block-type'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/workspace'; import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; diff --git a/src/packages/code-editor/property-editor/property-editor-ui-code-editor.element.ts b/src/packages/code-editor/property-editor/property-editor-ui-code-editor.element.ts index 6a4afac391..dcacb68fce 100644 --- a/src/packages/code-editor/property-editor/property-editor-ui-code-editor.element.ts +++ b/src/packages/code-editor/property-editor/property-editor-ui-code-editor.element.ts @@ -4,8 +4,10 @@ import { css, customElement, html, property, state, styleMap } from '@umbraco-cm import { UmbInputEvent } from '@umbraco-cms/backoffice/event'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import '../components/code-editor.element.js'; diff --git a/src/packages/core/property/property/property.context.ts b/src/packages/core/property/property/property.context.ts index 92b9bf1485..86e9e322eb 100644 --- a/src/packages/core/property/property/property.context.ts +++ b/src/packages/core/property/property/property.context.ts @@ -12,9 +12,11 @@ import { } from '@umbraco-cms/backoffice/observable-api'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import type { UmbVariantId } from '@umbraco-cms/backoffice/variant'; -import type { UmbPropertyEditorConfigProperty } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigProperty, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; import type { UmbPropertyTypeAppearanceModel, UmbPropertyTypeValidationModel, diff --git a/src/packages/core/property/property/property.element.ts b/src/packages/core/property/property/property.element.ts index fa7e2eec8c..7fbd02e7ba 100644 --- a/src/packages/core/property/property/property.element.ts +++ b/src/packages/core/property/property/property.element.ts @@ -9,8 +9,8 @@ import { UmbFormControlValidator, UmbObserveValidationStateController, } from '@umbraco-cms/backoffice/validation'; -import type { ManifestPropertyEditorUi } from '@umbraco-cms/backoffice/property-editor'; import type { + ManifestPropertyEditorUi, UmbPropertyEditorConfigCollection, UmbPropertyEditorConfig, } from '@umbraco-cms/backoffice/property-editor'; diff --git a/src/packages/dictionary/entity-action/create/create.action.ts b/src/packages/dictionary/entity-action/create/create.action.ts index 23e6bb385e..33a9a58041 100644 --- a/src/packages/dictionary/entity-action/create/create.action.ts +++ b/src/packages/dictionary/entity-action/create/create.action.ts @@ -1,5 +1,5 @@ -import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import { UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../workspace/index.js'; +import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; export class UmbCreateDictionaryEntityAction extends UmbEntityActionBase { override async execute() { diff --git a/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts b/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts index a54759a714..a3959a1686 100644 --- a/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts +++ b/src/packages/documents/document-blueprints/workspace/document-blueprint-workspace.context.ts @@ -44,7 +44,8 @@ import { UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN, } from '@umbraco-cms/backoffice/document'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; -import { Observable, map } from '@umbraco-cms/backoffice/external/rxjs'; +import type { Observable } from '@umbraco-cms/backoffice/external/rxjs'; +import { map } from '@umbraco-cms/backoffice/external/rxjs'; import { UmbEntityContext, type UmbEntityModel } from '@umbraco-cms/backoffice/entity'; import { UMB_SETTINGS_SECTION_PATH } from '@umbraco-cms/backoffice/settings'; diff --git a/src/packages/documents/document-types/property-editors/document-type-picker/property-editor-ui-document-type-picker.element.ts b/src/packages/documents/document-types/property-editors/document-type-picker/property-editor-ui-document-type-picker.element.ts index c2b16c58f6..22a637de14 100644 --- a/src/packages/documents/document-types/property-editors/document-type-picker/property-editor-ui-document-type-picker.element.ts +++ b/src/packages/documents/document-types/property-editors/document-type-picker/property-editor-ui-document-type-picker.element.ts @@ -3,8 +3,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; @customElement('umb-property-editor-ui-document-type-picker') export class UmbPropertyEditorUIDocumentTypePickerElement extends UmbLitElement implements UmbPropertyEditorUiElement { diff --git a/src/packages/documents/documents/property-editors/document-picker/property-editor-ui-document-picker.element.ts b/src/packages/documents/documents/property-editors/document-picker/property-editor-ui-document-picker.element.ts index 3d341f1380..07ac7c3c77 100644 --- a/src/packages/documents/documents/property-editors/document-picker/property-editor-ui-document-picker.element.ts +++ b/src/packages/documents/documents/property-editors/document-picker/property-editor-ui-document-picker.element.ts @@ -4,8 +4,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbTreeStartNode } from '@umbraco-cms/backoffice/tree'; @customElement('umb-property-editor-ui-document-picker') diff --git a/src/packages/markdown-editor/property-editors/markdown-editor/property-editor-ui-markdown-editor.element.ts b/src/packages/markdown-editor/property-editors/markdown-editor/property-editor-ui-markdown-editor.element.ts index 9bde1d15e3..3ef2eb563c 100644 --- a/src/packages/markdown-editor/property-editors/markdown-editor/property-editor-ui-markdown-editor.element.ts +++ b/src/packages/markdown-editor/property-editors/markdown-editor/property-editor-ui-markdown-editor.element.ts @@ -2,8 +2,10 @@ import type { UmbInputMarkdownElement } from '../../components/input-markdown-ed import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUIModalSidebarSize } from '@umbraco-cms/backoffice/external/uui'; import '../../components/input-markdown-editor/index.js'; diff --git a/src/packages/media/media-types/property-editors/media-type-picker/property-editor-ui-media-type-picker.element.ts b/src/packages/media/media-types/property-editors/media-type-picker/property-editor-ui-media-type-picker.element.ts index a2ca84c63c..9d327ba17e 100644 --- a/src/packages/media/media-types/property-editors/media-type-picker/property-editor-ui-media-type-picker.element.ts +++ b/src/packages/media/media-types/property-editors/media-type-picker/property-editor-ui-media-type-picker.element.ts @@ -3,8 +3,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; @customElement('umb-property-editor-ui-media-type-picker') export class UmbPropertyEditorUIMediaTypePickerElement extends UmbLitElement implements UmbPropertyEditorUiElement { diff --git a/src/packages/media/media/collection/action/create-media-collection-action.element.ts b/src/packages/media/media/collection/action/create-media-collection-action.element.ts index 5ae5b98f3a..0b3faf83a1 100644 --- a/src/packages/media/media/collection/action/create-media-collection-action.element.ts +++ b/src/packages/media/media/collection/action/create-media-collection-action.element.ts @@ -93,7 +93,7 @@ export class UmbCreateMediaCollectionActionElement extends UmbLitElement { UMB_CREATE_MEDIA_WORKSPACE_PATH_PATTERN.generateLocal({ parentEntityType: this._mediaUnique ? UMB_MEDIA_ENTITY_TYPE : UMB_MEDIA_ROOT_ENTITY_TYPE, parentUnique: this._mediaUnique ?? 'null', - documentTypeUnique: item.unique, + mediaTypeUnique: item.unique, }) ); } diff --git a/src/packages/media/media/components/input-upload-field/input-upload-field.element.ts b/src/packages/media/media/components/input-upload-field/input-upload-field.element.ts index f78b2a70cb..b3046d3deb 100644 --- a/src/packages/media/media/components/input-upload-field/input-upload-field.element.ts +++ b/src/packages/media/media/components/input-upload-field/input-upload-field.element.ts @@ -1,5 +1,6 @@ import type { MediaValueType } from '../../property-editors/upload-field/types.js'; import { getMimeTypeFromExtension } from './utils.js'; +import type { ManifestFileUploadPreview } from './file-upload-preview.extension.js'; import { TemporaryFileStatus, UmbTemporaryFileManager } from '@umbraco-cms/backoffice/temporary-file'; import type { UmbTemporaryFileModel } from '@umbraco-cms/backoffice/temporary-file'; import { UmbId } from '@umbraco-cms/backoffice/id'; @@ -19,7 +20,6 @@ import { UmbChangeEvent } from '@umbraco-cms/backoffice/event'; import { UmbExtensionsManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; -import type { ManifestFileUploadPreview } from './file-upload-preview.extension.js'; @customElement('umb-input-upload-field') export class UmbInputUploadFieldElement extends UmbLitElement { diff --git a/src/packages/media/media/property-editors/image-cropper/property-editor-ui-image-cropper.element.ts b/src/packages/media/media/property-editors/image-cropper/property-editor-ui-image-cropper.element.ts index ae79a9c81f..b7f7ea2acc 100644 --- a/src/packages/media/media/property-editors/image-cropper/property-editor-ui-image-cropper.element.ts +++ b/src/packages/media/media/property-editors/image-cropper/property-editor-ui-image-cropper.element.ts @@ -1,12 +1,12 @@ import type { UmbImageCropperPropertyEditorValue, UmbInputImageCropperElement } from '../../components/index.js'; import { html, customElement, property, nothing, state } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import '../../components/input-image-cropper/input-image-cropper.element.js'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import '../../components/input-image-cropper/input-image-cropper.element.js'; /** * @element umb-property-editor-ui-image-cropper diff --git a/src/packages/media/media/property-editors/media-entity-picker/property-editor-ui-media-entity-picker.element.ts b/src/packages/media/media/property-editors/media-entity-picker/property-editor-ui-media-entity-picker.element.ts index 4b30094078..46e8af9c85 100644 --- a/src/packages/media/media/property-editors/media-entity-picker/property-editor-ui-media-entity-picker.element.ts +++ b/src/packages/media/media/property-editors/media-entity-picker/property-editor-ui-media-entity-picker.element.ts @@ -3,8 +3,10 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; import type { UmbInputMediaElement } from '@umbraco-cms/backoffice/media'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; @customElement('umb-property-editor-ui-media-entity-picker') export class UmbPropertyEditorUIMediaEntityPickerElement extends UmbLitElement implements UmbPropertyEditorUiElement { diff --git a/src/packages/media/media/property-editors/media-picker/property-editor-ui-media-picker.element.ts b/src/packages/media/media/property-editors/media-picker/property-editor-ui-media-picker.element.ts index 3140451213..281d3a47b8 100644 --- a/src/packages/media/media/property-editors/media-picker/property-editor-ui-media-picker.element.ts +++ b/src/packages/media/media/property-editors/media-picker/property-editor-ui-media-picker.element.ts @@ -5,8 +5,10 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import '../../components/input-rich-media/input-rich-media.element.js'; diff --git a/src/packages/media/media/property-editors/upload-field/property-editor-ui-upload-field.element.ts b/src/packages/media/media/property-editors/upload-field/property-editor-ui-upload-field.element.ts index 16ca26f4ec..2ca719db65 100644 --- a/src/packages/media/media/property-editors/upload-field/property-editor-ui-upload-field.element.ts +++ b/src/packages/media/media/property-editors/upload-field/property-editor-ui-upload-field.element.ts @@ -1,12 +1,12 @@ import type { UmbInputUploadFieldElement } from '../../components/input-upload-field/input-upload-field.element.js'; import type { MediaValueType } from './types.js'; import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; /** * @element umb-property-editor-ui-upload-field diff --git a/src/packages/media/media/workspace/media-workspace.context.ts b/src/packages/media/media/workspace/media-workspace.context.ts index dab4a14ab6..173dad9b46 100644 --- a/src/packages/media/media/workspace/media-workspace.context.ts +++ b/src/packages/media/media/workspace/media-workspace.context.ts @@ -10,6 +10,7 @@ import type { } from '../types.js'; import { UMB_CREATE_MEDIA_WORKSPACE_PATH_PATTERN, UMB_EDIT_MEDIA_WORKSPACE_PATH_PATTERN } from '../paths.js'; import { UMB_MEDIA_SECTION_PATH } from '../../media-section/paths.js'; +import { UMB_MEDIA_COLLECTION_ALIAS } from '../collection/index.js'; import { UMB_MEMBER_DETAIL_MODEL_VARIANT_SCAFFOLD } from './constants.js'; import { UMB_INVARIANT_CULTURE, UmbVariantId } from '@umbraco-cms/backoffice/variant'; import { UmbContentTypeStructureManager } from '@umbraco-cms/backoffice/content-type'; @@ -42,7 +43,6 @@ import { UmbEntityContext } from '@umbraco-cms/backoffice/entity'; import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin'; import { UmbReadOnlyVariantStateManager } from '@umbraco-cms/backoffice/utils'; import { UmbDataTypeItemRepositoryManager } from '@umbraco-cms/backoffice/data-type'; -import { UMB_MEDIA_COLLECTION_ALIAS } from '../collection/index.js'; type ContentModel = UmbMediaDetailModel; type ContentTypeModel = UmbMediaTypeDetailModel; diff --git a/src/packages/members/member-group/property-editor/member-group-picker/property-editor-ui-member-group-picker.element.ts b/src/packages/members/member-group/property-editor/member-group-picker/property-editor-ui-member-group-picker.element.ts index 380d663b58..82ebf470f4 100644 --- a/src/packages/members/member-group/property-editor/member-group-picker/property-editor-ui-member-group-picker.element.ts +++ b/src/packages/members/member-group/property-editor/member-group-picker/property-editor-ui-member-group-picker.element.ts @@ -3,8 +3,10 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; import type { UmbInputMemberGroupElement } from '@umbraco-cms/backoffice/member-group'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-member-group-picker diff --git a/src/packages/members/member/property-editor/member-picker/property-editor-ui-member-picker.element.ts b/src/packages/members/member/property-editor/member-picker/property-editor-ui-member-picker.element.ts index 6d8c408788..8e3d7aae82 100644 --- a/src/packages/members/member/property-editor/member-picker/property-editor-ui-member-picker.element.ts +++ b/src/packages/members/member/property-editor/member-picker/property-editor-ui-member-picker.element.ts @@ -1,8 +1,10 @@ import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbInputMemberElement } from '@umbraco-cms/backoffice/member'; /** diff --git a/src/packages/multi-url-picker/property-editor/property-editor-ui-multi-url-picker.element.ts b/src/packages/multi-url-picker/property-editor/property-editor-ui-multi-url-picker.element.ts index e61b126da7..94906b55c2 100644 --- a/src/packages/multi-url-picker/property-editor/property-editor-ui-multi-url-picker.element.ts +++ b/src/packages/multi-url-picker/property-editor/property-editor-ui-multi-url-picker.element.ts @@ -4,8 +4,10 @@ import { customElement, html, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUIModalSidebarSize } from '@umbraco-cms/backoffice/external/uui'; import '../components/input-multi-url/index.js'; diff --git a/src/packages/property-editors/checkbox-list/property-editor-ui-checkbox-list.element.ts b/src/packages/property-editors/checkbox-list/property-editor-ui-checkbox-list.element.ts index 3706f0610d..5137551757 100644 --- a/src/packages/property-editors/checkbox-list/property-editor-ui-checkbox-list.element.ts +++ b/src/packages/property-editors/checkbox-list/property-editor-ui-checkbox-list.element.ts @@ -2,8 +2,10 @@ import type { UmbInputCheckboxListElement } from './components/input-checkbox-li import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import './components/input-checkbox-list/input-checkbox-list.element.js'; diff --git a/src/packages/property-editors/collection/config/bulk-action-permissions/permissions.element.ts b/src/packages/property-editors/collection/config/bulk-action-permissions/permissions.element.ts index df51d1d007..f18b07d7e3 100644 --- a/src/packages/property-editors/collection/config/bulk-action-permissions/permissions.element.ts +++ b/src/packages/property-editors/collection/config/bulk-action-permissions/permissions.element.ts @@ -1,8 +1,10 @@ import type { UmbCollectionBulkActionPermissions } from '@umbraco-cms/backoffice/collection'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorUiElement, + UmbPropertyEditorConfigCollection, +} from '@umbraco-cms/backoffice/property-editor'; import { html, customElement, property, css } from '@umbraco-cms/backoffice/external/lit'; import type { UUIBooleanInputEvent } from '@umbraco-cms/backoffice/external/uui'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; diff --git a/src/packages/property-editors/collection/config/column/column-configuration.element.ts b/src/packages/property-editors/collection/config/column/column-configuration.element.ts index 0edbb99218..604b3ed46d 100644 --- a/src/packages/property-editors/collection/config/column/column-configuration.element.ts +++ b/src/packages/property-editors/collection/config/column/column-configuration.element.ts @@ -5,8 +5,10 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import { UmbSorterController } from '@umbraco-cms/backoffice/sorter'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUIInputEvent } from '@umbraco-cms/backoffice/external/uui'; // import of local components diff --git a/src/packages/property-editors/collection/config/layout/layout-configuration.element.ts b/src/packages/property-editors/collection/config/layout/layout-configuration.element.ts index 148d5c8f39..7408f7cf26 100644 --- a/src/packages/property-editors/collection/config/layout/layout-configuration.element.ts +++ b/src/packages/property-editors/collection/config/layout/layout-configuration.element.ts @@ -16,8 +16,10 @@ import { UmbSorterController } from '@umbraco-cms/backoffice/sorter'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; import type { UmbInputManifestElement } from '@umbraco-cms/backoffice/components'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUIInputElement, UUIInputEvent } from '@umbraco-cms/backoffice/external/uui'; import { UMB_ICON_PICKER_MODAL } from '@umbraco-cms/backoffice/icon'; diff --git a/src/packages/property-editors/collection/config/order-by/order-by.element.ts b/src/packages/property-editors/collection/config/order-by/order-by.element.ts index 0e0cac07c3..0565f66063 100644 --- a/src/packages/property-editors/collection/config/order-by/order-by.element.ts +++ b/src/packages/property-editors/collection/config/order-by/order-by.element.ts @@ -3,8 +3,10 @@ import { customElement, html, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; /** diff --git a/src/packages/property-editors/collection/property-editor-ui-collection.element.ts b/src/packages/property-editors/collection/property-editor-ui-collection.element.ts index 18e2214c91..61e17dd255 100644 --- a/src/packages/property-editors/collection/property-editor-ui-collection.element.ts +++ b/src/packages/property-editors/collection/property-editor-ui-collection.element.ts @@ -1,10 +1,12 @@ -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UMB_DOCUMENT_COLLECTION_ALIAS } from '@umbraco-cms/backoffice/document'; import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; import { UMB_CONTENT_COLLECTION_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/content'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; import type { UmbCollectionBulkActionPermissions, UmbCollectionConfiguration, diff --git a/src/packages/property-editors/color-picker/property-editor-ui-color-picker.element.ts b/src/packages/property-editors/color-picker/property-editor-ui-color-picker.element.ts index af0a750eac..9aa22a08be 100644 --- a/src/packages/property-editors/color-picker/property-editor-ui-color-picker.element.ts +++ b/src/packages/property-editors/color-picker/property-editor-ui-color-picker.element.ts @@ -1,8 +1,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbSwatchDetails } from '@umbraco-cms/backoffice/models'; import type { UUIColorSwatchesEvent } from '@umbraco-cms/backoffice/external/uui'; diff --git a/src/packages/property-editors/color-swatches-editor/property-editor-ui-color-swatches-editor.element.ts b/src/packages/property-editors/color-swatches-editor/property-editor-ui-color-swatches-editor.element.ts index 00314f620a..cb8bc90f12 100644 --- a/src/packages/property-editors/color-swatches-editor/property-editor-ui-color-swatches-editor.element.ts +++ b/src/packages/property-editors/color-swatches-editor/property-editor-ui-color-swatches-editor.element.ts @@ -2,8 +2,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbMultipleColorPickerInputElement } from '@umbraco-cms/backoffice/components'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbSwatchDetails } from '@umbraco-cms/backoffice/models'; /** diff --git a/src/packages/property-editors/content-picker/config/source/property-editor-ui-content-picker-source.element.ts b/src/packages/property-editors/content-picker/config/source/property-editor-ui-content-picker-source.element.ts index 328ff44ac9..aa302b1ea1 100644 --- a/src/packages/property-editors/content-picker/config/source/property-editor-ui-content-picker-source.element.ts +++ b/src/packages/property-editors/content-picker/config/source/property-editor-ui-content-picker-source.element.ts @@ -1,11 +1,11 @@ import type { UmbContentPickerSource } from '../../types.js'; import type { UmbInputContentPickerSourceElement } from './input-content-picker-source.element.js'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import { + type UmbPropertyEditorUiElement, type UmbPropertyEditorConfigCollection, UmbPropertyValueChangeEvent, } from '@umbraco-cms/backoffice/property-editor'; +import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; // import of local component diff --git a/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts b/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts index a9617bc274..7adc00653e 100644 --- a/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts +++ b/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts @@ -8,8 +8,10 @@ import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-ed import { UMB_DOCUMENT_ENTITY_TYPE } from '@umbraco-cms/backoffice/document'; import { UMB_MEDIA_ENTITY_TYPE } from '@umbraco-cms/backoffice/media'; import { UMB_MEMBER_ENTITY_TYPE } from '@umbraco-cms/backoffice/member'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbTreeStartNode } from '@umbraco-cms/backoffice/tree'; // import of local component diff --git a/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts b/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts index 1ed8ca14f9..7c79c81c83 100644 --- a/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts +++ b/src/packages/property-editors/date-picker/property-editor-ui-date-picker.element.ts @@ -1,9 +1,11 @@ import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UmbInputDateElement } from '@umbraco-cms/backoffice/components'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; /** * This property editor allows the user to pick a date, datetime-local, or time. diff --git a/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts b/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts index 3401fe60ab..66858004ba 100644 --- a/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts +++ b/src/packages/property-editors/dropdown/property-editor-ui-dropdown.element.ts @@ -2,8 +2,10 @@ import { css, customElement, html, map, property, state } from '@umbraco-cms/bac import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import { UUISelectElement } from '@umbraco-cms/backoffice/external/uui'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; /** diff --git a/src/packages/property-editors/eye-dropper/property-editor-ui-eye-dropper.element.ts b/src/packages/property-editors/eye-dropper/property-editor-ui-eye-dropper.element.ts index 31eac47a42..310e53b1f3 100644 --- a/src/packages/property-editors/eye-dropper/property-editor-ui-eye-dropper.element.ts +++ b/src/packages/property-editors/eye-dropper/property-editor-ui-eye-dropper.element.ts @@ -1,8 +1,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUIColorPickerChangeEvent } from '@umbraco-cms/backoffice/external/uui'; /** diff --git a/src/packages/property-editors/label/property-editor-ui-label.element.ts b/src/packages/property-editors/label/property-editor-ui-label.element.ts index dcb969d4c1..7d75fb8a76 100644 --- a/src/packages/property-editors/label/property-editor-ui-label.element.ts +++ b/src/packages/property-editors/label/property-editor-ui-label.element.ts @@ -1,8 +1,10 @@ import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorUiElement, + UmbPropertyEditorConfigCollection, +} from '@umbraco-cms/backoffice/property-editor'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-label diff --git a/src/packages/property-editors/multiple-text-string/property-editor-ui-multiple-text-string.element.ts b/src/packages/property-editors/multiple-text-string/property-editor-ui-multiple-text-string.element.ts index 63a022c27f..3a80825817 100644 --- a/src/packages/property-editors/multiple-text-string/property-editor-ui-multiple-text-string.element.ts +++ b/src/packages/property-editors/multiple-text-string/property-editor-ui-multiple-text-string.element.ts @@ -3,8 +3,10 @@ import { customElement, html, property, state } from '@umbraco-cms/backoffice/ex import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UmbChangeEvent } from '@umbraco-cms/backoffice/event'; import type { UmbInputMultipleTextStringElement } from '@umbraco-cms/backoffice/components'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-multiple-text-string diff --git a/src/packages/property-editors/number-range/property-editor-ui-number-range.element.ts b/src/packages/property-editors/number-range/property-editor-ui-number-range.element.ts index eac645c7f0..10d1060a58 100644 --- a/src/packages/property-editors/number-range/property-editor-ui-number-range.element.ts +++ b/src/packages/property-editors/number-range/property-editor-ui-number-range.element.ts @@ -4,8 +4,10 @@ import { UmbFormControlMixin } from '@umbraco-cms/backoffice/validation'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-number-range diff --git a/src/packages/property-editors/number/property-editor-ui-number.element.ts b/src/packages/property-editors/number/property-editor-ui-number.element.ts index 8976ffdd10..5f48f61ba1 100644 --- a/src/packages/property-editors/number/property-editor-ui-number.element.ts +++ b/src/packages/property-editors/number/property-editor-ui-number.element.ts @@ -1,8 +1,10 @@ import { css, customElement, html, ifDefined, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; @customElement('umb-property-editor-ui-number') export class UmbPropertyEditorUINumberElement extends UmbLitElement implements UmbPropertyEditorUiElement { diff --git a/src/packages/property-editors/order-direction/property-editor-ui-order-direction.element.ts b/src/packages/property-editors/order-direction/property-editor-ui-order-direction.element.ts index b3073e5b5c..b3fe162c4e 100644 --- a/src/packages/property-editors/order-direction/property-editor-ui-order-direction.element.ts +++ b/src/packages/property-editors/order-direction/property-editor-ui-order-direction.element.ts @@ -1,8 +1,10 @@ import { html, customElement, property, css } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorUiElement, + UmbPropertyEditorConfigCollection, +} from '@umbraco-cms/backoffice/property-editor'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { UUIBooleanInputEvent } from '@umbraco-cms/backoffice/external/uui'; diff --git a/src/packages/property-editors/overlay-size/property-editor-ui-overlay-size.element.ts b/src/packages/property-editors/overlay-size/property-editor-ui-overlay-size.element.ts index 0b6ff65474..849edf5b93 100644 --- a/src/packages/property-editors/overlay-size/property-editor-ui-overlay-size.element.ts +++ b/src/packages/property-editors/overlay-size/property-editor-ui-overlay-size.element.ts @@ -1,10 +1,10 @@ import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UUIModalSidebarSize, UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; /** diff --git a/src/packages/property-editors/radio-button-list/property-editor-ui-radio-button-list.element.ts b/src/packages/property-editors/radio-button-list/property-editor-ui-radio-button-list.element.ts index 917b9af073..e88a0da874 100644 --- a/src/packages/property-editors/radio-button-list/property-editor-ui-radio-button-list.element.ts +++ b/src/packages/property-editors/radio-button-list/property-editor-ui-radio-button-list.element.ts @@ -2,8 +2,10 @@ import type { UmbInputRadioButtonListElement } from '@umbraco-cms/backoffice/com import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-radio-button-list diff --git a/src/packages/property-editors/select/property-editor-ui-select.element.ts b/src/packages/property-editors/select/property-editor-ui-select.element.ts index ea714aef05..53bd5c0f6c 100644 --- a/src/packages/property-editors/select/property-editor-ui-select.element.ts +++ b/src/packages/property-editors/select/property-editor-ui-select.element.ts @@ -1,8 +1,10 @@ import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; /** diff --git a/src/packages/property-editors/slider/property-editor-ui-slider.element.ts b/src/packages/property-editors/slider/property-editor-ui-slider.element.ts index ae75c60afd..9342f2898e 100644 --- a/src/packages/property-editors/slider/property-editor-ui-slider.element.ts +++ b/src/packages/property-editors/slider/property-editor-ui-slider.element.ts @@ -2,8 +2,10 @@ import type { UmbInputSliderElement } from '@umbraco-cms/backoffice/components'; import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; export type UmbSliderValue = { from: number; to: number } | undefined; diff --git a/src/packages/property-editors/text-box/property-editor-ui-text-box.element.ts b/src/packages/property-editors/text-box/property-editor-ui-text-box.element.ts index 96f98a3e07..06c2a50778 100644 --- a/src/packages/property-editors/text-box/property-editor-ui-text-box.element.ts +++ b/src/packages/property-editors/text-box/property-editor-ui-text-box.element.ts @@ -1,11 +1,11 @@ import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, customElement, state, ifDefined, property } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import type { UUIInputElement } from '@umbraco-cms/backoffice/external/uui'; import { UMB_VALIDATION_EMPTY_LOCALIZATION_KEY, UmbFormControlMixin } from '@umbraco-cms/backoffice/validation'; diff --git a/src/packages/property-editors/textarea/property-editor-ui-textarea.element.ts b/src/packages/property-editors/textarea/property-editor-ui-textarea.element.ts index cb5a35b759..74b95bc39c 100644 --- a/src/packages/property-editors/textarea/property-editor-ui-textarea.element.ts +++ b/src/packages/property-editors/textarea/property-editor-ui-textarea.element.ts @@ -2,8 +2,10 @@ import { css, customElement, html, ifDefined, property, state, styleMap } from ' import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; import type { StyleInfo } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import { UmbFormControlMixin } from '@umbraco-cms/backoffice/validation'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; diff --git a/src/packages/property-editors/toggle/property-editor-ui-toggle.element.ts b/src/packages/property-editors/toggle/property-editor-ui-toggle.element.ts index 40adbab21e..903e0b4694 100644 --- a/src/packages/property-editors/toggle/property-editor-ui-toggle.element.ts +++ b/src/packages/property-editors/toggle/property-editor-ui-toggle.element.ts @@ -2,8 +2,10 @@ import type { UmbInputToggleElement } from '@umbraco-cms/backoffice/components'; import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; /** * @element umb-property-editor-ui-toggle diff --git a/src/packages/property-editors/value-type/property-editor-ui-value-type.element.ts b/src/packages/property-editors/value-type/property-editor-ui-value-type.element.ts index 29fd92cef6..3bc8309539 100644 --- a/src/packages/property-editors/value-type/property-editor-ui-value-type.element.ts +++ b/src/packages/property-editors/value-type/property-editor-ui-value-type.element.ts @@ -1,11 +1,11 @@ import { html, customElement, property, state, query } from '@umbraco-cms/backoffice/external/lit'; import type { UUISelectElement, UUISelectEvent } from '@umbraco-cms/backoffice/external/uui'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; /** * @element umb-property-editor-ui-value-type diff --git a/src/packages/rte/tiny-mce/components/input-tiny-mce/input-tiny-mce.sanitizer.ts b/src/packages/rte/tiny-mce/components/input-tiny-mce/input-tiny-mce.sanitizer.ts index d50a6ef6e3..9d07f73680 100644 --- a/src/packages/rte/tiny-mce/components/input-tiny-mce/input-tiny-mce.sanitizer.ts +++ b/src/packages/rte/tiny-mce/components/input-tiny-mce/input-tiny-mce.sanitizer.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ import type { Editor } from '@umbraco-cms/backoffice/external/tinymce'; /** diff --git a/src/packages/rte/tiptap/extensions/toolbar/link.extension.ts b/src/packages/rte/tiptap/extensions/toolbar/link.extension.ts index d78648f6fb..3c1ef5f0af 100644 --- a/src/packages/rte/tiptap/extensions/toolbar/link.extension.ts +++ b/src/packages/rte/tiptap/extensions/toolbar/link.extension.ts @@ -99,6 +99,7 @@ export default class UmbTiptapToolbarLinkExtensionApi extends UmbTiptapToolbarEl /** * If the URL is prefixed "www.", then prepend "http://" protocol scheme. + * @param url */ #ensureHttpProtocol(url: string | null | undefined) { if (!url) return null; @@ -110,6 +111,7 @@ export default class UmbTiptapToolbarLinkExtensionApi extends UmbTiptapToolbarEl /** * If the URL is an email address, then prepend "mailto:" protocol scheme. + * @param url */ #transformURLToMailto(url: string | null | undefined) { if (!url) return null; @@ -121,6 +123,7 @@ export default class UmbTiptapToolbarLinkExtensionApi extends UmbTiptapToolbarEl /** * If the URL contains an anchor, then return the anchor. + * @param queryString */ #getAnchorFromQueryString(queryString: string | null) { if (!queryString) return null; @@ -129,6 +132,7 @@ export default class UmbTiptapToolbarLinkExtensionApi extends UmbTiptapToolbarEl /** * If the query string does not start with "?" or "#", then prepend it. + * @param queryString */ #queryStringFromUrl(queryString: string | null | undefined) { if (!queryString) return null; diff --git a/src/packages/static-file/property-editors/static-file-picker/property-editor-ui-static-file-picker.element.ts b/src/packages/static-file/property-editors/static-file-picker/property-editor-ui-static-file-picker.element.ts index ac105e1156..c4d4e36dd5 100644 --- a/src/packages/static-file/property-editors/static-file-picker/property-editor-ui-static-file-picker.element.ts +++ b/src/packages/static-file/property-editors/static-file-picker/property-editor-ui-static-file-picker.element.ts @@ -1,12 +1,12 @@ import type { UmbInputStaticFileElement } from '../../components/index.js'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; -import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; -import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; +import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit'; +import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; import '../../components/input-static-file/index.js'; import { UmbServerFilePathUniqueSerializer } from '@umbraco-cms/backoffice/server-file-system'; diff --git a/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts b/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts index 38b4cb07d2..f8e30b4596 100644 --- a/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts +++ b/src/packages/tags/property-editors/tags/property-editor-ui-tags.element.ts @@ -2,10 +2,10 @@ import type { UmbTagsInputElement } from '../../components/tags-input/tags-input import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property'; import { html, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit'; import { + type UmbPropertyEditorUiElement, UmbPropertyValueChangeEvent, type UmbPropertyEditorConfigCollection, } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import '../../components/tags-input/tags-input.element.js'; diff --git a/src/packages/user/user/property-editor/user-picker/property-editor-ui-user-picker.element.ts b/src/packages/user/user/property-editor/user-picker/property-editor-ui-user-picker.element.ts index 644bb1d621..e4c8e80ba1 100644 --- a/src/packages/user/user/property-editor/user-picker/property-editor-ui-user-picker.element.ts +++ b/src/packages/user/user/property-editor/user-picker/property-editor-ui-user-picker.element.ts @@ -1,8 +1,10 @@ import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; -import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/property-editor'; +import type { + UmbPropertyEditorConfigCollection, + UmbPropertyEditorUiElement, +} from '@umbraco-cms/backoffice/property-editor'; import type { UmbUserInputElement } from '@umbraco-cms/backoffice/user'; /**