From a19f8a082c158f2fe78ea1288bf1eae2735b7728 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 27 Oct 2022 13:58:44 +0200 Subject: [PATCH] move all manifest types from server generation to client --- src/Umbraco.Web.UI.Client/schemas/api/api.yml | 672 +----------------- .../schemas/generated-schema.ts | 322 +-------- .../src/backoffice/backoffice.element.ts | 6 +- .../property-editor-models/manifests.ts | 254 +++++++ .../property-editor-uis/manifests.ts | 16 +- .../src/core/backend-api/fetcher.ts | 10 - .../extensions-registry/dashboard.models.ts | 12 + .../editor-action.models.ts | 10 + .../extensions-registry/editor-view.models.ts | 13 + .../core/extensions-registry/editor.models.ts | 10 + .../src/core/extensions-registry/index.ts | 1 + .../src/core/extensions-registry/models.ts | 91 +++ .../package-view.models.ts | 10 + .../property-action.models.ts | 10 + .../property-editor.models.ts | 43 ++ .../section-view.models.ts | 14 + .../extensions-registry/section.models.ts | 11 + .../tree-item-action.models.ts | 12 + .../core/extensions-registry/tree.models.ts | 10 + .../src/core/mocks/browser-handlers.ts | 2 - .../core/mocks/data/property-editor.data.ts | 363 ---------- .../mocks/domains/property-editor.handlers.ts | 43 -- .../src/core/models/index.ts | 37 +- .../property-editor-config.store.ts | 38 - .../property-editor/property-editor.store.ts | 49 -- .../temp-schema-generator/api.ts | 1 - .../temp-schema-generator/manifests.ts | 171 +---- .../temp-schema-generator/property-editors.ts | 80 --- 28 files changed, 516 insertions(+), 1795 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/property-editor-models/manifests.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/dashboard.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-action.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-view.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/package-view.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-action.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-editor.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/section-view.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/section.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree-item-action.models.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree.models.ts delete mode 100644 src/Umbraco.Web.UI.Client/src/core/mocks/data/property-editor.data.ts delete mode 100644 src/Umbraco.Web.UI.Client/src/core/mocks/domains/property-editor.handlers.ts delete mode 100644 src/Umbraco.Web.UI.Client/src/core/stores/property-editor-config/property-editor-config.store.ts delete mode 100644 src/Umbraco.Web.UI.Client/src/core/stores/property-editor/property-editor.store.ts delete mode 100644 src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts diff --git a/src/Umbraco.Web.UI.Client/schemas/api/api.yml b/src/Umbraco.Web.UI.Client/schemas/api/api.yml index 532bec33a9..acc0cf37d1 100644 --- a/src/Umbraco.Web.UI.Client/schemas/api/api.yml +++ b/src/Umbraco.Web.UI.Client/schemas/api/api.yml @@ -105,66 +105,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ProblemDetails' - /property-editors/list: - get: - operationId: PropertyEditorsListEndpoint - responses: - '200': - description: 200 response - content: - application/json: - schema: - $ref: '#/components/schemas/PropertyEditorsListResponse' - default: - description: default response - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - /property-editors/property-editor/{propertyEditorAlias}: - get: - operationId: PropertyEditorEndpoint - parameters: - - name: propertyEditorAlias - in: path - required: true - schema: - type: string - responses: - '200': - description: 200 response - content: - application/json: - schema: - $ref: '#/components/schemas/PropertyEditorResponse' - default: - description: default response - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' - /property-editors/property-editor/config/{propertyEditorAlias}: - get: - operationId: PropertyEditorConfigEndpoint - parameters: - - name: propertyEditorAlias - in: path - required: true - schema: - type: string - responses: - '200': - description: 200 response - content: - application/json: - schema: - $ref: '#/components/schemas/PropertyEditorConfigResponse' - default: - description: default response - content: - application/json: - schema: - $ref: '#/components/schemas/ProblemDetails' /published-cache/status: get: operationId: PublishedCacheStatus @@ -559,555 +499,13 @@ components: required: - user - telemetryLevel - MetaSection: - type: object - properties: - label: - type: string - pathname: - type: string - required: - - label - - pathname - IManifestSection: - type: object - properties: - type: - type: string - enum: - - section - meta: - $ref: '#/components/schemas/MetaSection' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaSectionView: - type: object - properties: - sections: - type: array - items: - type: string - label: - type: string - pathname: - type: string - weight: - type: number - format: float - icon: - type: string - required: - - sections - - label - - pathname - - weight - - icon - IManifestSectionView: - type: object - properties: - type: - type: string - enum: - - sectionView - meta: - $ref: '#/components/schemas/MetaSectionView' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaTree: - type: object - properties: - sections: - type: array - items: - type: string - required: - - sections - IManifestTree: - type: object - properties: - type: - type: string - enum: - - tree - meta: - $ref: '#/components/schemas/MetaTree' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaEditor: - type: object - properties: - entityType: - type: string - required: - - entityType - IManifestEditor: - type: object - properties: - type: - type: string - enum: - - editor - meta: - $ref: '#/components/schemas/MetaEditor' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaEditorAction: - type: object - properties: - editors: - type: array - items: - type: string - required: - - editors - IManifestEditorAction: - type: object - properties: - type: - type: string - enum: - - editorAction - meta: - $ref: '#/components/schemas/MetaEditorAction' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaEditorView: - type: object - properties: - editors: - type: array - items: - type: string - pathname: - type: string - label: - type: string - icon: - type: string - required: - - editors - - pathname - - label - - icon - IManifestEditorView: - type: object - properties: - type: - type: string - enum: - - editorView - meta: - $ref: '#/components/schemas/MetaEditorView' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaTreeItemAction: - type: object - properties: - trees: - type: array - items: - type: string - label: - type: string - icon: - type: string - required: - - trees - - label - - icon - IManifestTreeItemAction: - type: object - properties: - type: - type: string - enum: - - treeItemAction - meta: - $ref: '#/components/schemas/MetaTreeItemAction' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - PropertyEditorConfigProperty: - type: object - properties: - label: - type: string - description: - type: string - alias: - type: string - propertyEditorUI: - type: string - required: - - label - - alias - - propertyEditorUI - PropertyEditorConfigDefaultData: - type: object - properties: - alias: - type: string - value: - nullable: true - oneOf: - - type: string - - type: number - format: float - - type: boolean - - type: object - - type: array - items: - type: string - - type: array - items: - type: number - format: float - - type: array - items: - type: boolean - - type: array - items: - type: object - required: - - alias - - value - PropertyEditorConfig: - type: object - properties: - properties: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigProperty' - defaultData: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigDefaultData' - required: - - properties - MetaPropertyEditorUI: - type: object - properties: - label: - type: string - propertyEditor: - type: string - icon: - type: string - group: - type: string - config: - $ref: '#/components/schemas/PropertyEditorConfig' - required: - - label - - propertyEditor - - icon - - group - IManifestPropertyEditorUI: - type: object - properties: - type: - type: string - enum: - - propertyEditorUI - meta: - $ref: '#/components/schemas/MetaPropertyEditorUI' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaDashboard: - type: object - properties: - sections: - type: array - items: - type: string - pathname: - type: string - label: - type: string - required: - - sections - - pathname - IManifestDashboard: - type: object - properties: - type: - type: string - enum: - - dashboard - meta: - $ref: '#/components/schemas/MetaDashboard' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaPropertyAction: - type: object - properties: - propertyEditors: - type: array - items: - type: string - required: - - propertyEditors - IManifestPropertyAction: - type: object - properties: - type: - type: string - enum: - - propertyAction - meta: - $ref: '#/components/schemas/MetaPropertyAction' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - MetaPackageView: - type: object - properties: - packageAlias: - type: string - required: - - packageAlias - IManifestPackageView: - type: object - properties: - type: - type: string - enum: - - packageView - meta: - $ref: '#/components/schemas/MetaPackageView' - js: - type: string - elementName: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - meta - - alias - - name - IManifestEntrypoint: - type: object - properties: - type: - type: string - enum: - - entrypoint - js: - type: string - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - js - - alias - - name - IManifestCustom: - type: object - properties: - type: - type: string - enum: - - custom - meta: - type: object - alias: - type: string - name: - type: string - weight: - type: number - format: float - required: - - type - - alias - - name - Manifest: - oneOf: - - $ref: '#/components/schemas/IManifestSection' - - $ref: '#/components/schemas/IManifestSectionView' - - $ref: '#/components/schemas/IManifestTree' - - $ref: '#/components/schemas/IManifestEditor' - - $ref: '#/components/schemas/IManifestEditorAction' - - $ref: '#/components/schemas/IManifestEditorView' - - $ref: '#/components/schemas/IManifestTreeItemAction' - - $ref: '#/components/schemas/IManifestPropertyEditorUI' - - $ref: '#/components/schemas/IManifestDashboard' - - $ref: '#/components/schemas/IManifestPropertyAction' - - $ref: '#/components/schemas/IManifestPackageView' - - $ref: '#/components/schemas/IManifestEntrypoint' - - $ref: '#/components/schemas/IManifestCustom' - discriminator: - propertyName: type - mapping: - section: '#/components/schemas/IManifestSection' - sectionView: '#/components/schemas/IManifestSectionView' - tree: '#/components/schemas/IManifestTree' - editor: '#/components/schemas/IManifestEditor' - editorAction: '#/components/schemas/IManifestEditorAction' - editorView: '#/components/schemas/IManifestEditorView' - treeItemAction: '#/components/schemas/IManifestTreeItemAction' - propertyEditorUI: '#/components/schemas/IManifestPropertyEditorUI' - dashboard: '#/components/schemas/IManifestDashboard' - propertyAction: '#/components/schemas/IManifestPropertyAction' - packageView: '#/components/schemas/IManifestPackageView' - entrypoint: '#/components/schemas/IManifestEntrypoint' - custom: '#/components/schemas/IManifestCustom' ManifestsResponse: type: object properties: manifests: type: array items: - $ref: '#/components/schemas/Manifest' + type: object required: - manifests PackageInstalled: @@ -1146,74 +544,6 @@ components: $ref: '#/components/schemas/PackageInstalled' required: - packages - PropertyEditor: - type: object - properties: - alias: - type: string - name: - type: string - icon: - type: string - group: - type: string - isSystem: - type: boolean - hasConfig: - type: boolean - config: - $ref: '#/components/schemas/PropertyEditorConfig' - required: - - alias - - name - - icon - - isSystem - - hasConfig - PropertyEditorsListResponse: - type: object - properties: - propertyEditors: - type: array - items: - $ref: '#/components/schemas/PropertyEditor' - required: - - propertyEditors - PropertyEditorResponse: - type: object - properties: - alias: - type: string - name: - type: string - icon: - type: string - group: - type: string - isSystem: - type: boolean - hasConfig: - type: boolean - config: - $ref: '#/components/schemas/PropertyEditorConfig' - required: - - alias - - name - - icon - - isSystem - - hasConfig - PropertyEditorConfigResponse: - type: object - properties: - properties: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigProperty' - defaultData: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigDefaultData' - required: - - properties ServerStatus: type: string enum: diff --git a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts index 5abca1cf7e..9a3b5ea48b 100644 --- a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts +++ b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts @@ -22,15 +22,6 @@ export interface paths { "/manifests/packages/installed": { get: operations["ManifestsPackagesInstalled"]; }; - "/property-editors/list": { - get: operations["PropertyEditorsListEndpoint"]; - }; - "/property-editors/property-editor/{propertyEditorAlias}": { - get: operations["PropertyEditorEndpoint"]; - }; - "/property-editors/property-editor/config/{propertyEditorAlias}": { - get: operations["PropertyEditorConfigEndpoint"]; - }; "/published-cache/status": { get: operations["PublishedCacheStatus"]; }; @@ -139,236 +130,8 @@ export interface components { telemetryLevel: components["schemas"]["ConsentLevel"]; database?: components["schemas"]["InstallSetupDatabaseConfiguration"]; }; - MetaSection: { - label: string; - pathname: string; - }; - IManifestSection: { - /** @enum {string} */ - type: "section"; - meta: components["schemas"]["MetaSection"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaSectionView: { - sections: string[]; - label: string; - pathname: string; - /** Format: float */ - weight: number; - icon: string; - }; - IManifestSectionView: { - /** @enum {string} */ - type: "sectionView"; - meta: components["schemas"]["MetaSectionView"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaTree: { - sections: string[]; - }; - IManifestTree: { - /** @enum {string} */ - type: "tree"; - meta: components["schemas"]["MetaTree"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaEditor: { - entityType: string; - }; - IManifestEditor: { - /** @enum {string} */ - type: "editor"; - meta: components["schemas"]["MetaEditor"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaEditorAction: { - editors: string[]; - }; - IManifestEditorAction: { - /** @enum {string} */ - type: "editorAction"; - meta: components["schemas"]["MetaEditorAction"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaEditorView: { - editors: string[]; - pathname: string; - label: string; - icon: string; - }; - IManifestEditorView: { - /** @enum {string} */ - type: "editorView"; - meta: components["schemas"]["MetaEditorView"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaTreeItemAction: { - trees: string[]; - label: string; - icon: string; - }; - IManifestTreeItemAction: { - /** @enum {string} */ - type: "treeItemAction"; - meta: components["schemas"]["MetaTreeItemAction"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - PropertyEditorConfigProperty: { - label: string; - description?: string; - alias: string; - propertyEditorUI: string; - }; - PropertyEditorConfigDefaultData: { - alias: string; - value: - | ( - | string - | number - | boolean - | { [key: string]: unknown } - | string[] - | number[] - | boolean[] - | { [key: string]: unknown }[] - ) - | null; - }; - PropertyEditorConfig: { - properties: components["schemas"]["PropertyEditorConfigProperty"][]; - defaultData?: components["schemas"]["PropertyEditorConfigDefaultData"][]; - }; - MetaPropertyEditorUI: { - label: string; - propertyEditor: string; - icon: string; - group: string; - config?: components["schemas"]["PropertyEditorConfig"]; - }; - IManifestPropertyEditorUI: { - /** @enum {string} */ - type: "propertyEditorUI"; - meta: components["schemas"]["MetaPropertyEditorUI"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaDashboard: { - sections: string[]; - pathname: string; - label?: string; - }; - IManifestDashboard: { - /** @enum {string} */ - type: "dashboard"; - meta: components["schemas"]["MetaDashboard"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaPropertyAction: { - propertyEditors: string[]; - }; - IManifestPropertyAction: { - /** @enum {string} */ - type: "propertyAction"; - meta: components["schemas"]["MetaPropertyAction"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - MetaPackageView: { - packageAlias: string; - }; - IManifestPackageView: { - /** @enum {string} */ - type: "packageView"; - meta: components["schemas"]["MetaPackageView"]; - js?: string; - elementName?: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - IManifestEntrypoint: { - /** @enum {string} */ - type: "entrypoint"; - js: string; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - IManifestCustom: { - /** @enum {string} */ - type: "custom"; - meta?: { [key: string]: unknown }; - alias: string; - name: string; - /** Format: float */ - weight?: number; - }; - Manifest: - | components["schemas"]["IManifestSection"] - | components["schemas"]["IManifestSectionView"] - | components["schemas"]["IManifestTree"] - | components["schemas"]["IManifestEditor"] - | components["schemas"]["IManifestEditorAction"] - | components["schemas"]["IManifestEditorView"] - | components["schemas"]["IManifestTreeItemAction"] - | components["schemas"]["IManifestPropertyEditorUI"] - | components["schemas"]["IManifestDashboard"] - | components["schemas"]["IManifestPropertyAction"] - | components["schemas"]["IManifestPackageView"] - | components["schemas"]["IManifestEntrypoint"] - | components["schemas"]["IManifestCustom"]; ManifestsResponse: { - manifests: components["schemas"]["Manifest"][]; + manifests: { [key: string]: unknown }[]; }; PackageInstalled: { id: string; @@ -382,31 +145,6 @@ export interface components { ManifestsPackagesInstalledResponse: { packages: components["schemas"]["PackageInstalled"][]; }; - PropertyEditor: { - alias: string; - name: string; - icon: string; - group?: string; - isSystem: boolean; - hasConfig: boolean; - config?: components["schemas"]["PropertyEditorConfig"]; - }; - PropertyEditorsListResponse: { - propertyEditors: components["schemas"]["PropertyEditor"][]; - }; - PropertyEditorResponse: { - alias: string; - name: string; - icon: string; - group?: string; - isSystem: boolean; - hasConfig: boolean; - config?: components["schemas"]["PropertyEditorConfig"]; - }; - PropertyEditorConfigResponse: { - properties: components["schemas"]["PropertyEditorConfigProperty"][]; - defaultData?: components["schemas"]["PropertyEditorConfigDefaultData"][]; - }; /** @enum {string} */ ServerStatus: "running" | "must-install" | "must-upgrade"; StatusResponse: { @@ -541,64 +279,6 @@ export interface operations { }; }; }; - PropertyEditorsListEndpoint: { - responses: { - /** 200 response */ - 200: { - content: { - "application/json": components["schemas"]["PropertyEditorsListResponse"]; - }; - }; - /** default response */ - default: { - content: { - "application/json": components["schemas"]["ProblemDetails"]; - }; - }; - }; - }; - PropertyEditorEndpoint: { - parameters: { - path: { - propertyEditorAlias: string; - }; - }; - responses: { - /** 200 response */ - 200: { - content: { - "application/json": components["schemas"]["PropertyEditorResponse"]; - }; - }; - /** default response */ - default: { - content: { - "application/json": components["schemas"]["ProblemDetails"]; - }; - }; - }; - }; - PropertyEditorConfigEndpoint: { - parameters: { - path: { - propertyEditorAlias: string; - }; - }; - responses: { - /** 200 response */ - 200: { - content: { - "application/json": components["schemas"]["PropertyEditorConfigResponse"]; - }; - }; - /** default response */ - default: { - content: { - "application/json": components["schemas"]["ProblemDetails"]; - }; - }; - }; - }; PublishedCacheStatus: { responses: { /** 200 response */ diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts index 2408bac27e..71d3048e1a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/backoffice.element.ts @@ -24,11 +24,10 @@ import { UmbNodeStore } from '../core/stores/node.store'; import { UmbSectionStore } from '../core/stores/section.store'; import { UmbEntityStore } from '../core/stores/entity.store'; import { UmbUserStore } from '../core/stores/user/user.store'; -import { UmbPropertyEditorStore } from '../core/stores/property-editor/property-editor.store'; import { UmbIconStore } from '../core/stores/icon/icon.store'; -import { UmbPropertyEditorConfigStore } from '../core/stores/property-editor-config/property-editor-config.store'; import { UmbUserGroupStore } from '../core/stores/user/user-group.store'; import { manifests as sectionManifests } from './sections/manifests'; +import { manifests as propertyEditorModelManifests } from './property-editor-models/manifests'; import { manifests as propertyEditorUIManifests } from './property-editor-uis/manifests'; import { manifests as treeManifests } from './trees/manifests'; import { manifests as editorManifests } from './editors/manifests'; @@ -63,6 +62,7 @@ export class UmbBackofficeElement extends UmbContextConsumerMixin(UmbContextProv this._registerExtensions(sectionManifests); this._registerExtensions(treeManifests); this._registerExtensions(editorManifests); + this._registerExtensions(propertyEditorModelManifests); this._registerExtensions(propertyEditorUIManifests); this._registerExtensions(propertyActionManifests); @@ -74,8 +74,6 @@ export class UmbBackofficeElement extends UmbContextConsumerMixin(UmbContextProv this.provideContext('umbDocumentTypeStore', new UmbDocumentTypeStore(this._umbEntityStore)); this.provideContext('umbUserStore', new UmbUserStore(this._umbEntityStore)); this.provideContext('umbUserGroupStore', new UmbUserGroupStore(this._umbEntityStore)); - this.provideContext('umbPropertyEditorStore', new UmbPropertyEditorStore()); - this.provideContext('umbPropertyEditorConfigStore', new UmbPropertyEditorConfigStore()); this.provideContext('umbNotificationService', new UmbNotificationService()); this.provideContext('umbModalService', new UmbModalService()); this.provideContext('umbSectionStore', new UmbSectionStore()); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-models/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-models/manifests.ts new file mode 100644 index 0000000000..20e829ebab --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-models/manifests.ts @@ -0,0 +1,254 @@ +import type { ManifestPropertyEditorModel } from '@umbraco-cms/models'; + +export const manifests: Array = [ + { + type: 'propertyEditorModel', + name: 'Color Picker', + alias: 'Umbraco.ColorPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Content Picker', + alias: 'Umbraco.ContentPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Eye Dropper Color Picker', + alias: 'Umbraco.ColorPicker.EyeDropper', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Form Picker', + alias: 'UmbracoForms.FormPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Form Theme Picker', + alias: 'UmbracoForms.ThemePicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Multi URL Picker', + alias: 'Umbraco.MultiUrlPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Multinode Treepicker', + alias: 'Umbraco.MultiNodeTreePicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Date/Time', + alias: 'Umbraco.DateTime', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Decimal', + alias: 'Umbraco.Decimal', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Email address', + alias: 'Umbraco.EmailAddress', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Label', + alias: 'Umbraco.Label', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Numeric', + alias: 'Umbraco.Integer', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Slider', + alias: 'Umbraco.Slider', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Tags', + alias: 'Umbraco.Tags', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Textarea', + alias: 'Umbraco.TextArea', + meta: { + config: { + properties: [ + { + alias: 'maxChars', + label: 'Maximum allowed characters', + description: 'If empty - no character limit', + propertyEditorUI: 'Umb.PropertyEditorUI.Number', + }, + ], + }, + }, + }, + { + type: 'propertyEditorModel', + name: 'Textbox', + alias: 'Umbraco.TextBox', + meta: { + config: { + properties: [ + { + alias: 'maxChars', + label: 'Maximum allowed characters', + description: 'If empty, 512 character limit', + propertyEditorUI: 'Umb.PropertyEditorUI.Number', + }, + ], + defaultData: [ + { + alias: 'maxChars', + value: 512, + }, + ], + }, + }, + }, + { + type: 'propertyEditorModel', + name: 'Toggle', + alias: 'Umbraco.TrueFalse', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Grid layout', + alias: 'Umbraco.Grid', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Markdown editor', + alias: 'Umbraco.MarkdownEditor', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Rich Text Editor', + alias: 'Umbraco.TinyMCE', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Member Group Picker', + alias: 'Umbraco.MemberGroupPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Member Picker', + alias: 'Umbraco.MemberPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'User Picker', + alias: 'Umbraco.UserPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Block Grid', + alias: 'Umbraco.BlockGrid', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Block List', + alias: 'Umbraco.BlockList', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Checkbox list', + alias: 'Umbraco.CheckBoxList', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Dropdown', + alias: 'Umbraco.DropDown.Flexible', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'List view', + alias: 'Umbraco.ListView', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Nested Content', + alias: 'Umbraco.NestedContent', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Radio button list', + alias: 'Umbraco.RadioButtonList', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Repeatable textstrings', + alias: 'Umbraco.MultipleTextstring', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'File upload', + alias: 'Umbraco.UploadField', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Image Cropper', + alias: 'Umbraco.ImageCropper', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Media Picker', + alias: 'Umbraco.MediaPicker3', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Media Picker (legacy)', + alias: 'Umbraco.MediaPicker', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Custom Property Editor', + alias: 'Umbraco.Custom', + meta: {}, + }, + { + type: 'propertyEditorModel', + name: 'Icon Picker', + alias: 'Umbraco.IconPicker', + meta: {}, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-uis/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-uis/manifests.ts index 53ff3636c4..e47005af0f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-uis/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/property-editor-uis/manifests.ts @@ -10,7 +10,7 @@ export const manifests: Array> = [ label: 'Block List', icon: 'umb:thumbnail-list', group: 'Lists', - propertyEditor: 'Umbraco.BlockList', + propertyEditorModel: 'Umbraco.BlockList', }, }, { @@ -22,7 +22,7 @@ export const manifests: Array> = [ label: 'Toggle', icon: 'umb:checkbox', group: 'Common', - propertyEditor: 'Umbraco.TrueFalse', + propertyEditorModel: 'Umbraco.TrueFalse', }, }, { @@ -34,7 +34,7 @@ export const manifests: Array> = [ label: 'Checkbox List', icon: 'umb:bulleted-list', group: 'Lists', - propertyEditor: 'Umbraco.CheckBoxList', + propertyEditorModel: 'Umbraco.CheckBoxList', }, }, { @@ -46,7 +46,7 @@ export const manifests: Array> = [ label: 'Text', icon: 'umb:edit', group: 'Common', - propertyEditor: 'Umbraco.TextBox', + propertyEditorModel: 'Umbraco.TextBox', }, }, { @@ -58,7 +58,7 @@ export const manifests: Array> = [ label: 'Textarea', icon: 'umb:edit', group: 'Common', - propertyEditor: 'Umbraco.TextArea', + propertyEditorModel: 'Umbraco.TextArea', config: { properties: [ { @@ -80,7 +80,7 @@ export const manifests: Array> = [ label: 'Number', icon: 'umb:autofill', group: 'Common', - propertyEditor: 'Umbraco.Integer', + propertyEditorModel: 'Umbraco.Integer', }, }, { @@ -90,7 +90,7 @@ export const manifests: Array> = [ loader: () => import('./content-picker/property-editor-ui-content-picker.element'), meta: { label: 'Content Picker', - propertyEditor: 'Umbraco.ContentPicker', + propertyEditorModel: 'Umbraco.ContentPicker', icon: 'umb:document', group: 'Common', }, @@ -102,7 +102,7 @@ export const manifests: Array> = [ loader: () => import('./icon-picker/property-editor-ui-icon-picker.element'), meta: { label: 'Icon Picker', - propertyEditor: 'Umbraco.IconPicker', + propertyEditorModel: 'Umbraco.IconPicker', icon: 'umb:document', group: 'Common', }, diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts index 2934e36a4b..25a8c2b02d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts @@ -25,16 +25,6 @@ export const getConsentLevels = fetcher.path('/telemetry/ConsentLevels').method( export const getConsentLevel = fetcher.path('/telemetry/ConsentLevel').method('get').create(); export const postConsentLevel = fetcher.path('/telemetry/ConsentLevel').method('post').create(); -// Property Editors -export const getPropertyEditorsList = fetcher.path('/property-editors/list').method('get').create(); -export const getPropertyEditor = fetcher - .path('/property-editors/property-editor/{propertyEditorAlias}') - .method('get') - .create(); -export const getPropertyEditorConfig = fetcher - .path('/property-editors/property-editor/config/{propertyEditorAlias}') - .method('get') - .create(); export const getPublishedCacheStatus = fetcher.path('/published-cache/status').method('get').create(); export const postPublishedCacheReload = fetcher.path('/published-cache/reload').method('post').create(); export const postPublishedCacheRebuild = fetcher.path('/published-cache/rebuild').method('post').create(); diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/dashboard.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/dashboard.models.ts new file mode 100644 index 0000000000..70bb0d379d --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/dashboard.models.ts @@ -0,0 +1,12 @@ +import type { ManifestElement } from './models'; + +export interface ManifestDashboard extends ManifestElement { + type: 'dashboard'; + meta: MetaDashboard; +} + +export interface MetaDashboard { + sections: string[]; + pathname: string; + label?: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-action.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-action.models.ts new file mode 100644 index 0000000000..0a08f005d8 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-action.models.ts @@ -0,0 +1,10 @@ +import type { ManifestElement } from './models'; + +export interface ManifestEditorAction extends ManifestElement { + type: 'editorAction'; + meta: MetaEditorAction; +} + +export interface MetaEditorAction { + editors: Array; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-view.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-view.models.ts new file mode 100644 index 0000000000..74ebe2623f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor-view.models.ts @@ -0,0 +1,13 @@ +import type { ManifestElement } from './models'; + +export interface ManifestEditorView extends ManifestElement { + type: 'editorView'; + meta: MetaEditorView; +} + +export interface MetaEditorView { + editors: string[]; + pathname: string; + label: string; + icon: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor.models.ts new file mode 100644 index 0000000000..a3ed4348d7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/editor.models.ts @@ -0,0 +1,10 @@ +import type { ManifestElement } from './models'; + +export interface ManifestEditor extends ManifestElement { + type: 'editor'; + meta: MetaEditor; +} + +export interface MetaEditor { + entityType: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/index.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/index.ts index b43231f612..2d31a26ce3 100644 --- a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/index.ts @@ -1,3 +1,4 @@ import { UmbExtensionRegistry } from '@umbraco-cms/extensions-api'; +export * from './models'; export const umbExtensionsRegistry = new UmbExtensionRegistry(); diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/models.ts new file mode 100644 index 0000000000..204e6746bb --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/models.ts @@ -0,0 +1,91 @@ +import type { ManifestSection } from './section.models'; +import type { ManifestSectionView } from './section-view.models'; +import type { ManifestTree } from './tree.models'; +import type { ManifestTreeItemAction } from './tree-item-action.models'; +import type { ManifestEditor } from './editor.models'; +import type { ManifestEditorAction } from './editor-action.models'; +import type { ManifestEditorView } from './editor-view.models'; +import type { ManifestPropertyEditorUI, ManifestPropertyEditorModel } from './property-editor.models'; +import type { ManifestDashboard } from './dashboard.models'; +import type { ManifestPropertyAction } from './property-action.models'; +import type { ManifestPackageView } from './package-view.models'; + +export * from './section.models'; +export * from './section-view.models'; +export * from './tree.models'; +export * from './tree-item-action.models'; +export * from './editor.models'; +export * from './editor-action.models'; +export * from './editor-view.models'; +export * from './property-editor.models'; +export * from './dashboard.models'; +export * from './property-action.models'; +export * from './package-view.models'; + +export type Manifest = + | ManifestSection + | ManifestSectionView + | ManifestTree + | ManifestEditor + | ManifestEditorAction + | ManifestEditorView + | ManifestTreeItemAction + | ManifestPropertyEditorUI + | ManifestPropertyEditorModel + | ManifestDashboard + | ManifestPropertyAction + | ManifestPackageView + | ManifestEntrypoint + | ManifestCustom; + +export type ManifestStandardTypes = + | 'section' + | 'sectionView' + | 'tree' + | 'editor' + | 'editorView' + | 'editorAction' + | 'treeItemAction' + | 'propertyEditorUI' + | 'propertyEditorModel' + | 'dashboard' + | 'propertyAction' + | 'packageView' + | 'entrypoint'; + +export type ManifestElementType = + | ManifestSection + | ManifestSectionView + | ManifestTree + | ManifestTreeItemAction + | ManifestEditor + | ManifestPropertyAction + | ManifestPropertyEditorUI + | ManifestDashboard + | ManifestEditorView + | ManifestEditorAction + | ManifestPackageView; + +export interface ManifestBase { + type: string; + alias: string; + name: string; + weight?: number; +} + +export interface ManifestElement extends ManifestBase { + type: ManifestStandardTypes; + js?: string; + elementName?: string; + meta?: any; +} + +export interface ManifestCustom extends ManifestBase { + type: 'custom'; + meta?: any; +} + +export interface ManifestEntrypoint extends ManifestBase { + type: 'entrypoint'; + js: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/package-view.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/package-view.models.ts new file mode 100644 index 0000000000..bff9d21a0c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/package-view.models.ts @@ -0,0 +1,10 @@ +import type { ManifestElement } from './models'; + +export interface ManifestPackageView extends ManifestElement { + type: 'packageView'; + meta: MetaPackageView; +} + +export interface MetaPackageView { + packageAlias: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-action.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-action.models.ts new file mode 100644 index 0000000000..640849b9d7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-action.models.ts @@ -0,0 +1,10 @@ +import type { ManifestElement } from './models'; + +export interface ManifestPropertyAction extends ManifestElement { + type: 'propertyAction'; + meta: MetaPropertyAction; +} + +export interface MetaPropertyAction { + propertyEditors: string[]; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-editor.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-editor.models.ts new file mode 100644 index 0000000000..1b735a9a31 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/property-editor.models.ts @@ -0,0 +1,43 @@ +import type { ManifestElement, ManifestBase } from './models'; + +// UI +export interface ManifestPropertyEditorUI extends ManifestElement { + type: 'propertyEditorUI'; + meta: MetaPropertyEditorUI; +} + +export interface MetaPropertyEditorUI { + label: string; + propertyEditorModel: string; + icon: string; + group: string; + config?: PropertyEditorConfig; +} + +// Model +export interface ManifestPropertyEditorModel extends ManifestBase { + type: 'propertyEditorModel'; + meta: MetaPropertyEditorModel; +} + +export interface MetaPropertyEditorModel { + config?: PropertyEditorConfig; +} + +// Config +export interface PropertyEditorConfig { + properties: PropertyEditorConfigProperty[]; + defaultData?: PropertyEditorConfigDefaultData[]; +} + +export interface PropertyEditorConfigProperty { + label: string; + description?: string; + alias: string; + propertyEditorUI: string; +} + +export interface PropertyEditorConfigDefaultData { + alias: string; + value: any; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/section-view.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/section-view.models.ts new file mode 100644 index 0000000000..37c59c90ba --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/section-view.models.ts @@ -0,0 +1,14 @@ +import type { ManifestElement } from './models'; + +export interface ManifestSectionView extends ManifestElement { + type: 'sectionView'; + meta: MetaSectionView; +} + +export interface MetaSectionView { + sections: Array; + label: string; + pathname: string; + weight: number; + icon: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/section.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/section.models.ts new file mode 100644 index 0000000000..adeb16d83f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/section.models.ts @@ -0,0 +1,11 @@ +import type { ManifestElement } from './models'; + +export interface ManifestSection extends ManifestElement { + type: 'section'; + meta: MetaSection; +} + +export interface MetaSection { + label: string; + pathname: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree-item-action.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree-item-action.models.ts new file mode 100644 index 0000000000..caf27c42d7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree-item-action.models.ts @@ -0,0 +1,12 @@ +import type { ManifestElement } from './models'; + +export interface ManifestTreeItemAction extends ManifestElement { + type: 'treeItemAction'; + meta: MetaTreeItemAction; +} + +export interface MetaTreeItemAction { + trees: Array; + label: string; + icon: string; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree.models.ts b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree.models.ts new file mode 100644 index 0000000000..f8bbd44541 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/extensions-registry/tree.models.ts @@ -0,0 +1,10 @@ +import type { ManifestElement } from './models'; + +export interface ManifestTree extends ManifestElement { + type: 'tree'; + meta: MetaTree; +} + +export interface MetaTree { + sections: Array; +} diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/browser-handlers.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/browser-handlers.ts index 04345b3989..9bc24774cf 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/browser-handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/browser-handlers.ts @@ -9,7 +9,6 @@ import * as serverHandlers from './domains/server.handlers'; import { handlers as upgradeHandlers } from './domains/upgrade.handlers'; import { handlers as userHandlers } from './domains/user.handlers'; import { handlers as telemetryHandlers } from './domains/telemetry.handlers'; -import { handlers as propertyEditorHandlers } from './domains/property-editor.handlers'; import { handlers as usersHandlers } from './domains/users.handlers'; import { handlers as userGroupsHandlers } from './domains/user-groups.handlers'; @@ -22,7 +21,6 @@ const handlers = [ ...dataTypeHandlers, ...documentTypeHandlers, ...treeHandlers, - ...propertyEditorHandlers, ...manifestsHandlers.default, ...telemetryHandlers, ...publishedStatusHandlers, diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/data/property-editor.data.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/data/property-editor.data.ts deleted file mode 100644 index bae4662279..0000000000 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/data/property-editor.data.ts +++ /dev/null @@ -1,363 +0,0 @@ -import { cloneDeep } from 'lodash'; -import { UmbData } from './data'; -import type { PropertyEditor } from '@umbraco-cms/models'; - -export const data: Array = [ - { - isSystem: false, - group: 'Pickers', - hasConfig: true, - name: 'Color Picker', - icon: 'umb:colorpicker', - alias: 'Umbraco.ColorPicker', - }, - { - isSystem: false, - group: 'Pickers', - hasConfig: true, - name: 'Content Picker', - icon: 'umb:autofill', - alias: 'Umbraco.ContentPicker', - }, - { - isSystem: false, - group: 'Pickers', - hasConfig: true, - name: 'Eye Dropper Color Picker', - icon: 'umb:colorpicker', - alias: 'Umbraco.ColorPicker.EyeDropper', - }, - { - isSystem: false, - group: 'Pickers', - hasConfig: true, - name: 'Form Picker', - icon: 'umb:umb-contour', - alias: 'UmbracoForms.FormPicker', - }, - { - isSystem: false, - group: 'Pickers', - hasConfig: false, - name: 'Form Theme Picker', - icon: 'umb:brush', - alias: 'UmbracoForms.ThemePicker', - }, - { - isSystem: false, - group: 'Pickers', - hasConfig: true, - name: 'Multi URL Picker', - icon: 'umb:link', - alias: 'Umbraco.MultiUrlPicker', - }, - { - isSystem: false, - group: 'Pickers', - hasConfig: true, - name: 'Multinode Treepicker', - icon: 'umb:page-add', - alias: 'Umbraco.MultiNodeTreePicker', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Date/Time', - icon: 'umb:time', - alias: 'Umbraco.DateTime', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Decimal', - icon: 'umb:autofill', - alias: 'Umbraco.Decimal', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Email address', - icon: 'umb:message', - alias: 'Umbraco.EmailAddress', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Label', - icon: 'umb:readonly', - alias: 'Umbraco.Label', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Numeric', - icon: 'umb:autofill', - alias: 'Umbraco.Integer', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Open Street Map', - icon: 'umb:map-location', - alias: 'Bergmania.OpenStreetMap', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Slider', - icon: 'umb:navigation-horizontal', - alias: 'Umbraco.Slider', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Tags', - icon: 'umb:tags', - alias: 'Umbraco.Tags', - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Textarea', - icon: 'umb:application-window-alt', - alias: 'Umbraco.TextArea', - config: { - properties: [ - { - alias: 'maxChars', - label: 'Maximum allowed characters', - description: 'If empty - no character limit', - propertyEditorUI: 'Umb.PropertyEditorUI.Number', - }, - ], - }, - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Textbox', - icon: 'umb:autofill', - alias: 'Umbraco.TextBox', - config: { - properties: [ - { - alias: 'maxChars', - label: 'Maximum allowed characters', - description: 'If empty, 512 character limit', - propertyEditorUI: 'Umb.PropertyEditorUI.Number', - }, - ], - defaultData: [ - { - alias: 'maxChars', - value: 512, - }, - ], - }, - }, - { - isSystem: false, - group: 'Common', - hasConfig: true, - name: 'Toggle', - icon: 'umb:checkbox', - alias: 'Umbraco.TrueFalse', - }, - { - isSystem: false, - group: 'Rich Content', - hasConfig: true, - name: 'Grid layout', - icon: 'umb:layout', - alias: 'Umbraco.Grid', - }, - { - isSystem: false, - group: 'Rich Content', - hasConfig: true, - name: 'Markdown editor', - icon: 'umb:code', - alias: 'Umbraco.MarkdownEditor', - }, - { - isSystem: false, - group: 'Rich Content', - hasConfig: true, - name: 'Rich Text Editor', - icon: 'umb:browser-window', - alias: 'Umbraco.TinyMCE', - }, - { - isSystem: false, - group: 'People', - hasConfig: false, - name: 'Member Group Picker', - icon: 'umb:users-alt', - alias: 'Umbraco.MemberGroupPicker', - }, - { - isSystem: false, - group: 'People', - hasConfig: false, - name: 'Member Picker', - icon: 'umb:user', - alias: 'Umbraco.MemberPicker', - }, - { - isSystem: false, - group: 'People', - hasConfig: false, - name: 'User Picker', - icon: 'umb:user', - alias: 'Umbraco.UserPicker', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Block Grid', - icon: 'umb:thumbnail-list', - alias: 'Umbraco.BlockGrid', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Block List', - icon: 'umb:thumbnail-list', - alias: 'Umbraco.BlockList', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Checkbox list', - icon: 'umb:bulleted-list', - alias: 'Umbraco.CheckBoxList', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Dropdown', - icon: 'umb:indent', - alias: 'Umbraco.DropDown.Flexible', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'List view', - icon: 'umb:thumbnail-list', - alias: 'Umbraco.ListView', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Nested Content', - icon: 'umb:thumbnail-list', - alias: 'Umbraco.NestedContent', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Radio button list', - icon: 'umb:target', - alias: 'Umbraco.RadioButtonList', - }, - { - isSystem: false, - group: 'Lists', - hasConfig: true, - name: 'Repeatable textstrings', - icon: 'umb:ordered-list', - alias: 'Umbraco.MultipleTextstring', - }, - { - isSystem: false, - group: 'Media', - hasConfig: true, - name: 'File upload', - icon: 'umb:download-alt', - alias: 'Umbraco.UploadField', - }, - { - isSystem: false, - group: 'Media', - hasConfig: true, - name: 'Image Cropper', - icon: 'umb:crop', - alias: 'Umbraco.ImageCropper', - }, - { - isSystem: false, - group: 'Media', - hasConfig: true, - name: 'Media Picker', - icon: 'umb:picture', - alias: 'Umbraco.MediaPicker3', - }, - { - isSystem: false, - group: 'Media', - hasConfig: true, - name: 'Media Picker (legacy)', - icon: 'umb:picture', - alias: 'Umbraco.MediaPicker', - }, - { - isSystem: false, - group: 'Custom', - hasConfig: true, - name: 'Custom Property Editor', - icon: 'umb:autofill', - alias: 'Umbraco.Custom', - }, - { - isSystem: false, - group: 'Custom', - hasConfig: true, - name: 'Icon Picker', - icon: 'umb:autofill', - alias: 'Umbraco.IconPicker', - }, -]; - -// Temp mocked database -class UmbPropertyEditorData extends UmbData { - constructor() { - super(data); - } - - getAll() { - const clonedEditors = cloneDeep(this.data); - clonedEditors.forEach((editor) => delete editor.config); - return clonedEditors; - } - - getByAlias(alias: string) { - const editor = this.data.find((e) => e.alias === alias); - const clone = cloneDeep(editor); - delete clone?.config; - return clone; - } - - getConfig(alias: string) { - const editor = this.data.find((e) => e.alias === alias); - return editor?.config ?? undefined; - } -} - -export const umbPropertyEditorData = new UmbPropertyEditorData(); diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/domains/property-editor.handlers.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/domains/property-editor.handlers.ts deleted file mode 100644 index 4800c98cea..0000000000 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/domains/property-editor.handlers.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { rest } from 'msw'; -import { umbPropertyEditorData } from '../data/property-editor.data'; -import { umbracoPath } from '@umbraco-cms/utils'; -import type { - PropertyEditorsListResponse, - PropertyEditorResponse, - PropertyEditorConfigResponse, -} from '@umbraco-cms/models'; - -// TODO: add schema -export const handlers = [ - rest.get(umbracoPath('/property-editors/list'), (req, res, ctx) => { - const propertyEditors = umbPropertyEditorData.getAll(); - - const response = { - propertyEditors, - }; - - return res(ctx.status(200), ctx.json(response)); - }), - - rest.get('/umbraco/backoffice/property-editors/property-editor/:alias', (req, res, ctx) => { - const alias = req.params.alias as string; - if (!alias) return; - - const propertyEditor = umbPropertyEditorData.getByAlias(alias); - if (propertyEditor) { - return res(ctx.status(200), ctx.json(propertyEditor)); - } else { - return res(ctx.status(404)); - } - }), - - rest.get('/umbraco/backoffice/property-editors/property-editor/config/:alias', (req, res, ctx) => { - const alias = req.params.alias as string; - if (!alias) return; - - const config = umbPropertyEditorData.getConfig(alias); - if (!config) return; - - return res(ctx.status(200), ctx.json(config)); - }), -]; diff --git a/src/Umbraco.Web.UI.Client/src/core/models/index.ts b/src/Umbraco.Web.UI.Client/src/core/models/index.ts index 36b69dfa4c..cc5eebb3d0 100644 --- a/src/Umbraco.Web.UI.Client/src/core/models/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/models/index.ts @@ -19,44 +19,11 @@ export type UmbracoInstallerDatabaseModel = components['schemas']['InstallDataba export type UmbracoInstallerUserModel = components['schemas']['InstallUserModel']; export type TelemetryModel = components['schemas']['TelemetryModel']; export type ServerStatus = components['schemas']['ServerStatus']; -export type ManifestTypes = components['schemas']['Manifest']; -export type ManifestSection = components['schemas']['IManifestSection']; -export type ManifestSectionView = components['schemas']['IManifestSectionView']; -export type ManifestTree = components['schemas']['IManifestTree']; -export type ManifestTreeItemAction = components['schemas']['IManifestTreeItemAction']; -export type ManifestEditor = components['schemas']['IManifestEditor']; -export type ManifestEditorAction = components['schemas']['IManifestEditorAction']; -export type ManifestPropertyEditorUI = components['schemas']['IManifestPropertyEditorUI']; -export type ManifestDashboard = components['schemas']['IManifestDashboard']; -export type ManifestEditorView = components['schemas']['IManifestEditorView']; -export type ManifestPropertyAction = components['schemas']['IManifestPropertyAction']; -export type ManifestEntrypoint = components['schemas']['IManifestEntrypoint']; -export type ManifestCustom = components['schemas']['IManifestCustom']; -export type ManifestPackageView = components['schemas']['IManifestPackageView']; export type PackageInstalled = components['schemas']['PackageInstalled']; export type ConsentLevelSettings = components['schemas']['ConsentLevelSettings']; -// Property Editors -export type PropertyEditorsListResponse = components['schemas']['PropertyEditorsListResponse']; -export type PropertyEditorResponse = components['schemas']['PropertyEditorResponse']; -export type PropertyEditorConfigResponse = components['schemas']['PropertyEditorConfigResponse']; -export type PropertyEditorConfig = components['schemas']['PropertyEditorConfig']; -export type PropertyEditor = components['schemas']['PropertyEditor']; -export type PropertyEditorConfigProperty = components['schemas']['PropertyEditorConfigProperty']; -export type PropertyEditorConfigDefaultData = components['schemas']['PropertyEditorConfigDefaultData']; - -export type ManifestElementType = - | ManifestSection - | ManifestSectionView - | ManifestTree - | ManifestTreeItemAction - | ManifestEditor - | ManifestPropertyAction - | ManifestPropertyEditorUI - | ManifestDashboard - | ManifestEditorView - | ManifestEditorAction - | ManifestPackageView; +// Extension Manifests +export * from '../extensions-registry/models'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type HTMLElementConstructor = new (...args: any[]) => T; diff --git a/src/Umbraco.Web.UI.Client/src/core/stores/property-editor-config/property-editor-config.store.ts b/src/Umbraco.Web.UI.Client/src/core/stores/property-editor-config/property-editor-config.store.ts deleted file mode 100644 index f3b47fa2c7..0000000000 --- a/src/Umbraco.Web.UI.Client/src/core/stores/property-editor-config/property-editor-config.store.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { map, Observable } from 'rxjs'; -import { getPropertyEditorConfig } from '../../backend-api/fetcher'; -import type { PropertyEditorConfig } from '../../models'; -import { UmbDataStoreBase } from '../store'; - -export interface PropertyEditorConfigRef { - propertyEditorAlias: string; - config: PropertyEditorConfig; -} - -/** - * @export - * @class UmbPropertyEditorConfigStore - * @extends {UmbDataStoreBase} - * @description - Data Store for Property Editor Configs - */ -export class UmbPropertyEditorConfigStore extends UmbDataStoreBase { - /** - * - * @description - Request a Property Editor Config by alias. The Property Editor Config is added to the store and is returned as an Observable. - * @param {string} alias - * @return {*} {(Observable)} - * @memberof UmbPropertyEditorConfigStore - */ - getByAlias(alias: string): Observable { - // TODO: only fetch if the data type is not in the store? - getPropertyEditorConfig({ propertyEditorAlias: alias }) - .then((res) => { - const propertyEditorConfigRef: PropertyEditorConfigRef = { propertyEditorAlias: alias, config: res.data }; - this.update([propertyEditorConfigRef], 'propertyEditorAlias'); - }) - .catch((err) => { - console.log(err); - }); - - return this.items.pipe(map((items) => items.find((item) => item.propertyEditorAlias === alias))); - } -} diff --git a/src/Umbraco.Web.UI.Client/src/core/stores/property-editor/property-editor.store.ts b/src/Umbraco.Web.UI.Client/src/core/stores/property-editor/property-editor.store.ts deleted file mode 100644 index 13b4c83120..0000000000 --- a/src/Umbraco.Web.UI.Client/src/core/stores/property-editor/property-editor.store.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { map, Observable } from 'rxjs'; -import type { PropertyEditor } from '../../models'; -import { getPropertyEditorsList, getPropertyEditor } from '../../backend-api/fetcher'; -import { UmbDataStoreBase } from '../store'; - -/** - * @export - * @class UmbPropertyEditorStore - * @extends {UmbDataStoreBase} - * @description - Data Store for Property Editors - */ -export class UmbPropertyEditorStore extends UmbDataStoreBase { - /** - * @description - Request all Property Editors. The Property Editors are added to the store and are returned as an Observable. - * @return {*} {(Observable | []>)} - * @memberof UmbPropertyEditorStore - */ - getAll(): Observable | []> { - // TODO: only fetch if the data type is not in the store? - getPropertyEditorsList({}) - .then((res) => { - this.update(res.data.propertyEditors, 'alias'); - }) - .catch((err) => { - console.log(err); - }); - - return this.items; - } - - /** - * Request a Property Editor by alias. The Property Editor is added to the store and is returned as an Observable. - * @param {string} alias - * @return {*} {(Observable)} - * @memberof UmbPropertyEditorStore - */ - getByAlias(alias: string): Observable { - // TODO: only fetch if the data type is not in the store? - getPropertyEditor({ propertyEditorAlias: alias }) - .then((res) => { - this.update([res.data], 'alias'); - }) - .catch((err) => { - console.log(err); - }); - - return this.items.pipe(map((items) => items.find((item) => item.alias === alias))); - } -} diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts index 7a52baaf5d..cc371a562a 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts @@ -5,7 +5,6 @@ import './server'; import './upgrader'; import './user'; import './telemetry'; -import './property-editors'; import { api } from '@airtasker/spot'; diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts index 45bd15f3b5..437a4d1950 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts @@ -1,7 +1,5 @@ import { body, defaultResponse, endpoint, response } from '@airtasker/spot'; - import { ProblemDetails } from './models'; -import { PropertyEditorConfig } from './property-editors'; @endpoint({ method: 'GET', path: '/manifests' }) export class Manifests { @@ -30,37 +28,8 @@ export class ManifestsPackagesInstalled { default(@body body: ProblemDetails) {} } -export type Manifest = - | IManifestSection - | IManifestSectionView - | IManifestTree - | IManifestEditor - | IManifestEditorAction - | IManifestEditorView - | IManifestTreeItemAction - | IManifestPropertyEditorUI - | IManifestDashboard - | IManifestPropertyAction - | IManifestPackageView - | IManifestEntrypoint - | IManifestCustom; - -export type ManifestStandardTypes = - | 'section' - | 'sectionView' - | 'tree' - | 'editor' - | 'editorView' - | 'editorAction' - | 'treeItemAction' - | 'propertyEditorUI' - | 'dashboard' - | 'propertyAction' - | 'packageView' - | 'entrypoint'; - export interface ManifestsResponse { - manifests: Manifest[]; + manifests: {}[]; } export interface ManifestsPackagesInstalledResponse { @@ -76,141 +45,3 @@ export interface PackageInstalled { hasPendingMigrations: boolean; plans: {}[]; } - -export interface IManifest { - type: string; - alias: string; - name: string; - weight?: number; -} - -export interface MetaSection { - label: string; - pathname: string; -} - -export interface MetaSectionView { - sections: Array; - label: string; - pathname: string; - weight: number; - icon: string; -} - -export interface MetaTree { - sections: Array; -} - -export interface MetaEditor { - entityType: string; -} - -export interface MetaTreeItemAction { - trees: Array; - label: string; - icon: string; -} -export interface MetaPropertyEditorUI { - label: string; - propertyEditor: string; - icon: string; - group: string; - config?: PropertyEditorConfig; -} - -export interface MetaDashboard { - sections: string[]; - pathname: string; - label?: string; -} - -export interface MetaEditorView { - editors: string[]; - pathname: string; - label: string; - icon: string; -} - -export interface MetaPropertyAction { - propertyEditors: string[]; -} - -export interface MetaPackageView { - packageAlias: string; -} - -export interface IManifestCustom extends IManifest { - type: 'custom'; - meta?: {}; -} - -export interface IManifestElement extends IManifest { - type: ManifestStandardTypes; - js?: string; - elementName?: string; - meta?: {}; -} - -export interface IManifestSection extends IManifestElement { - type: 'section'; - meta: MetaSection; -} - -export interface IManifestSectionView extends IManifestElement { - type: 'sectionView'; - meta: MetaSectionView; -} - -export interface IManifestEditorAction extends IManifestElement { - type: 'editorAction'; - meta: MetaEditorAction; -} - -export interface MetaEditorAction { - editors: Array; -} - -export interface IManifestTree extends IManifestElement { - type: 'tree'; - meta: MetaTree; -} - -export interface IManifestEditor extends IManifestElement { - type: 'editor'; - meta: MetaEditor; -} - -export interface IManifestTreeItemAction extends IManifestElement { - type: 'treeItemAction'; - meta: MetaTreeItemAction; -} - -export interface IManifestPropertyEditorUI extends IManifestElement { - type: 'propertyEditorUI'; - meta: MetaPropertyEditorUI; -} - -export interface IManifestDashboard extends IManifestElement { - type: 'dashboard'; - meta: MetaDashboard; -} - -export interface IManifestEditorView extends IManifestElement { - type: 'editorView'; - meta: MetaEditorView; -} - -export interface IManifestPropertyAction extends IManifestElement { - type: 'propertyAction'; - meta: MetaPropertyAction; -} - -export interface IManifestPackageView extends IManifestElement { - type: 'packageView'; - meta: MetaPackageView; -} - -export interface IManifestEntrypoint extends IManifest { - type: 'entrypoint'; - js: string; -} diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts deleted file mode 100644 index 2053c257e9..0000000000 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { body, defaultResponse, endpoint, response, request, pathParams, String } from '@airtasker/spot'; -import { ProblemDetails } from './models'; - -@endpoint({ method: 'GET', path: '/property-editors/list' }) -export class PropertyEditorsListEndpoint { - @response({ status: 200 }) - response(@body body: PropertyEditorsListResponse) {} - - @defaultResponse - default(@body body: ProblemDetails) {} -} - -@endpoint({ method: 'GET', path: '/property-editors/property-editor/:propertyEditorAlias' }) -export class PropertyEditorEndpoint { - @request - request( - @pathParams - pathParams: { - propertyEditorAlias: String; - } - ) {} - - @response({ status: 200 }) - response(@body body: PropertyEditorResponse) {} - - @defaultResponse - default(@body body: ProblemDetails) {} -} - -@endpoint({ method: 'GET', path: '/property-editors/property-editor/config/:propertyEditorAlias' }) -export class PropertyEditorConfigEndpoint { - @request - request( - @pathParams - pathParams: { - propertyEditorAlias: String; - } - ) {} - - @response({ status: 200 }) - response(@body body: PropertyEditorConfigResponse) {} - - @defaultResponse - default(@body body: ProblemDetails) {} -} - -export interface PropertyEditorsListResponse { - propertyEditors: PropertyEditor[]; -} - -export interface PropertyEditorResponse extends PropertyEditor {} - -export interface PropertyEditorConfigResponse extends PropertyEditorConfig {} - -export interface PropertyEditor { - alias: string; - name: string; - icon: string; - group?: string; - isSystem: boolean; - hasConfig: boolean; - config?: PropertyEditorConfig; -} - -export interface PropertyEditorConfig { - properties: PropertyEditorConfigProperty[]; - defaultData?: PropertyEditorConfigDefaultData[]; -} - -export interface PropertyEditorConfigProperty { - label: string; - description?: string; - alias: string; - propertyEditorUI: string; -} - -export interface PropertyEditorConfigDefaultData { - alias: string; - value: string | number | boolean | {} | string[] | number[] | boolean[] | {}[] | null; -}