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.

346 lines (345 loc) 17.4 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 { Attributes, Category, Choice, ConditionalVisibility, Content, ContentSection, ContentSectionTitles, CssFieldMappings, DataModel, DataType, DefaultValue, Description, DisplayName, FallbackToDefaultValueWhenEmpty, FieldMappings, KnownFieldTypes, Model, Required, SectionsOrder, ViewSelector, WidgetEntity, WidgetLabel } from '@progress/sitefinity-widget-designers-sdk'; import { ContentListSettings } from '../../editor/widget-framework/content-list-settings'; import { PagerMode } from '../common/page-mode'; import { ContentViewDisplayMode } from '../content-lists-common/content-view-display-mode'; import { DetailPageSelectionMode } from '../content-lists-common/detail-page-selection-mode'; import { PageTitleMode } from '../content-lists-common/page-title-mode'; import { PagerViewModel } from '../pager/pager-view-model'; let ListFieldMapping = class ListFieldMapping { FriendlyName = null; Name = null; }; __decorate([ DataType('string') ], ListFieldMapping.prototype, "FriendlyName", void 0); __decorate([ DataType('string') ], ListFieldMapping.prototype, "Name", void 0); ListFieldMapping = __decorate([ Model() ], ListFieldMapping); export { ListFieldMapping }; export const contentListDefaultViewMeta = { CardsList: [ { fieldTitle: 'Image', fieldType: 'RelatedImage' }, { fieldTitle: 'Title', fieldType: 'ShortText' }, { fieldTitle: 'Text', fieldType: 'Text' } ], ListWithSummary: [ { fieldTitle: 'Title', fieldType: 'ShortText' }, { fieldTitle: 'Text', fieldType: 'Text' }, { fieldTitle: 'Publication date', fieldType: 'DateTime' } ], ListWithImage: [ { fieldTitle: 'Title', fieldType: 'ShortText' }, { fieldTitle: 'Image', fieldType: 'RelatedImage' }, { fieldTitle: 'Text', fieldType: 'Text' } ] }; let ContentListEntity = class ContentListEntity { // Content section SelectedItems = null; SfViewName = 'CardsList'; ListFieldMapping = null; // List setting section ListSettings = null; OrderBy = 'PublicationDate DESC'; // Single item settings DetailPageMode = DetailPageSelectionMode.SamePage; SfDetailViewName = 'Details.BlogPosts.Default'; DetailPage = null; // Advanced SfWidgetLabel = 'Content list'; ContentViewDisplayMode = ContentViewDisplayMode.Automatic; SelectionGroupLogicalOperator = 'AND'; FilterExpression = null; SortExpression = 'PublicationDate DESC'; SelectExpression = '*'; DetailItemSelectExpression = '*'; DisableCanonicalUrlMetaTag = false; PagerMode = PagerMode.URLSegments; PagerTemplate = PagerViewModel.PageNumberDefaultTemplate; PagerQueryTemplate = 'page'; // Metadata fields SeoEnabled = true; MetaTitle = null; MetaDescription = null; PageTitleMode = PageTitleMode.Replace; OpenGraphEnabled = true; OpenGraphTitle = null; OpenGraphDescription = null; OpenGraphImage = null; OpenGraphVideo = null; OpenGraphType = 'article'; // Custom CSS classes CssClasses = null; // Displaying hierarchical content ShowListViewOnChildDetailsView = true; ShowDetailsViewOnChildDetailsView = false; ShowListViewOnEmptyParentFilter = false; Attributes = null; }; __decorate([ Content(), DisplayName(''), ContentSection('Select content to display', 0) ], ContentListEntity.prototype, "SelectedItems", void 0); __decorate([ DefaultValue('CardsList'), DisplayName('List template'), ContentSection('Select content to display', 1), ViewSelector([ { Title: 'Cards list', Value: 'CardsList' }, { Title: 'List with image', Value: 'ListWithImage' }, { Title: 'List with summary', Value: 'ListWithSummary' } ]) ], ContentListEntity.prototype, "SfViewName", void 0); __decorate([ DisplayName('Field mapping'), ContentSection('Select content to display', 2), Description('Specify which fields from the content type you have selected to be displayed in the list.'), FieldMappings(contentListDefaultViewMeta) ], ContentListEntity.prototype, "ListFieldMapping", void 0); __decorate([ DisplayName('Number of list items'), ContentSection('List settings', 0), DataType('listSettings'), DataModel(ContentListSettings) ], ContentListEntity.prototype, "ListSettings", void 0); __decorate([ DisplayName('Sort items'), ContentSection('List settings', 1), DataType('dynamicChoicePerItemType'), Choice({ ServiceUrl: '/Default.Sorters()?frontend=True' }) ], ContentListEntity.prototype, "OrderBy", void 0); __decorate([ DisplayName('Open single item in...'), ContentSection('Single item settings', 0), DataType(KnownFieldTypes.RadioChoice), Choice([ { Title: 'Auto-generated page - same layout as the list page', Value: DetailPageSelectionMode.SamePage }, { Title: 'Select existing page', Value: DetailPageSelectionMode.ExistingPage } ]) ], ContentListEntity.prototype, "DetailPageMode", void 0); __decorate([ DisplayName('Single item template'), ContentSection('Single item settings', 1), ViewSelector([ { Title: 'Details.Blog posts.Default', Value: 'Details.BlogPosts.Default' }, { Title: 'Details.Dynamic.Default', Value: 'Details.Dynamic.Default' }, { Title: 'Details.Events.Default', Value: 'Details.Events.Default' }, { Title: 'Details.List items.Default', Value: 'Details.ListItems.Default' }, { Title: 'Details.News.Default', Value: 'Details.News.Default' } ]) ], ContentListEntity.prototype, "SfDetailViewName", void 0); __decorate([ ContentSection('Single item settings', 1), DisplayName(''), Content({ Type: 'Telerik.Sitefinity.Pages.Model.PageNode', AllowMultipleItemsSelection: false }), ConditionalVisibility('{\u0022conditions\u0022:[{\u0022fieldName\u0022:\u0022DetailPageMode\u0022,\u0022operator\u0022:\u0022Equals\u0022,\u0022value\u0022:\u0022ExistingPage\u0022}],\u0022inline\u0022:\u0022true\u0022}'), Required('Please select a details page.') ], ContentListEntity.prototype, "DetailPage", void 0); __decorate([ WidgetLabel() ], ContentListEntity.prototype, "SfWidgetLabel", void 0); __decorate([ Category('Advanced'), ContentSection('', 1), DisplayName('Content view display mode'), DataType(KnownFieldTypes.Choices), Choice([ { Value: 'Automatic' }, { Value: 'Master' }, { Value: 'Detail' } ]), Description('[{\u0022Type\u0022:1,\u0022Chunks\u0022:[{\u0022Value\u0022:\u0022Based on your selection the items will be\u0022,\u0022Presentation\u0022:[]},{\u0022Value\u0022:\u0022displayed as follows:\u0022,\u0022Presentation\u0022:[2]}]},{\u0022Type\u0022:1,\u0022Chunks\u0022:[{\u0022Value\u0022:\u0022Automatic\u0022,\u0022Presentation\u0022:[0]},{\u0022Value\u0022:\u0022- handles detail item urls like\u0022,\u0022Presentation\u0022:[]},{\u0022Value\u0022:\u0022page/2021/01/01/news.\u0022,\u0022Presentation\u0022:[2]}]},{\u0022Type\u0022:1,\u0022Chunks\u0022:[{\u0022Value\u0022:\u0022Master\u0022,\u0022Presentation\u0022:[0]},{\u0022Value\u0022:\u0022 - as a list that does not handle\u0022,\u0022Presentation\u0022:[]},{\u0022Value\u0022:\u0022detail item urls.\u0022,\u0022Presentation\u0022:[2]},{\u0022Value\u0022:\u0022E.g. page/2021/01/01/news will throw 404.\u0022,\u0022Presentation\u0022:[2]}]},{\u0022Type\u0022:1,\u0022Chunks\u0022:[{\u0022Value\u0022:\u0022Detail\u0022,\u0022Presentation\u0022:[0]},{\u0022Value\u0022:\u0022- shows a selected item in detail\u0022,\u0022Presentation\u0022:[]},{\u0022Value\u0022:\u0022mode only.\u0022,\u0022Presentation\u0022:[2]}]}]') ], ContentListEntity.prototype, "ContentViewDisplayMode", void 0); __decorate([ Category('Advanced'), ContentSection('', 2), DisplayName('Selection group logical operator'), DataType(KnownFieldTypes.RadioChoice), Description('Controls the logic of the filters - whether all conditions should be true (AND) or whether one of the conditions should be true (OR).'), Choice([ { Value: 'AND' }, { Value: 'OR' } ]) ], ContentListEntity.prototype, "SelectionGroupLogicalOperator", void 0); __decorate([ Category('Advanced'), ContentSection('', 3), DisplayName('Filter expression'), DataType('string'), Description('Custom filter expression added to already selected filters.') ], ContentListEntity.prototype, "FilterExpression", void 0); __decorate([ Category('Advanced'), ContentSection('', 4), DisplayName('Sort expression'), Description('Custom sort expression, used if default sorting is not suitable.') ], ContentListEntity.prototype, "SortExpression", void 0); __decorate([ Category('Advanced'), ContentSection('', 5), DisplayName('Select expression'), Description('Custom expression for selecting the fields of the content type. By default \u0027*\u0027 (asterisk) selects all. Use \u0027;\u0027 (semicolon) when listing specific fields. Example: Id; Title; Thumbnail(Id, Title)') ], ContentListEntity.prototype, "SelectExpression", void 0); __decorate([ Category('Advanced'), ContentSection('', 6), DisplayName('Detail item select expression'), Description('Custom expression for selecting the fields of the content type. By default \u0027*\u0027 (asterisk) selects all. Use \u0027;\u0027 (semicolon) when listing specific fields. Example: Id; Title; Thumbnail(Id, Title)') ], ContentListEntity.prototype, "DetailItemSelectExpression", void 0); __decorate([ Category('Advanced'), ContentSection('', 6), DisplayName('Disable canonical URL meta tag'), Description('Disables the canonocal URL generation on widget level.') ], ContentListEntity.prototype, "DisableCanonicalUrlMetaTag", void 0); __decorate([ Category('Advanced'), ContentSection('', 7), DisplayName('Paging mode'), DataType(KnownFieldTypes.RadioChoice), Description('Controls whether the paging works with URL segments or a query parameter.'), Choice([ { Value: PagerMode.URLSegments, Title: 'URL segments' }, { Value: PagerMode.QueryParameter, Title: 'Query parameter' } ]) ], ContentListEntity.prototype, "PagerMode", void 0); __decorate([ Category('Advanced'), ContentSection('', 8), DisplayName('Template for paging URL segments'), Description('Template for the URL segments the widget\u0027s paging will work with. Use {{pageNumber}} for the current page number.'), FallbackToDefaultValueWhenEmpty(), ConditionalVisibility('{\u0022conditions\u0022:[{\u0022fieldName\u0022:\u0022PagerMode\u0022,\u0022operator\u0022:\u0022Equals\u0022,\u0022value\u0022:\u0022URLSegments\u0022}]}') ], ContentListEntity.prototype, "PagerTemplate", void 0); __decorate([ Category('Advanced'), ContentSection('', 9), DisplayName('Template for paging query parameter'), Description('Template for the query parameter the widget\u0027s paging will work with.'), FallbackToDefaultValueWhenEmpty(), ConditionalVisibility('{\u0022conditions\u0022:[{\u0022fieldName\u0022:\u0022PagerMode\u0022,\u0022operator\u0022:\u0022Equals\u0022,\u0022value\u0022:\u0022QueryParameter\u0022}]}') ], ContentListEntity.prototype, "PagerQueryTemplate", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 0), DisplayName('SEO enabled'), DataType(KnownFieldTypes.ChipChoice), Choice({ Choices: [ { Name: 'Yes', Value: 'True' }, { Name: 'No', Value: 'False' } ] }) ], ContentListEntity.prototype, "SeoEnabled", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 1), DisplayName('Meta title'), DataType('string') ], ContentListEntity.prototype, "MetaTitle", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 2), DisplayName('Meta description'), DataType('string') ], ContentListEntity.prototype, "MetaDescription", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 3), DisplayName('Page title mode'), Description('[{\u0022Type\u0022: 1,\u0022Chunks\u0022: [{\u0022Value\u0022: \u0022Setting Page title mode\u0022,\u0022Presentation\u0022: [0]},{\u0022Value\u0022: \u0022Replace \u2013 page title is replaced by the\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022item\u0027s title.\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022Append \u2013 item title is appended to the\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022page title.\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022Hierarchy \u2013 page title will be built by the\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022item\u0027s title and its parent\u0027s title. Value is\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022relevant for the Forums widget only.\u0022,\u0022Presentation\u0022: [2]},{\u0022Value\u0022: \u0022Do not set \u2013 page title will not be altered.\u0022,\u0022Presentation\u0022: []}]}]'), DataType(KnownFieldTypes.Choices), Choice([ { Value: PageTitleMode.Replace }, { Value: PageTitleMode.Append }, { Value: PageTitleMode.Hierarchy }, { Value: PageTitleMode.DoNotSet, Title: 'Do not set' } ]) ], ContentListEntity.prototype, "PageTitleMode", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 4), DisplayName('OpenGraph enabled'), DataType(KnownFieldTypes.ChipChoice), Choice({ Choices: [ { Name: 'Yes', Value: 'True' }, { Name: 'No', Value: 'False' } ] }) ], ContentListEntity.prototype, "OpenGraphEnabled", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 5), DisplayName('OpenGraph title'), DataType('string') ], ContentListEntity.prototype, "OpenGraphTitle", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 6), DisplayName('OpenGraph description'), DataType('string') ], ContentListEntity.prototype, "OpenGraphDescription", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 7), DisplayName('OpenGraph image'), DataType('string') ], ContentListEntity.prototype, "OpenGraphImage", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 8), DisplayName('OpenGraph video'), DataType('string') ], ContentListEntity.prototype, "OpenGraphVideo", void 0); __decorate([ Category('Advanced'), ContentSection('Metadata fields', 9), DisplayName('OpenGraph type'), DataType('string') ], ContentListEntity.prototype, "OpenGraphType", void 0); __decorate([ Category('Advanced'), ContentSection('Custom CSS classes', 0), DisplayName(''), CssFieldMappings(contentListDefaultViewMeta, true) ], ContentListEntity.prototype, "CssClasses", void 0); __decorate([ Category('Advanced'), ContentSection('Displaying hierarchical content', 2), DisplayName('Show parent list view on child details view'), Description('Show or hide the parent list view of this widget when on the same page there is another widget displaying details view of a child item.') ], ContentListEntity.prototype, "ShowListViewOnChildDetailsView", void 0); __decorate([ Category('Advanced'), ContentSection('Displaying hierarchical content', 2), DisplayName('Show parent details view on child details view'), Description('Show or hide the parent details view of this widget when on the same page there is another widget displaying details view of a child item.') ], ContentListEntity.prototype, "ShowDetailsViewOnChildDetailsView", void 0); __decorate([ Category('Advanced'), ContentSection('Displaying hierarchical content', 2), DisplayName('Show child list view if no parent selected'), Description('Show or hide the child list view of this widget when on the same page there is another widget displaying parent items and no parent item is selected to filter the child\u0027s list.') ], ContentListEntity.prototype, "ShowListViewOnEmptyParentFilter", void 0); __decorate([ Attributes('ContentList', 'Content list') ], ContentListEntity.prototype, "Attributes", void 0); ContentListEntity = __decorate([ WidgetEntity('SitefinityContentList', 'Content list'), SectionsOrder([ContentSectionTitles.SelectContentToDisplay, ContentSectionTitles.ListSettings, ContentSectionTitles.SingleItemSettings, '', ContentSectionTitles.CustomCssClasses, ContentSectionTitles.DisplayingHierarchicalContent, ContentSectionTitles.MetadataFields, ContentSectionTitles.Attributes]) ], ContentListEntity); export { ContentListEntity };