V16/hotfix/set manifests when using create extension api (#19358)
* also set manifest when using createExtensionApi() * set manifest when using createExtensionManifest
This commit is contained in:
@@ -24,7 +24,14 @@ export class UmbClipboardCopyPropertyValueTranslatorValueResolver extends UmbCon
|
||||
}
|
||||
|
||||
// Create translators
|
||||
const apiPromises = manifests.map((manifest) => createExtensionApi(this, manifest));
|
||||
const apiPromises = manifests.map((manifest) =>
|
||||
createExtensionApi(this, manifest).then((api) => {
|
||||
if (api) {
|
||||
(api as any).manifest = manifest;
|
||||
}
|
||||
return api;
|
||||
}),
|
||||
);
|
||||
const apis = await Promise.all(apiPromises);
|
||||
|
||||
// Translate values
|
||||
|
||||
@@ -136,6 +136,7 @@ export class UmbMergeContentVariantDataController extends UmbControllerBase {
|
||||
// If api is not to be found, then we can continue using the draftValue as is.
|
||||
return draftValue;
|
||||
}
|
||||
(api as any).manifest = manifest;
|
||||
|
||||
let newValue = draftValue;
|
||||
|
||||
|
||||
@@ -74,8 +74,10 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
|
||||
this._firstActionApi = await createExtensionApi(this, this._firstActionManifest, [
|
||||
{ unique: this.unique, entityType: this.entityType, meta: this._firstActionManifest.meta },
|
||||
]);
|
||||
|
||||
this._firstActionHref = await this._firstActionApi?.getHref();
|
||||
if (this._firstActionApi) {
|
||||
(this._firstActionApi as any).manifest = this._firstActionManifest;
|
||||
this._firstActionHref = await this._firstActionApi.getHref();
|
||||
}
|
||||
}
|
||||
|
||||
async #onFirstActionClick(event: PointerEvent) {
|
||||
|
||||
@@ -81,6 +81,7 @@ export class UmbCreateEntityAction extends UmbEntityActionBase<MetaEntityActionC
|
||||
|
||||
if (!api) throw new Error(`Could not create api for ${manifest.alias}`);
|
||||
|
||||
(api as any).manifest = manifest;
|
||||
this.#singleOptionApi = api;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ export class UmbPropertyValueCloneController extends UmbControllerBase {
|
||||
return incomingProperty;
|
||||
}
|
||||
|
||||
(api as any).manifest = manifest;
|
||||
|
||||
let clonedProperty = incomingProperty;
|
||||
|
||||
if (api.cloneValue) {
|
||||
@@ -86,6 +88,8 @@ export class UmbPropertyValueCloneController extends UmbControllerBase {
|
||||
return incomingProperty;
|
||||
}
|
||||
|
||||
(api as any).manifest = manifest;
|
||||
|
||||
if (api.processValues) {
|
||||
return (
|
||||
(await api.processValues(incomingProperty, async (properties) => {
|
||||
|
||||
@@ -54,9 +54,18 @@ export class UmbPropertyValuePresetBuilderController<
|
||||
// Find a preset for this editor alias:
|
||||
const manifests = umbExtensionsRegistry.getByTypeAndFilter('propertyValuePreset', filter);
|
||||
|
||||
const apis = (await Promise.all(manifests.map((x) => createExtensionApi(this, x)))).filter(
|
||||
(x) => x !== undefined,
|
||||
) as Array<UmbPropertyValuePreset>;
|
||||
const apis = (
|
||||
await Promise.all(
|
||||
manifests.map((x) =>
|
||||
createExtensionApi(this, x).then((x) => {
|
||||
if (x) {
|
||||
(x as any).manifest = x;
|
||||
}
|
||||
return x;
|
||||
}),
|
||||
),
|
||||
)
|
||||
).filter((x) => x !== undefined) as Array<UmbPropertyValuePreset>;
|
||||
|
||||
const result = await this._generatePropertyValues(apis, propertyType);
|
||||
|
||||
|
||||
@@ -83,6 +83,10 @@ export class UmbSectionDefaultElement extends UmbLitElement implements UmbSectio
|
||||
extensionsWithElement.map(async (extensionController) => {
|
||||
const api = await createExtensionApi(this, extensionController.manifest);
|
||||
|
||||
if (api) {
|
||||
(api as any).manifest = extensionController.manifest;
|
||||
}
|
||||
|
||||
return {
|
||||
path:
|
||||
api?.getPath?.() ||
|
||||
|
||||
@@ -55,6 +55,8 @@ export class UmbValidationPropertyPathTranslationController extends UmbControlle
|
||||
return propertyPaths;
|
||||
}
|
||||
|
||||
(api as any).manifest = manifest;
|
||||
|
||||
propertyPaths = (await api.translate(propertyPaths, propertyData)) ?? propertyPaths;
|
||||
|
||||
return propertyPaths;
|
||||
|
||||
@@ -87,6 +87,11 @@ export class UmbInputMarkdownElement extends UmbFormControlMixin<string, typeof
|
||||
this.observe(umbExtensionsRegistry.byType('monacoMarkdownEditorAction'), (manifests) => {
|
||||
manifests.forEach(async (manifest) => {
|
||||
const api = await createExtensionApi(this, manifest, [this]);
|
||||
|
||||
if (api) {
|
||||
(api as any).manifest = manifest;
|
||||
}
|
||||
|
||||
const action: UmbMarkdownEditorAction = {
|
||||
id: manifest.alias ?? api.getUnique(),
|
||||
label: this.localize.string(manifest.meta?.label ?? api.getLabel()),
|
||||
|
||||
Reference in New Issue
Block a user