Merge remote-tracking branch 'origin/v8/dev' into netcore/dev
# Conflicts: # .gitignore # build/NuSpecs/tools/Web.config.install.xdt # src/Umbraco.Core/ContentExtensions.cs # src/Umbraco.Infrastructure/Intall/InstallHelper.cs # src/Umbraco.Infrastructure/Models/Blocks/BlockEditorModel.cs # src/Umbraco.Infrastructure/Models/Blocks/BlockItemData.cs # src/Umbraco.Infrastructure/Models/Blocks/BlockListLayoutReference.cs # src/Umbraco.Infrastructure/Models/Mapping/CommonMapper.cs # src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyEditor.cs # src/Umbraco.Infrastructure/PropertyEditors/BlockListConfigurationEditor.cs # src/Umbraco.Infrastructure/PropertyEditors/NestedContentPropertyEditor.cs # src/Umbraco.Tests/PropertyEditors/BlockListPropertyValueConverterTests.cs # src/Umbraco.Web.UI.Client/package-lock.json # src/Umbraco.Web/Compose/NestedContentPropertyComponent.cs
This commit is contained in:
130
src/Umbraco.Core/Models/Blocks/BlockListItem.cs
Normal file
130
src/Umbraco.Core/Models/Blocks/BlockListItem.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a layout item for the Block List editor.
|
||||
/// </summary>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
[DataContract(Name = "block", Namespace = "")]
|
||||
public class BlockListItem : IBlockReference<IPublishedElement>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings UDI.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <exception cref="System.ArgumentNullException">contentUdi
|
||||
/// or
|
||||
/// content</exception>
|
||||
public BlockListItem(Udi contentUdi, IPublishedElement content, Udi settingsUdi, IPublishedElement settings)
|
||||
{
|
||||
ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi));
|
||||
Content = content ?? throw new ArgumentNullException(nameof(content));
|
||||
SettingsUdi = settingsUdi;
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content UDI.
|
||||
/// </value>
|
||||
[DataMember(Name = "contentUdi")]
|
||||
public Udi ContentUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content.
|
||||
/// </value>
|
||||
[DataMember(Name = "content")]
|
||||
public IPublishedElement Content { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings UDI.
|
||||
/// </value>
|
||||
[DataMember(Name = "settingsUdi")]
|
||||
public Udi SettingsUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
[DataMember(Name = "settings")]
|
||||
public IPublishedElement Settings { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item with a generic content type for the Block List editor.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the content.</typeparam>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
public class BlockListItem<T> : BlockListItem
|
||||
where T : IPublishedElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings UDI.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
public BlockListItem(Udi contentUdi, T content, Udi settingsUdi, IPublishedElement settings)
|
||||
: base(contentUdi, content, settingsUdi, settings)
|
||||
{
|
||||
Content = content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content.
|
||||
/// </value>
|
||||
public new T Content { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item with generic content and settings types for the Block List editor.
|
||||
/// </summary>
|
||||
/// <typeparam name="TContent">The type of the content.</typeparam>
|
||||
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
public class BlockListItem<TContent, TSettings> : BlockListItem<TContent>
|
||||
where TContent : IPublishedElement
|
||||
where TSettings : IPublishedElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem{TContent, TSettings}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content udi.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings udi.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
public BlockListItem(Udi contentUdi, TContent content, Udi settingsUdi, TSettings settings)
|
||||
: base(contentUdi, content, settingsUdi, settings)
|
||||
{
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
public new TSettings Settings { get; }
|
||||
}
|
||||
}
|
||||
37
src/Umbraco.Core/Models/Blocks/IBlockReference.cs
Normal file
37
src/Umbraco.Core/Models/Blocks/IBlockReference.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace Umbraco.Core.Models.Blocks
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a data item reference for a Block Editor implementation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See: https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content UDI.
|
||||
/// </value>
|
||||
Udi ContentUdi { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data item reference with settings for a Block editor implementation.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
||||
/// <remarks>
|
||||
/// See: https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockReference<TSettings> : IBlockReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
TSettings Settings { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user