UNPKG

@progress/sitefinity-widget-designers-sdk

Version:

This package aims to create a parity for widget designer generation similar to the [autogenerated widget designers](https://www.progress.com/documentation/sitefinity-cms/next.js-autogenerated-field-types) in Sitefinity. Due to some limitations in Typescri

1,289 lines (957 loc) 47.3 kB
## Classes <dl> <dt><a href="#ChoiceItem">ChoiceItem</a></dt> <dd><p>Represents a choice item model.</p> </dd> <dt><a href="#ChoiceSettings">ChoiceSettings</a></dt> <dd><p>Configuration for a properties&#39; choices metadata.</p> </dd> <dt><a href="#ContentSettings">ContentSettings</a></dt> <dd><p>Settings for the Content property decorator.</p> </dd> <dt><a href="#DateTimeFilterValue">DateTimeFilterValue</a></dt> <dd><p>Defines filter value object for date time extensive filtering.</p> </dd> <dt><a href="#MarginsProperties">MarginsProperties</a></dt> <dd><p>Represents the default preconfiguration <a href="#DataModel">DataModel</a> for a property, decorated with <a href="#Margins">Margins</a> decorator.</p> </dd> <dt><a href="#SdkItemModel">SdkItemModel</a></dt> <dd><p>Represents the minimal number of needed serializable properties of a content/media item. Used as a <a href="#DataModel">DataModel</a> for content items and data items. Decorated with the <a href="#Model">Model</a> decorator.</p> </dd> <dt><a href="#TableViewSettings">TableViewSettings</a></dt> <dd><p>Configuration for the <a href="#TableView">TableView</a> decorator</p> </dd> <dt><a href="#EntityMetadataGenerator">EntityMetadataGenerator</a></dt> <dd><p>Generates the metadata for the widget designer based on a decorated widget entity.</p> </dd> <dt><a href="#WidgetMetadata">WidgetMetadata</a></dt> <dd><p>Registers metadata on classes and properties.</p> </dd> </dl> ## Members <dl> <dt><a href="#PropertyCategory">PropertyCategory</a></dt> <dd><p>Provides default categories for properties in the widget designers.</p> </dd> <dt><a href="#KnownFieldTypes">KnownFieldTypes</a></dt> <dd><p>Predefined known field types.</p> </dd> <dt><a href="#ComplexType">ComplexType</a></dt> <dd><p>Predefined types of complex fields.</p> </dd> <dt><a href="#DateTimeMode">DateTimeMode</a></dt> <dd><p>Defines whether to display only date, only time of both.</p> </dd> <dt><a href="#BasicValueTypes">BasicValueTypes</a></dt> <dd><p>Predefined special default values</p> </dd> <dt><a href="#Offset_Choices">Offset_Choices</a></dt> <dd><p>Predefined margin values choice items.</p> </dd> <dt><a href="#PropertyMergeStrategy">PropertyMergeStrategy</a></dt> <dd><p>Strategy for the approach on assigning the property metadata.</p> </dd> </dl> ## Functions <dl> <dt><a href="#Attributes">Attributes()</a></dt> <dd><p>Defines that the property represents attributes configuration. Calls internally <a href="#Category">Category</a>, <a href="#DefaultValue">DefaultValue</a>, <a href="#DisplayName">DisplayName</a>, <a href="#ContentSection">ContentSection</a>, <a href="#DataType">DataType</a>, <a href="#LengthDependsOn">LengthDependsOn</a>, and <a href="#DataModel">DataModel</a> decorators. The metadata default tos:</p> <ul> <li>Category - &#39;Advanced&#39;</li> <li>Default value - null</li> <li>Display name - &#39;Attributes for...&#39;</li> <li>Data type - &#39;attributes&#39;</li> <li>Data model - <a href="KeysValues">KeysValues</a></li> </ul> </dd> <dt><a href="#Browsable">Browsable([browsable])</a></dt> <dd><p>Defines the property as browsable in the designer on not.</p> </dd> <dt><a href="#Category">Category(categoryName)</a></dt> <dd><p>Defines the property category</p> </dd> <dt><a href="#Choice">Choice(choices, allowMultiple)</a></dt> <dd><p>Defines the property&#39;s choices metadata.</p> </dd> <dt><a href="#ColorPalette">ColorPalette(paletteName, stylingConfig)</a></dt> <dd><p>Defines the color palette for the property.</p> </dd> <dt><a href="#PropertyDecoratorBase">PropertyDecoratorBase(func)</a></dt> <dd><p>A property decorator function wrapper to provide forward compatibility for changes in the property decorator parameters.</p> </dd> <dt><a href="#contentPropertyDefaultValue">contentPropertyDefaultValue(itemType)</a></dt> <dd><p>Creates an empty value for MixedContentContext</p> </dd> <dt><a href="#ConditionalVisibility">ConditionalVisibility(condition)</a></dt> <dd><p>Defines the condition for showing/hiding the field</p> </dd> <dt><a href="#ContentContainer">ContentContainer(hasContent)</a></dt> <dd><p>Defines that the property contains content and can be indexed.</p> </dd> <dt><a href="#ContentSection">ContentSection(arg1, arg2)</a></dt> <dd><p>Defines the property&#39;s content section.</p> </dd> <dt><a href="#Content">Content(settings)</a></dt> <dd><p>Describes that the property refers to sitefinity content.</p> </dd> <dt><a href="#TaxonomyContent">TaxonomyContent(settings)</a></dt> <dd><p>Describes that the property refers to sitefinity taxononmy type.</p> </dd> <dt><a href="#DynamicLinksContainer">DynamicLinksContainer()</a></dt> <dd><p>Defines that the property as containing dynamic links that are handled by Sitefinity.</p> </dd> <dt><a href="#Copy">Copy(exclude)</a></dt> <dd><p>Defines that the property is to be excluded during a copy operation.</p> </dd> <dt><a href="#CssFieldMappings">CssFieldMappings(viewMeta, [showWrapperClasses])</a></dt> <dd><p>Defines the property as a predefined css field mappings property. Internally calls <a href="#DataModel">DataModel</a> with <a href="CssClassMapping">CssClassMapping</a>.</p> </dd> <dt><a href="#CustomMetadata">CustomMetadata(metadataKey, value)</a></dt> <dd><p>Defines custom property metadata. The values will be set under the Properties array for the property metadata. In case the value is set to a string, the metadata would be registered as Meta_[metadataKey]: [value] under Properties. If the value is an object, the metadata would be set as Meta_[metadataKey]_[objectKey1] : [objectValue1], Meta_[metadataKey]_[objectKey2]: [objectValue2] etc. under Properties.</p> </dd> <dt><a href="#DataType">DataType(customDataType)</a></dt> <dd><p>Defines the property&#39;s data type.</p> </dd> <dt><a href="#DataModel">DataModel(model)</a></dt> <dd><p>Defines the property&#39;s data model when the property is not a basic type. If the property&#39;s type is a class or object, it should be referenced here, so its metadata could be populated in the decorated property&#39;s metadata.</p> </dd> <dt><a href="#DateRange">DateRange(dateTimeMode)</a></dt> <dd><p>Defines settings for date time mode property.</p> </dd> <dt><a href="#DateSettings">DateSettings(showTime)</a></dt> <dd><p>Defines settings for date time property.</p> </dd> <dt><a href="#DefaultValue">DefaultValue(defaultValue)</a></dt> <dd><p>Defiens the property default value. Serializes any passed JSON objects.</p> </dd> <dt><a href="#Description">Description(description)</a></dt> <dd><p>Defines the property&#39;s description.</p> </dd> <dt><a href="#DescriptionExtended">DescriptionExtended(descriptionSettings)</a></dt> <dd><p>Defines the proprty&#39;s short description for the property, ment to render inline.</p> </dd> <dt><a href="#Dialog">Dialog(data)</a></dt> <dd><p>Defines the property&#39;s data for a dialog in the widget designers (i.e. buttons and labels). Should be coupled with <a href="#DataType">DataType</a> decorator with <a href="KnownFieldTypes.PencilButton">KnownFieldTypes.PencilButton</a> value.</p> </dd> <dt><a href="#DisplayName">DisplayName(name)</a></dt> <dd><p>Defines the display name for the property.</p> </dd> <dt><a href="#DisplaySettings">DisplaySettings(hide, [hideContent])</a></dt> <dd><p>Defines whether the property or its content should be hidden in the designer.</p> </dd> <dt><a href="#FallbackToDefaultValueWhenEmpty">FallbackToDefaultValueWhenEmpty([emptyValues])</a></dt> <dd><p>Defines the property&#39;s default fallback value when empty.</p> </dd> <dt><a href="#FieldMappings">FieldMappings(viewMeta)</a></dt> <dd><p>Defines that the property is responsible for content fields mapping. Internally sets the type of the field as <em>listFieldMapping</em></p> </dd> <dt><a href="#Group">Group(name)</a></dt> <dd><p>Defines the property&#39;s group name.</p> </dd> <dt><a href="#IsNullable">IsNullable(isNullable)</a></dt> <dd><p>Defines whether the property can have a null value and not fallback to a default value.</p> </dd> <dt><a href="#LengthDependsOn">LengthDependsOn(settingsOrPropertyName, [displayName], [displayTitle], [extraRecords])</a></dt> <dd><p>Defines the decorated dictionary property&#39;s length relation to another field.</p> </dd> <dt><a href="#Margins">Margins(widgetName)</a></dt> <dd><p>Defines the property as a preconfigured margins property. Internally calls <a href="#DataType">DataType</a> as &#39;complex&#39;, <a href="#DataModel">DataModel</a> with <a href="#MarginsProperties">MarginsProperties</a>, and <a href="#TableView">TableView</a>.</p> </dd> <dt><a href="#MediaItem">MediaItem(itemType, allowMultipleSelection, [standalone])</a></dt> <dd><p>Defines the media type for a media selector field. Must be accompatied with <a href="#DataType">DataType</a>(&#39;media&#39;) and preferably <a href="#DataModel">DataModel</a>(<a href="#SdkItemModel">SdkItemModel</a>) decorators.</p> </dd> <dt><a href="#Mirror">Mirror(mirroredfieldName, [mirrorFieldProperty])</a></dt> <dd><p>Defines from which field value is to be mirrored in the designer and populated in the decorated property if its value is still unset.</p> </dd> <dt><a href="#Placeholder">Placeholder(text)</a></dt> <dd><p>Defines the placeholder for the property in the designer.</p> </dd> <dt><a href="#Suffix">Suffix(suffix)</a></dt> <dd><p>Defines the suffix (a range type) the property.</p> </dd> <dt><a href="#TableView">TableView(args, [predefinedLists])</a></dt> <dd><p>Defines a complex field property as diplayed in table mode in the designer.</p> </dd> <dt><a href="#Required">Required([errorMessage])</a></dt> <dd><p>Defines the property as required.</p> </dd> <dt><a href="#Readonly">Readonly()</a></dt> <dd><p>Defines the property as read-only and not editable.</p> </dd> <dt><a href="#Range">Range(min, max, [errorMessage])</a></dt> <dd><p>Defines the property values accepted range.</p> </dd> <dt><a href="#MinLength">MinLength(length, [errorMessage])</a></dt> <dd><p>Defines the property value minimum length.</p> </dd> <dt><a href="#MaxLength">MaxLength(length, [errorMessage])</a></dt> <dd><p>Defines the property value maximum length.</p> </dd> <dt><a href="#RegularExpression">RegularExpression(pattern, [errorMessage])</a></dt> <dd><p>Defines the regex expression that would validate the property value.</p> </dd> <dt><a href="#StringLength">StringLength(max, [errorMessage])</a></dt> <dd><p>Defines the string property maximum length.</p> </dd> <dt><a href="#DecimalPlaces">DecimalPlaces(decimalPlaces, [errorMessage])</a></dt> <dd><p>Defined the number property decimal precision.</p> </dd> <dt><a href="#Url">Url([errorMessage])</a></dt> <dd><p>Predefined url validation.</p> </dd> <dt><a href="#EmailAddress">EmailAddress([errorMessage])</a></dt> <dd><p>Predefined email validation.</p> </dd> <dt><a href="#ViewSelector">ViewSelector([views])</a></dt> <dd><p>Defines the decorated property as a view selector with <a href="#DataType">DataType</a>=&#39;viewSelector&#39; and uses internally the <a href="#Choice">Choice</a> decorator.</p> </dd> <dt><a href="#WidgetLabel">WidgetLabel()</a></dt> <dd><p>Defines the property as the predefined SfWidgetLabel and adds the appropriate metadata:</p> <ul> <li>Category: Advanced</li> <li>Display name: Label</li> <li>Max length: 30</li> <li>Predefined description</li> </ul> </dd> <dt><a href="#WidgetEntity">WidgetEntity(name, caption)</a></dt> <dd><p>Class decorator Defines the decorated class as a widget entity. Calls internally the <a href="#Model">Model</a> decorator on the entity class.</p> </dd> <dt><a href="#SectionsOrder">SectionsOrder(sections)</a></dt> <dd><p>Class decorator Defines the widget entity&#39;s sections ordering in the designer.</p> </dd> <dt><a href="#Model">Model([capitalizeProperties])</a></dt> <dd><p>Class decorator Defines the decorated class as a data model. Enumerates the class properties, defines their name, title and default value (if such is set). The class properties are suggested to be defined with a default value to be enumerated properly. Properties that have their default value set as undefined or null will not get their default type, receiving &#39;string&#39; as their type and would need to have the <a href="#DataType">DataType</a> decorator set as well.</p> </dd> </dl> <a name="ChoiceItem"></a> ## ChoiceItem Represents a choice item model. **Kind**: global class * [ChoiceItem](#ChoiceItem) * [.Title](#ChoiceItem+Title) : <code>string</code> * [.Name](#ChoiceItem+Name) : <code>string</code> * [.Value](#ChoiceItem+Value) : <code>any</code> * [.Icon](#ChoiceItem+Icon) : <code>string</code> \| <code>Object</code> \| <code>null</code> * [.Tooltip](#ChoiceItem+Tooltip) : <code>string</code> <a name="ChoiceItem+Title"></a> ### choiceItem.Title : <code>string</code> **Kind**: instance property of [<code>ChoiceItem</code>](#ChoiceItem) <a name="ChoiceItem+Name"></a> ### choiceItem.Name : <code>string</code> **Kind**: instance property of [<code>ChoiceItem</code>](#ChoiceItem) <a name="ChoiceItem+Value"></a> ### choiceItem.Value : <code>any</code> **Kind**: instance property of [<code>ChoiceItem</code>](#ChoiceItem) <a name="ChoiceItem+Icon"></a> ### choiceItem.Icon : <code>string</code> \| <code>Object</code> \| <code>null</code> **Kind**: instance property of [<code>ChoiceItem</code>](#ChoiceItem) **Default**: <code>&quot;{null}&quot;</code> <a name="ChoiceItem+Tooltip"></a> ### choiceItem.Tooltip : <code>string</code> **Kind**: instance property of [<code>ChoiceItem</code>](#ChoiceItem) <a name="ChoiceSettings"></a> ## ChoiceSettings Configuration for a properties' choices metadata. **Kind**: global class <a name="ChoiceSettings+Choices"></a> ### choiceSettings.Choices : [<code>ChoiceItem</code>](#ChoiceItem) Array of the choices for the dropdown **Kind**: instance property of [<code>ChoiceSettings</code>](#ChoiceSettings) <a name="ContentSettings"></a> ## ContentSettings Settings for the Content property decorator. **Kind**: global class * [ContentSettings](#ContentSettings) * [.Type](#ContentSettings+Type) * [.IsFilterable](#ContentSettings+IsFilterable) * [.AllowMultipleItemsSelection](#ContentSettings+AllowMultipleItemsSelection) * [.OpenMultipleItemsSelection](#ContentSettings+OpenMultipleItemsSelection) * [.LiveData](#ContentSettings+LiveData) * [.Provider](#ContentSettings+Provider) * [.DisableInteraction](#ContentSettings+DisableInteraction) * [.ShowSiteSelector](#ContentSettings+ShowSiteSelector) * [.AllowCreate](#ContentSettings+AllowCreate) * [.ForceShouldShowAll](#ContentSettings+ForceShouldShowAll) <a name="ContentSettings+Type"></a> ### contentSettings.Type Gets or sets the type of the content to be displayed in the selector. E.g Telerik.Sitefinity.News.Model.NewsItem For dynamic types the full Clr Type name is expected. E.g. Telerik.Sitefinity.DynamicTypes.Model.Pressreleases.PressRelease. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+IsFilterable"></a> ### contentSettings.IsFilterable Gets or sets a value indicating whether the filter logic will be applied for the content that has the <see cref="Type"/> atttribute defined. This takes effect when no specific type is selected. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+AllowMultipleItemsSelection"></a> ### contentSettings.AllowMultipleItemsSelection Gets or sets a value indicating whether multiple items can be selected. Defaults to 'true' **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+OpenMultipleItemsSelection"></a> ### contentSettings.OpenMultipleItemsSelection Gets or sets a value indicating whether the selector for items to be opened directly and the input option to be skipped Defaults to 'false'. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+LiveData"></a> ### contentSettings.LiveData Gets or sets a value indicating whether to use live or master data in the selectors. Applicable for all content types except: Pages, Images, Videos and Documents. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+Provider"></a> ### contentSettings.Provider Gets or sets a name of the provider; If none was specified we will show data from all providers. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+DisableInteraction"></a> ### contentSettings.DisableInteraction Gets or sets a value indicating whether to disable interaction with selected items. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+ShowSiteSelector"></a> ### contentSettings.ShowSiteSelector Gets or sets a value indicating whether to show the providers/sites selector in show all items dialog. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+AllowCreate"></a> ### contentSettings.AllowCreate Gets or sets a value indicating whether create item button is visible. Defaults to 'true'. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="ContentSettings+ForceShouldShowAll"></a> ### contentSettings.ForceShouldShowAll Gets or sets a value indicating whether show all button is visible. **Kind**: instance property of [<code>ContentSettings</code>](#ContentSettings) <a name="DateTimeFilterValue"></a> ## DateTimeFilterValue Defines filter value object for date time extensive filtering. **Kind**: global class <a name="MarginsProperties"></a> ## MarginsProperties Represents the default preconfiguration [DataModel](#DataModel) for a property, decorated with [Margins](#Margins) decorator. **Kind**: global class <a name="SdkItemModel"></a> ## SdkItemModel Represents the minimal number of needed serializable properties of a content/media item. Used as a [DataModel](#DataModel) for content items and data items. Decorated with the [Model](#Model) decorator. **Kind**: global class * [SdkItemModel](#SdkItemModel) * [.Id](#SdkItemModel+Id) * [.Provider](#SdkItemModel+Provider) <a name="SdkItemModel+Id"></a> ### sdkItemModel.Id **Kind**: instance property of [<code>SdkItemModel</code>](#SdkItemModel) **Properties** | Name | Description | | --- | --- | | The | item's id. [DataType](#DataType) = 'string' | <a name="SdkItemModel+Provider"></a> ### sdkItemModel.Provider **Kind**: instance property of [<code>SdkItemModel</code>](#SdkItemModel) **Properties** | Name | Description | | --- | --- | | The | item's provider. [DataType](#DataType) = 'string' | <a name="TableViewSettings"></a> ## TableViewSettings Configuration for the [TableView](#TableView) decorator **Kind**: global class <a name="TableViewSettings+MultipleSelect"></a> ### tableViewSettings.MultipleSelect Allows multiple lines to be added for a collection property. **Kind**: instance property of [<code>TableViewSettings</code>](#TableViewSettings) <a name="EntityMetadataGenerator"></a> ## EntityMetadataGenerator Generates the metadata for the widget designer based on a decorated widget entity. **Kind**: global class * [EntityMetadataGenerator](#EntityMetadataGenerator) * [.extractMetadata(widgetEntityClass)](#EntityMetadataGenerator.extractMetadata) ⇒ * [.extractDefaultValues(metadata)](#EntityMetadataGenerator.extractDefaultValues) * [.parseValues(serializedValues, metadata)](#EntityMetadataGenerator.parseValues) * [.extractPropertyDefaultValue(property)](#EntityMetadataGenerator.extractPropertyDefaultValue) ⇒ * [.parsePropertyValue(currentValue, propertyMeta)](#EntityMetadataGenerator.parsePropertyValue) ⇒ <a name="EntityMetadataGenerator.extractMetadata"></a> ### EntityMetadataGenerator.extractMetadata(widgetEntityClass) ⇒ Compiles the designer metadata from the widget entity. The passed class should be decorated with [WidgetEntity](#WidgetEntity). **Kind**: static method of [<code>EntityMetadataGenerator</code>](#EntityMetadataGenerator) **Returns**: The generated designer metadata. | Param | Description | | --- | --- | | widgetEntityClass | The widget enitity class. | <a name="EntityMetadataGenerator.extractDefaultValues"></a> ### EntityMetadataGenerator.extractDefaultValues(metadata) Extracts the entity's default values according to the widget designer metadata. The designer metadata (the [DefaultValue](#DefaultValue) decorator) takes precedence over the defaults set in the entity class definition. Handles special scenarios such as complex objects, booleans, numbers. **Kind**: static method of [<code>EntityMetadataGenerator</code>](#EntityMetadataGenerator) | Param | Type | Description | | --- | --- | --- | | metadata | <code>MetadataModel</code> | The designer metadata. | <a name="EntityMetadataGenerator.parseValues"></a> ### EntityMetadataGenerator.parseValues(serializedValues, metadata) Deserializes the values for widget properties. Parses JSON objects, turns boolean properties from string to true boolean, parses numbers. **Kind**: static method of [<code>EntityMetadataGenerator</code>](#EntityMetadataGenerator) | Param | Description | | --- | --- | | serializedValues | The values assigned to the widget's properties that are received from the server. | | metadata | The widget designer metadata. | <a name="EntityMetadataGenerator.extractPropertyDefaultValue"></a> ### EntityMetadataGenerator.extractPropertyDefaultValue(property) ⇒ Extracts a single property default value from the property model generated by the designer decorators. **Kind**: static method of [<code>EntityMetadataGenerator</code>](#EntityMetadataGenerator) **Returns**: The default value for the property in the appropriate type as by the designer metadata. | Param | Description | | --- | --- | | property | The property model as in the designer metadata. | <a name="EntityMetadataGenerator.parsePropertyValue"></a> ### EntityMetadataGenerator.parsePropertyValue(currentValue, propertyMeta) ⇒ Parses a single property value based on the property model generated by the designer decorators. **Kind**: static method of [<code>EntityMetadataGenerator</code>](#EntityMetadataGenerator) **Returns**: The property value parsed to the appropriate type defined by the property metadata. | Param | Description | | --- | --- | | currentValue | The property current value as persisted in Sitefinity. | | propertyMeta | The property model as in the designer metadata. | <a name="WidgetMetadata"></a> ## WidgetMetadata Registers metadata on classes and properties. **Kind**: global class * [WidgetMetadata](#WidgetMetadata) * [.registerPrototype(target)](#WidgetMetadata.registerPrototype) * [.registerProperty(target, key, value)](#WidgetMetadata.registerProperty) * [.registerPrototypeProperty(target, key, value)](#WidgetMetadata.registerPrototypeProperty) * [.registerPropertyMetadata(target, propName, key, value, override)](#WidgetMetadata.registerPropertyMetadata) * [.registerPrototypePropertyMetadata(target, propName, key, value, override)](#WidgetMetadata.registerPrototypePropertyMetadata) <a name="WidgetMetadata.registerPrototype"></a> ### WidgetMetadata.registerPrototype(target) Registers the base metadata property holder. **Kind**: static method of [<code>WidgetMetadata</code>](#WidgetMetadata) | Param | Description | | --- | --- | | target | The decorated class. | <a name="WidgetMetadata.registerProperty"></a> ### WidgetMetadata.registerProperty(target, key, value) Registers a property value in the metadata of the class on a given key. **Kind**: static method of [<code>WidgetMetadata</code>](#WidgetMetadata) | Param | Description | | --- | --- | | target | The decorated class. | | key | Propery key. | | value | The property value. | <a name="WidgetMetadata.registerPrototypeProperty"></a> ### WidgetMetadata.registerPrototypeProperty(target, key, value) Registers a property value in the metadata of the class prototype on a given key. **Kind**: static method of [<code>WidgetMetadata</code>](#WidgetMetadata) | Param | Description | | --- | --- | | target | The decorated class. | | key | Propery key. | | value | The property value. | <a name="WidgetMetadata.registerPropertyMetadata"></a> ### WidgetMetadata.registerPropertyMetadata(target, propName, key, value, override) Register a property value in the metadata of the class based on _propName_, _key_ in the property metadata, property.key _value_ and an optional override strategy. **Kind**: static method of [<code>WidgetMetadata</code>](#WidgetMetadata) | Param | Description | | --- | --- | | target | The decorated class. | | propName | The property name. | | key | The key of the metadata value. | | value | The value. | | override | The override strategy for the value: - skip - if there is already a value assigned - override - if you wish to force the value even if one is already assigned - merge - if the value object that is passed needs to be merged with the one that already is assigned Default is to override. | <a name="WidgetMetadata.registerPrototypePropertyMetadata"></a> ### WidgetMetadata.registerPrototypePropertyMetadata(target, propName, key, value, override) Register a property value in the metadata of the class prototype based on @param propName, @param key in the property metadata, property.key @param value and an optional override strategy. **Kind**: static method of [<code>WidgetMetadata</code>](#WidgetMetadata) | Param | Description | | --- | --- | | target | The decorated class. | | propName | The property name. | | key | The key of the metadata value. | | value | The value. | | override | The override strategy for the value: - skip - if there is already a value assigned - override - if you wish to force the value even if one is already assigned - merge - if the value object that is passed needs to be merged with the one that already is assigned Default is to override. | <a name="PropertyCategory"></a> ## PropertyCategory Provides default categories for properties in the widget designers. **Kind**: global variable <a name="KnownFieldTypes"></a> ## KnownFieldTypes Predefined known field types. **Kind**: global variable <a name="ComplexType"></a> ## ComplexType Predefined types of complex fields. **Kind**: global variable <a name="DateTimeMode"></a> ## DateTimeMode Defines whether to display only date, only time of both. **Kind**: global variable <a name="BasicValueTypes"></a> ## BasicValueTypes Predefined special default values **Kind**: global variable <a name="Offset_Choices"></a> ## Offset\_Choices Predefined margin values choice items. **Kind**: global variable <a name="PropertyMergeStrategy"></a> ## PropertyMergeStrategy Strategy for the approach on assigning the property metadata. **Kind**: global variable * [PropertyMergeStrategy](#PropertyMergeStrategy) * [.Skip](#PropertyMergeStrategy.Skip) * [.Override](#PropertyMergeStrategy.Override) * [.Merge](#PropertyMergeStrategy.Merge) <a name="PropertyMergeStrategy.Skip"></a> ### PropertyMergeStrategy.Skip Do not assign the passed value if a value is already assigned. **Kind**: static property of [<code>PropertyMergeStrategy</code>](#PropertyMergeStrategy) <a name="PropertyMergeStrategy.Override"></a> ### PropertyMergeStrategy.Override Override any previously assigned value with the passed value. **Kind**: static property of [<code>PropertyMergeStrategy</code>](#PropertyMergeStrategy) <a name="PropertyMergeStrategy.Merge"></a> ### PropertyMergeStrategy.Merge Merge an already existing property value object with the passed value using Object.assign **Kind**: static property of [<code>PropertyMergeStrategy</code>](#PropertyMergeStrategy) <a name="Attributes"></a> ## Attributes() Defines that the property represents attributes configuration. Calls internally [Category](#Category), [DefaultValue](#DefaultValue), [DisplayName](#DisplayName), [ContentSection](#ContentSection), [DataType](#DataType), [LengthDependsOn](#LengthDependsOn), and [DataModel](#DataModel) decorators. The metadata default tos: - Category - 'Advanced' - Default value - null - Display name - 'Attributes for...' - Data type - 'attributes' - Data model - [KeysValues](KeysValues) **Kind**: global function <a name="Browsable"></a> ## Browsable([browsable]) Defines the property as browsable in the designer on not. **Kind**: global function | Param | Type | Default | | --- | --- | --- | | [browsable] | <code>boolean</code> | <code>false</code> | <a name="Category"></a> ## Category(categoryName) Defines the property category **Kind**: global function | Param | Type | Description | | --- | --- | --- | | categoryName | <code>string</code> | The title of the category | <a name="Choice"></a> ## Choice(choices, allowMultiple) Defines the property's choices metadata. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | choices | [<code>Array.&lt;ChoiceItem&gt;</code>](#ChoiceItem) \| [<code>ChoiceSettings</code>](#ChoiceSettings) | Choice items or choice config. | | allowMultiple | <code>boolean</code> | Allow multiple choices. | <a name="ColorPalette"></a> ## ColorPalette(paletteName, stylingConfig) Defines the color palette for the property. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | paletteName | <code>string</code> | The name of the chosen palette | | stylingConfig | <code>StylingConfig</code> | A styling config that would hold the defined color values | <a name="PropertyDecoratorBase"></a> ## PropertyDecoratorBase(func) A property decorator function wrapper to provide forward compatibility for changes in the property decorator parameters. **Kind**: global function | Param | Description | | --- | --- | | func | Callback function to be executed in the property decorator. | <a name="contentPropertyDefaultValue"></a> ## contentPropertyDefaultValue(itemType) ⇒ Creates an empty value for MixedContentContext **Kind**: global function **Returns**: A default empty value for MixedContentContext | Param | Description | | --- | --- | | itemType | The Content property item type | <a name="ConditionalVisibility"></a> ## ConditionalVisibility(condition) Defines the condition for showing/hiding the field **Kind**: global function | Param | Type | Description | | --- | --- | --- | | condition | <code>string</code> \| <code>Rule</code> | The condition for the field's visibility | <a name="ContentContainer"></a> ## ContentContainer(hasContent) Defines that the property contains content and can be indexed. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | hasContent | <code>boolean</code> | <code>true</code> | Sets whether the property holds content | <a name="ContentSection"></a> ## ContentSection(arg1, arg2) Defines the property's content section. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | arg1 | <code>string</code> \| <code>number</code> | the section name or index | | arg2 | <code>number</code> | index of the property in the section | <a name="Content"></a> ## Content(settings) Describes that the property refers to sitefinity content. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | settings | [<code>ContentSettings</code>](#ContentSettings) | The configuration settings for the sitefinity content | <a name="TaxonomyContent"></a> ## TaxonomyContent(settings) Describes that the property refers to sitefinity taxononmy type. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | settings | [<code>ContentSettings</code>](#ContentSettings) | The configuration settings for the sitefinity taxononmy | <a name="DynamicLinksContainer"></a> ## DynamicLinksContainer() Defines that the property as containing dynamic links that are handled by Sitefinity. **Kind**: global function <a name="Copy"></a> ## Copy(exclude) Defines that the property is to be excluded during a copy operation. **Kind**: global function | Param | Type | | --- | --- | | exclude | <code>boolean</code> | <a name="CssFieldMappings"></a> ## CssFieldMappings(viewMeta, [showWrapperClasses]) Defines the property as a predefined css field mappings property. Internally calls [DataModel](#DataModel) with [CssClassMapping](CssClassMapping). **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | viewMeta | <code>ViewMetaModel</code> | <code></code> | View metadata field name to css class mapping. | | [showWrapperClasses] | <code>boolean</code> | <code>false</code> | Should show an option of the wrapper classes. | <a name="CustomMetadata"></a> ## CustomMetadata(metadataKey, value) Defines custom property metadata. The values will be set under the Properties array for the property metadata. In case the value is set to a string, the metadata would be registered as Meta_[metadataKey]: [value] under Properties. If the value is an object, the metadata would be set as Meta\_[metadataKey]\_[objectKey1] : [objectValue1], Meta\_[metadataKey]\_[objectKey2]: [objectValue2] etc. under Properties. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | metadataKey | | The custom key for the property metadata. | | value | <code>string</code> \| <code>object</code> | The value for the custom metdata. | **Example** ```js CustomMetadata('Unit', 'px') //returns // ... // Properties: [ // 'Meta_Unit': 'px' // ] ``` **Example** ```js CustomMetadata('Unit', {Suffix: 'px', Type: 'number'}) // returns // ... // Properties: [ // 'Meta_Unit_Suffix': 'px', // 'Meta_Unit_Type': 'number', // ] ``` <a name="DataType"></a> ## DataType(customDataType) Defines the property's data type. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | customDataType | [<code>KnownFieldTypes</code>](#KnownFieldTypes) \| [<code>ComplexType</code>](#ComplexType) \| <code>string</code> | The property data type - e.g. 'string', 'boolean', complex type, custom type or anything specific. | <a name="DataModel"></a> ## DataModel(model) Defines the property's data model when the property is not a basic type. If the property's type is a class or object, it should be referenced here, so its metadata could be populated in the decorated property's metadata. **Kind**: global function | Param | Description | | --- | --- | | model | The class that is used as a model for the properties. It should be decorated with [Model](#Model) decorator. | <a name="DateRange"></a> ## DateRange(dateTimeMode) Defines settings for date time mode property. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | dateTimeMode | [<code>DateTimeMode</code>](#DateTimeMode) | Defines whether to display only date, only time of both. | <a name="DateSettings"></a> ## DateSettings(showTime) Defines settings for date time property. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | showTime | <code>boolean</code> | Defines showing of time. | <a name="DefaultValue"></a> ## DefaultValue(defaultValue) Defiens the property default value. Serializes any passed JSON objects. **Kind**: global function | Param | Description | | --- | --- | | defaultValue | The default value. | <a name="Description"></a> ## Description(description) Defines the property's description. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | description | <code>string</code> \| <code>Array.&lt;RichDescription&gt;</code> | Description string or a rich description model. | <a name="DescriptionExtended"></a> ## DescriptionExtended(descriptionSettings) Defines the proprty's short description for the property, ment to render inline. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | descriptionSettings | <code>DescriptionExtendedSettings</code> | The extended description data. | <a name="Dialog"></a> ## Dialog(data) Defines the property's data for a dialog in the widget designers (i.e. buttons and labels). Should be coupled with [DataType](#DataType) decorator with [KnownFieldTypes.PencilButton](KnownFieldTypes.PencilButton) value. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | data | <code>string</code> \| <code>DialogMetadata</code> | The dialog's data. | <a name="DisplayName"></a> ## DisplayName(name) Defines the display name for the property. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | name | <code>string</code> | The display name. | <a name="DisplaySettings"></a> ## DisplaySettings(hide, [hideContent]) Defines whether the property or its content should be hidden in the designer. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | hide | <code>boolean</code> | | Sets whether the field should be hidden in the designer. | | [hideContent] | <code>boolean</code> | <code>false</code> | Sets whether or not the field's content should be hidden. | <a name="FallbackToDefaultValueWhenEmpty"></a> ## FallbackToDefaultValueWhenEmpty([emptyValues]) Defines the property's default fallback value when empty. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | [emptyValues] | <code>string</code> | <code>&quot;\&quot;[&#x27;&#x27;]\&quot;&quot;</code> | The empty value to fallback to. | <a name="FieldMappings"></a> ## FieldMappings(viewMeta) Defines that the property is responsible for content fields mapping. Internally sets the type of the field as _listFieldMapping_ **Kind**: global function | Param | Type | Description | | --- | --- | --- | | viewMeta | <code>ViewMetaModel</code> | The view meta model. | <a name="Group"></a> ## Group(name) Defines the property's group name. **Kind**: global function | Param | Description | | --- | --- | | name | Group name. | <a name="IsNullable"></a> ## IsNullable(isNullable) Defines whether the property can have a null value and not fallback to a default value. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | isNullable | <code>boolean</code> | Is the property is nullable. | <a name="LengthDependsOn"></a> ## LengthDependsOn(settingsOrPropertyName, [displayName], [displayTitle], [extraRecords]) Defines the decorated dictionary property's length relation to another field. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | settingsOrPropertyName | <code>LengthDependsOnSettings</code> \| <code>string</code> | | A lengthDependsOn configuration object or the property name. | | [displayName] | <code>string</code> | <code>null</code> | The display name of the related property. | | [displayTitle] | <code>string</code> | <code>null</code> | The display title of the related property. | | [extraRecords] | <code>string</code> | <code>null</code> | Extra records. | <a name="Margins"></a> ## Margins(widgetName) Defines the property as a preconfigured margins property. Internally calls [DataType](#DataType) as 'complex', [DataModel](#DataModel) with [MarginsProperties](#MarginsProperties), and [TableView](#TableView). **Kind**: global function | Param | Description | | --- | --- | | widgetName | The name of the widget. | <a name="MediaItem"></a> ## MediaItem(itemType, allowMultipleSelection, [standalone]) Defines the media type for a media selector field. Must be accompatied with [DataType](#DataType)('media') and preferably [DataModel](#DataModel)([SdkItemModel](#SdkItemModel)) decorators. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | itemType | <code>&#x27;images&#x27;</code> \| <code>&#x27;videos&#x27;</code> \| <code>string</code> | | The related media type. | | allowMultipleSelection | <code>boolean</code> | | Whether the field is multiple select or single select. | | [standalone] | <code>boolean</code> | <code>false</code> | If the selector is standalone. | <a name="Mirror"></a> ## Mirror(mirroredfieldName, [mirrorFieldProperty]) Defines from which field value is to be mirrored in the designer and populated in the decorated property if its value is still unset. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | mirroredfieldName | <code>string</code> | | The name of the field to mirror. | | [mirrorFieldProperty] | <code>string</code> \| <code>null</code> | <code>null</code> | The name of the property to mirror if the mirrored field is complex. | <a name="Placeholder"></a> ## Placeholder(text) Defines the placeholder for the property in the designer. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | text | <code>string</code> | The placeholder text. | <a name="Suffix"></a> ## Suffix(suffix) Defines the suffix (a range type) the property. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | suffix | <code>string</code> | The suffix to be added. | <a name="TableView"></a> ## TableView(args, [predefinedLists]) Defines a complex field property as diplayed in table mode in the designer. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | args | [<code>TableViewSettings</code>](#TableViewSettings) \| <code>string</code> | Table configuration or column title | | [predefinedLists] | <code>Object.&lt;string, Array.&lt;string&gt;&gt;</code> | | <a name="Required"></a> ## Required([errorMessage]) Defines the property as required. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="Readonly"></a> ## Readonly() Defines the property as read-only and not editable. **Kind**: global function <a name="Range"></a> ## Range(min, max, [errorMessage]) Defines the property values accepted range. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | min | <code>number</code> | The minumu value. | | max | <code>number</code> | The maximum value. | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="MinLength"></a> ## MinLength(length, [errorMessage]) Defines the property value minimum length. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | length | <code>number</code> | The minimum length. | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="MaxLength"></a> ## MaxLength(length, [errorMessage]) Defines the property value maximum length. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | length | <code>number</code> | The maximum length. | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="RegularExpression"></a> ## RegularExpression(pattern, [errorMessage]) Defines the regex expression that would validate the property value. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | pattern | <code>string</code> | The regular expression used for validation. | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="StringLength"></a> ## StringLength(max, [errorMessage]) Defines the string property maximum length. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | max | <code>number</code> | The maximum length. | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="DecimalPlaces"></a> ## DecimalPlaces(decimalPlaces, [errorMessage]) Defined the number property decimal precision. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | decimalPlaces | <code>number</code> | The max decimal places precision of the number. | | [errorMessage] | <code>string</code> | Optional error message to be displayed when validation fails. | <a name="Url"></a> ## Url([errorMessage]) Predefined url validation. **Kind**: global function | Param | Description | | --- | --- | | [errorMessage] | Optional error message to be displayed when validation fails. | <a name="EmailAddress"></a> ## EmailAddress([errorMessage]) Predefined email validation. **Kind**: global function | Param | Description | | --- | --- | | [errorMessage] | Optional error message to be displayed when validation fails. | <a name="ViewSelector"></a> ## ViewSelector([views]) Defines the decorated property as a view selector with [DataType](#DataType)='viewSelector' and uses internally the [Choice](#Choice) decorator. **Kind**: global function | Param | Type | Default | Description | | --- | --- | --- | --- | | [views] | [<code>Array.&lt;ChoiceItem&gt;</code>](#ChoiceItem) | <code>[{Value: &#x27;Default&#x27;}]</code> | Defines the different view choices. | <a name="WidgetLabel"></a> ## WidgetLabel() Defines the property as the predefined SfWidgetLabel and adds the appropriate metadata: - Category: Advanced - Display name: Label - Max length: 30 - Predefined description **Kind**: global function <a name="WidgetEntity"></a> ## WidgetEntity(name, caption) Class decorator Defines the decorated class as a widget entity. Calls internally the [Model](#Model) decorator on the entity class. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | name | <code>string</code> | The widget's name. | | caption | <code>string</code> | The widget display caption. | <a name="SectionsOrder"></a> ## SectionsOrder(sections) Class decorator Defines the widget entity's sections ordering in the designer. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | sections | <code>Array.&lt;string&gt;</code> | The sections titles in the order they need to appear in the designer. | <a name="Model"></a> ## Model([capitalizeProperties]) Class decorator Defines the decorated class as a data model. Enumerates the class properties, defines their name, title and default value (if such is set). The class properties are suggested to be defined with a default value to be enumerated properly. Properties that have their default value set as undefined or null will not get their default type, receiving 'string' as their type and would need to have the [DataType](#DataType) decorator set as well. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | [capitalizeProperties] | <code>boolean</code> | Defines whether the object properties should be capitalized in their designer metadata names but retain their original spelling in the js object. Analoguous to the C# synthax: | **Example** ```js [DataMember(Name = "warning")] public string Warning { get; set; } ```