| | | 1 | | using System.Reflection; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Workflows.Models; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// A descriptor of an activity's input property. |
| | | 7 | | /// </summary> |
| | | 8 | | public class InputDescriptor : PropertyDescriptor |
| | | 9 | | { |
| | | 10 | | /// <inheritdoc /> |
| | 64 | 11 | | public InputDescriptor() |
| | | 12 | | { |
| | 64 | 13 | | } |
| | | 14 | | |
| | | 15 | | /// <inheritdoc /> |
| | 17337 | 16 | | public InputDescriptor( |
| | 17337 | 17 | | string name, |
| | 17337 | 18 | | Type type, |
| | 17337 | 19 | | Func<IActivity, object?> valueGetter, |
| | 17337 | 20 | | Action<IActivity, object?> valueSetter, |
| | 17337 | 21 | | bool isWrapped, |
| | 17337 | 22 | | string uiHint, |
| | 17337 | 23 | | string displayName, |
| | 17337 | 24 | | string? description = null, |
| | 17337 | 25 | | string? category = null, |
| | 17337 | 26 | | float order = 0, |
| | 17337 | 27 | | object? defaultValue = null, |
| | 17337 | 28 | | string? defaultSyntax = "Literal", |
| | 17337 | 29 | | bool isReadOnly = false, |
| | 17337 | 30 | | bool isBrowsable = true, |
| | 17337 | 31 | | bool isSerializable = true, |
| | 17337 | 32 | | bool isSynthetic = false, |
| | 17337 | 33 | | bool autoEvaluate = true, |
| | 17337 | 34 | | Type? evaluatorType = null, |
| | 17337 | 35 | | Type? storageDriverType = null, |
| | 17337 | 36 | | PropertyInfo? propertyInfo = null, |
| | 17337 | 37 | | IDictionary<string, object>? uiSpecifications = null |
| | 17337 | 38 | | ) |
| | | 39 | | { |
| | 17337 | 40 | | Name = name; |
| | 17337 | 41 | | Type = type; |
| | 17337 | 42 | | ValueGetter = valueGetter; |
| | 17337 | 43 | | ValueSetter = valueSetter; |
| | 17337 | 44 | | IsWrapped = isWrapped; |
| | 17337 | 45 | | UIHint = uiHint; |
| | 17337 | 46 | | DisplayName = displayName; |
| | 17337 | 47 | | Description = description; |
| | 17337 | 48 | | Category = category; |
| | 17337 | 49 | | Order = order; |
| | 17337 | 50 | | DefaultValue = defaultValue; |
| | 17337 | 51 | | DefaultSyntax = defaultSyntax; |
| | 17337 | 52 | | IsReadOnly = isReadOnly; |
| | 17337 | 53 | | AutoEvaluate = autoEvaluate; |
| | 17337 | 54 | | EvaluatorType = evaluatorType; |
| | 17337 | 55 | | StorageDriverType = storageDriverType; |
| | 17337 | 56 | | IsSynthetic = isSynthetic; |
| | 17337 | 57 | | IsBrowsable = isBrowsable; |
| | 17337 | 58 | | IsSerializable = isSerializable; |
| | 17337 | 59 | | PropertyInfo = propertyInfo; |
| | 17337 | 60 | | UISpecifications = uiSpecifications; |
| | 17337 | 61 | | } |
| | | 62 | | |
| | | 63 | | /// <summary> |
| | | 64 | | /// True if the property is wrapped with an <see cref="Input{T}"/> type, false otherwise. |
| | | 65 | | /// </summary> |
| | 39164 | 66 | | public bool IsWrapped { get; set; } |
| | | 67 | | |
| | | 68 | | /// <summary> |
| | | 69 | | /// A string value that hints at what UI control might be used to render in a UI tool. |
| | | 70 | | /// </summary> |
| | 33544 | 71 | | public string UIHint { get; set; } = null!; |
| | | 72 | | |
| | | 73 | | /// <summary> |
| | | 74 | | /// The category to which this input belongs. Can be used by UI to e.g. render different inputs in different tabs. |
| | | 75 | | /// </summary> |
| | 17401 | 76 | | public string? Category { get; set; } |
| | | 77 | | |
| | | 78 | | /// <summary> |
| | | 79 | | /// The default value. |
| | | 80 | | /// </summary> |
| | 22608 | 81 | | public object? DefaultValue { get; set; } |
| | | 82 | | |
| | | 83 | | /// <summary> |
| | | 84 | | /// The default syntax. |
| | | 85 | | /// </summary> |
| | 17337 | 86 | | public string? DefaultSyntax { get; set; } |
| | | 87 | | |
| | | 88 | | /// <summary> |
| | | 89 | | /// True if the input is readonly, false otherwise. |
| | | 90 | | /// </summary> |
| | 17337 | 91 | | public bool? IsReadOnly { get; set; } |
| | | 92 | | |
| | | 93 | | /// <summary> |
| | | 94 | | /// Gets or sets a value indicating whether this input can contain secrets. |
| | | 95 | | /// When set to true, the input will be treated as a secret and will be encrypted, masked or otherwise protected, de |
| | | 96 | | /// </summary> |
| | 0 | 97 | | public bool IsSensitive { get; set; } |
| | | 98 | | |
| | | 99 | | /// <summary> |
| | | 100 | | /// The storage driver type to use for persistence. |
| | | 101 | | /// If no driver is specified, the referenced memory block will remain in memory for as long as the expression execu |
| | | 102 | | /// </summary> |
| | 17417 | 103 | | public Type? StorageDriverType { get; set; } |
| | | 104 | | |
| | | 105 | | /// <summary> |
| | | 106 | | /// True if the expression should be evaluated automatically, false otherwise. Defaults to true. |
| | | 107 | | /// </summary> |
| | 40222 | 108 | | public bool AutoEvaluate { get; set; } = true; |
| | | 109 | | |
| | | 110 | | /// <summary> |
| | | 111 | | /// Specifies the type of a custom evaluator to use for evaluating the input property value. |
| | | 112 | | /// The evaluator type determines how the value for the property is resolved at runtime. |
| | | 113 | | /// </summary> |
| | 21675 | 114 | | public Type? EvaluatorType { get; set; } |
| | | 115 | | |
| | | 116 | | /// <summary> |
| | | 117 | | /// A dictionary of UI specifications to be used by the UI. |
| | | 118 | | /// </summary> |
| | 17337 | 119 | | public IDictionary<string, object>? UISpecifications { get; set; } |
| | | 120 | | } |