mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Collections.Immutable;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
using NJsonSchema.Annotations;
|
|
using Squidex.Domain.Apps.Core.Schemas;
|
|
using Squidex.Infrastructure.Reflection;
|
|
|
|
namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
|
|
{
|
|
[JsonSchema("Number")]
|
|
public sealed class NumberFieldPropertiesDto : FieldPropertiesDto
|
|
{
|
|
/// <summary>
|
|
/// The default value for the field value.
|
|
/// </summary>
|
|
public double? DefaultValue { get; set; }
|
|
|
|
/// <summary>
|
|
/// The maximum allowed value for the field value.
|
|
/// </summary>
|
|
public double? MaxValue { get; set; }
|
|
|
|
/// <summary>
|
|
/// The minimum allowed value for the field value.
|
|
/// </summary>
|
|
public double? MinValue { get; set; }
|
|
|
|
/// <summary>
|
|
/// The allowed values for the field value.
|
|
/// </summary>
|
|
public double[] AllowedValues { get; set; }
|
|
|
|
/// <summary>
|
|
/// Indicates that the inline editor is enabled for this field.
|
|
/// </summary>
|
|
public bool InlineEditable { get; set; }
|
|
|
|
/// <summary>
|
|
/// The editor that is used to manage this field.
|
|
/// </summary>
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public NumberFieldEditor Editor { get; set; }
|
|
|
|
public override FieldProperties ToProperties()
|
|
{
|
|
var result = SimpleMapper.Map(this, new NumberFieldProperties());
|
|
|
|
if (AllowedValues != null)
|
|
{
|
|
result.AllowedValues = ImmutableList.Create(AllowedValues);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|