UNPKG

@progress/sitefinity-nextjs-sdk

Version:

Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.

125 lines (124 loc) 5.9 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { WidgetEntity, DisplayName, Description, ContentSection, DataType, DecimalPlaces, Choice, KnownFieldTypes, DataModel, Group, DefaultValue, ContentSectionTitles, Browsable, ConditionalVisibility, Category, PropertyCategory, ViewSelector, Suffix, RangeLimitation } from '@progress/sitefinity-widget-designers-sdk'; import { PrefixOrSuffix } from './interfaces/prefix-or-suffix'; let NumberFieldEntity = class NumberFieldEntity { Label = 'Untitled'; InstructionalText = null; PlaceholderText = null; PredefinedValue = null; PrefixOrSuffix = null; Required = false; Hidden = false; RequiredErrorMessage = null; AllowDecimals = false; ValueRange = null; ValueRangeViolationMessage = 'Number is out of the allowed range'; SfViewName = 'Default'; FieldSize = 'XS'; CssClass = null; SfFieldType; SfFieldName; }; __decorate([ ContentSection(ContentSectionTitles.LabelsAndContent, 1), DefaultValue('Untitled') ], NumberFieldEntity.prototype, "Label", void 0); __decorate([ Description('Suitable for giving examples how the entered value will be used.'), ContentSection(ContentSectionTitles.LabelsAndContent, 2), DisplayName('Instructional text') ], NumberFieldEntity.prototype, "InstructionalText", void 0); __decorate([ DisplayName('Placeholder text'), ContentSection(ContentSectionTitles.LabelsAndContent, 3) ], NumberFieldEntity.prototype, "PlaceholderText", void 0); __decorate([ DisplayName('Predefined value'), DataType('number'), ContentSection(ContentSectionTitles.LabelsAndContent, 4), DecimalPlaces(10) ], NumberFieldEntity.prototype, "PredefinedValue", void 0); __decorate([ Choice({ Choices: [{ 'Title': '- Select -', 'Name': 'none', 'Value': 0 }, { 'Title': 'Prefix', 'Name': 'prefix', 'Value': 1 }, { 'Title': 'Suffix', 'Name': 'suffix', 'Value': 2 }] }), ContentSection(ContentSectionTitles.LabelsAndContent, 5), DataType(KnownFieldTypes.DropdownWithText), Description('Used to add text next to the field such as units, currency, etc.'), DisplayName('Field prefix or suffix'), DataModel(PrefixOrSuffix) ], NumberFieldEntity.prototype, "PrefixOrSuffix", void 0); __decorate([ Group('Options'), DisplayName('Required field'), DataType(KnownFieldTypes.CheckBox), ContentSection(ContentSectionTitles.LabelsAndContent, 6) ], NumberFieldEntity.prototype, "Required", void 0); __decorate([ ContentSection(ContentSectionTitles.LabelsAndContent, 7), DisplayName('Hide field initially (use form rules to display it)'), DataType(KnownFieldTypes.CheckBox), Group('Options') ], NumberFieldEntity.prototype, "Hidden", void 0); __decorate([ DisplayName('Error message if the field is empty'), ContentSection(ContentSectionTitles.LabelsAndContent, 8), DefaultValue('{0} field is required'), ConditionalVisibility('{"conditions":[{"fieldName":"Required","operator":"Equals","value":true}]}') ], NumberFieldEntity.prototype, "RequiredErrorMessage", void 0); __decorate([ DisplayName('Allow decimals'), ContentSection(ContentSectionTitles.Limitations, 1), DataType(KnownFieldTypes.ChipChoice), Choice({ Choices: [ { Name: 'Yes', Value: true }, { Name: 'No', Value: false } ] }), DefaultValue(false) ], NumberFieldEntity.prototype, "AllowDecimals", void 0); __decorate([ ContentSection(ContentSectionTitles.Limitations, 2), DataType('rangeLimitation'), RangeLimitation(true, 'Between'), DisplayName('Number range'), Suffix('value') ], NumberFieldEntity.prototype, "ValueRange", void 0); __decorate([ ContentSection(ContentSectionTitles.Limitations, 3), DisplayName('Error message displayed when the entry is out of range'), DefaultValue('Number is out of the allowed range') ], NumberFieldEntity.prototype, "ValueRangeViolationMessage", void 0); __decorate([ ContentSection(ContentSectionTitles.DisplaySettings), DisplayName('Template'), ViewSelector([{ Value: 'Default' }]) ], NumberFieldEntity.prototype, "SfViewName", void 0); __decorate([ ContentSection(ContentSectionTitles.DisplaySettings), DisplayName('Field size'), DataType(KnownFieldTypes.ChipChoice), DefaultValue('XS'), Choice({ Choices: [{ Title: 'None', Value: 'None', Tooltip: 'None. Display system default size for this field.' }, { Title: 'XS', Value: 'XS', Tooltip: 'Extra Small. Takes 25% of the container\'s width.' }, { Title: 'S', Value: 'S', Tooltip: 'Small. Takes 50% of the container\'s width.' }, { Title: 'M', Value: 'M', Tooltip: 'Medium. Takes 75% of the container\'s width.' }, { Title: 'L', Value: 'L', Tooltip: 'Large. Takes 100% of the container\'s width.' }], ChipMaxThreshold: 5 }) ], NumberFieldEntity.prototype, "FieldSize", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection('AdvancedMain', 2), DisplayName('CSS class') ], NumberFieldEntity.prototype, "CssClass", void 0); __decorate([ Browsable(false) ], NumberFieldEntity.prototype, "SfFieldType", void 0); __decorate([ Browsable(false) ], NumberFieldEntity.prototype, "SfFieldName", void 0); NumberFieldEntity = __decorate([ WidgetEntity('SitefinityNumberField', 'Number') ], NumberFieldEntity); export { NumberFieldEntity };