8.0.0-build.49.1 • Published 5 months ago

@pega/lists-react v8.0.0-build.49.1

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
5 months ago

Welcome to @pega/lists-react

To import

import { RepeatingStructures } from '@pega/lists-react';

To consume

<RepeatingStructures
  meta={meta}
  ref={compRef}
  apiContext={{
    ...apiContext,
    stateUpdateCallback
  }}
  renderFactory={renderFactory}
  formatters={repeatFormatters}
  additionalInfo={additionalInfo}
  ...
/>

Table configuration (meta - prop)

PropertyValue typeMandatoryDefault valueNotes
itemKeyStringYesName of a field to use as the key of the rendered item(s) in the view. This field need not necessarily be one of the fields configured for display as part of the field definitions array. This field is directly looked up in the item data.
patchQueryFieldsString arrayNoArray of fields(extra) to be included in a query
sortOrderString arrayNo['asc', 'desc', null]Array denoting sort operation order. Default is a tri-state sort
displayDensityArray of optionsNo[{ name: 'Short', id: '1' }, { name: 'Medium', id: '2' },{ name: 'Tall', id: '3' },{ name: 'Full content', id: '4' }]A map of names(for display) and id(for persistence). The id values have specific behavior(s) associated with them
heightObjectNoheight: { minHeight: 600 }Height of the view. Full set of options include height: { minHeight: 600, /* Minimum height in pixels to the view */, height: 700, /* Explicit height in pixels - fitHeightToElement option is ignored */ fitHeightToElement: el, /* Fit view to a specific HTML element (or string query selector) in the DOM heightwise */ deltaAdjustment: 10 /* A height adjustment value in pixels */ autoSize: true /* Responsively Height will be adjusted on window resize only if you have given fitHeightToElement */, maxHeight: 800, /* Maximum height value in pixels to the view or a css variable (--view-height) */}
toggleFieldVisibilityBooleanNotrueAllow show/hide of fields
groupingBooleanNotrueAllow grouping on fields
templateStringYesTableDetermines the view of a Repeating Structure, values:'Table','Gallery','Timeline'
basicModeBooleanNofalseDisplay views 'Table','Gallery','Timeline' with full or condensed toolbar. Default shows full toolbar.
editingBooleanNofalseAllow editing on fields
deletingBooleanNofalseAllow deleting of rows
personalizationBooleanNotrueAllow personalization views
enableAppDefaultBooleanNofalseEnable app default personalization options
nonPersonalizationViewNameStringNoInitial viewName to be shown for non personalized view
reorderFieldsBooleanNotrueAllow field reordering through a drag and drop action
reorderItems (experimental)BooleanNofalseAllow row reordering through a drag and drop action
dragHandle (experimental)BooleanNofalseAllow to add a column for drag handle
globalSearchBooleanNotrueBrings in a search widget to allow searching across all text type fields
toolbarBooleanNotrueDisplay toolbar on the view
showCountBooleanNotrueDisplay count in toolbar
defaultRowHeightStringNoundefinedRow density id value from displayDensity options
allowBulkActionsbooleanNofalseRenders the 'Bulk actions' button in the table toolbar, which gets enabled on row selection
dateFunctionsObjectNoundefinedEnables date-functions like MONTHS/WEEKS/... during Grouping and Filtering. (Object structure)
relativeDatesBooleanNofalseEnables Relative Dates, such as "Last 7 days" or "Current Year", in Filtering for DateTime or Date_Only values.
footerBooleanNotrueDisplay footer on the view
dynamicFieldTemplatesObjectNodynamicFieldTemplates: [{ name: 'Comma separated', value: 'comma',selected: true }, { name: 'Space separated', value: 'space' }, { name: 'Multi line', value: 'multiline' }, { name: 'Forward slash', value: 'forwardslash' }]Templates for dynamic fields. See section on Dynamic fields
titleStringNo'\<label not set>'Repeating Structure Title
iconStringNo'picture'Repeating Structure Icon
headerBarBooleanNofalseDisplay Header Bar
showHeaderIconsBooleanNotrueDisplay Respective Header Icons at field labels based on type
rowActionsArray<object>No[]list of available static actions for an editable table with following properties[{ text: 'Open in a new tab', id: 'row-new-tab', onClick: () => {} }]
selectionModeStringNo[]Decides type of row selection mode (radio for single/ checkbox for multi) possible values single / multi / multi-on-hover
toolbarActionsArray<Object>No[]List of available static actions at table level (shown in toolbar/ header bar) with following properties [{ text: 'Add', tooltip: 'Add story', id: 'Add', onClick: () => {}}]
selectionCountThresholdNumberNoDisplays select-all checkbox if selectionMode is multi-on-hover and the records count is not greater than threshold
disableSelectionOnLoadBooleanNofalseTo Disable/Enable selection of rows
requiredOnLoadBooleanNofalseTo show asterisk(*) symbol on table header in case of Data Reference/Embedded views. (Note: This works perfectly if the personalization is off.)
timezoneStringNoTimezone which is passed to formatter
localeStringNodocument.documentElement.langLocale which is passed to formatter function
refreshActionObjectNoAction to support manual Refresh from consumer of Repeating structure. Whenever Repeating structure is notified with Refresh action It will show a banner by consuming this action info. Structure : {id: 'uniqueId for banner', message: To show specific message on banner related to refresh notification, action : { text: Action button text, onClick: Function to be executed on click of action that will perform refresh of data based on consumer apiContext logic}} Example: {id: 'refreshBanner', message: 'New records have been added',action: { text: 'Click to refresh.', onClick }}

| displayFeatures | Object | No | displayFeatures:{filter:true, grouping:true, sort:true} | Allow display of features-Group, Sort, Filter |

Field configuration

fieldDefs

A mandatory array of objects with the following keys

PropertyValue typeMandatoryDefault valueNotes
typeStringYesnumber or text or date or datetime
nameStringYesActual field name in data
idStringYesPersistent ID of the field, typically the same as the name
labelStringYes
categoryArray<Object>NoCategory of the field which should of the format {label:'categoryName'} where index denotes the level of category. ClassName for regular fields and association name for associated fields. Example: category:[{label:'Bugs class'}]
showCategoryInHeaderLabelBooleanNofalseShow category in header label. The header will be displayed in format {categoryName}.{label} where categoryName will be all the category's labels combined with .(dot) notation
tooltipStringNoCurrent Field's formatted valueDefines Field whose value needs to be shown as HelperText e.g tooltip: 'pzDescription' field value for pyID field
showTooltipBooleanNotrueEnable/Disable tooltip on column
widthNumberNo150Pixel width of the field
minWidthNumberNo90Minimum width in pixels, field width cannot be resized below this threshold
filterBooleanNotrueAllow filtering on this field
filterPickListBooleanNofalseFilter popup presents a pick list to choose values from
sortBooleanNotrueAllow sorting
sortDirectionStringNoasc or desc. Allows sorting on load. If this property is present, then sortPriority is mandatory
sortPriorityNumberNoSets the priority on filed for multi sorting(1 takes highest precedence). Allows sorting on load. If this property is present, then sortDirection is mandatory
groupingBooleanNotrueEnable grouping
resizeBooleanNotrueEnable resizing
reorderFieldsBooleanNotrueAllows reordering of column.
freezeBooleanNotrueEnable freezing
fillAvailableSpaceBooleanNofalsefield will resize to available excess width. First field definition will be honoured if configured on multiple columns.
requiredBooleanNofalseAn asterisk will be added in the table header cell right after the label
toggleBooleanNotrueEnable field show/hide
showBooleanNotrueField shows in the view by default. Can be set to false to toggle it in later
showMenuBooleanNotrueShow/hide field level Header menu
aggregationBooleanNotrueAllow aggregation on column
combineColumnBooleanNotrueAllow combining columns
customizeColumnBooleanNotrueAllow customizing column label and formatting
noContextMenuBooleanNofalseDisable context menu at cells
contextMenuOptionsArray<Object>No[]This property extends options provided on right click in a cell context. Object structure: { id: <string(required)>, icon: <optional>, label: <required>, show: <bool(optional)>, disabled: <bool(optional)> onClick: <Func(target, field, rowContext)(optional)> }
cellRendererStringNoName of a custom component that is made available through the render factory. Check section on cellRenderer
hierarchicalInfoObjectNoEnable 'Hierarchical' display mode on column if hierarchicalInfo exists. Object structure: {parentId: string, materializedPathId: string, targetId: string, sortById:<string(optional)>}
cellAlignStringNoAlign cell to left/right/center. Values accepted: 'left', 'right', 'center'
hideGroupColumnNameLabelbooleanNofalseColumn name label in group header will be hidden when set to 'true'
filterParamsObjectNoTODOFilter options for various field

API Context

APIArgumentsMandatoryNotes
stateUpdateCallbackstate: updated state from the componentNoThis api gets called with updated state whenever it gets modified
setSelectedRowsselectedRows: selected rows data on the tableYesThis api sets the selected rows data on the state
getSelectedRowsThis api gets the selected rows data from the state

Formatters

Value typeMandatoryNotes
ObjectNoObject of formatter functions mapping where each function accepts 2 parameters, (inputValue, Options). Options is an object having properties: {locale, timezone, rowData, fieldDef, translate}

Render Factory

Prop keyMandatoryDescriptionReturn type
renderFactoryNoThis should be a factory function which receives two arguments where second argument is optional. First argument value is the cell renderer name (if added in fieldDefs of that column). Second argument value is metadata which contains info configured for that column. It should return a component definition (or an object that contains component definition --> see Return type). This component definition will be used by RepeatingStructures to render a cell with the component provided by renderFactory. If component definition is not provided from render factory or renderFactory is not provided to Repeating structures then cell will be rendered directly with value derived for the cell or the formatted value(if formatter is provided for that column)Repeating structures currently support 2 return types from renderFactory function a component definition function. (OR) an object that contains 2 keys {props: props that you want to be passed to component along with cellProps, component: a component definition function}

Presets

Value typeMandatoryNotes
Array<Array<Object>>NoThis property value comes from authorization

Other Props

PropertyValue typeMandatoryDefault valueNotes
toolBarOptionsArray<Array<Object>>No[]This property extends options provided in toolbar. Object structure: { id: <string(required)>, icon: <optional>, label: <required>, show: <bool(optional)> , onClick: <Func(optional)> }
onViewReadyFunctionNonullThis function acts as a callback that is invoked when the view is ready
onRowClickActionFunctionNonullThis function is invoked when an item/entry is clicked. The corresponding item data is passed into the function on invocation
showExportToExcelOptionBooleanNofalseThis option is shown in the toolbar menu when the ListView is sourced from queryable DataPage
additionalInfoObjectNo`undefined | AdditionalInfo displayed on the toolbar is passed as is to List Toolbar component

State

FeaturePropertyValue typeExample
Column reordercolOrderArray<string> - Array of column idcolOrder: ["A", "custom1590925631168", "2", "3", "D", "10", "11"]
Column resizecolumnWidthsObject - key: columnId, value: column widthcolumnWidths: {10: 132.5, 11: 132.5, 12: 132.5, 2: 235.5, 3: 353}
Column freezefreezeColumnsArray<string> - Array of column idfreezeColumns: ["3", "10"]
Column show/hidehiddenColumnsArray<string> - Array of column idhiddenColumns: ["8", "9"]
DensityselectedHeightOptionString - id value from displayDensity table configuration propertyselectedHeightOption: "4"
SortsortingOrderArray<object> - [{columnId: string, order: [asc\|desc], sequence: number}]javascript sortingOrder: [ {columnId: "2", order: "asc", sequence: 1}, {columnId: "A", order: "desc", sequence: 2} ]
FilterfilterExpressionObject - output of condition builderRefer - Condition builder documentation
GroupgroupsArray<object> - [{columnId: string, level: number, order: [asc\|desc]}]groups: [ {columnId: "F", level: 0, order: "asc"}, {columnId: "D", level: 1, order: "asc"} ]
AggregationaggregationInfoArray<object> - [{columnId: string, type: [Sum\|Max\|Min\|Avg]}]aggregationInfo: [ {columnId: "D", type: "Max"}, {columnId: "11", type: "Avg"} ]
Merge columncustomFieldsArray<object> - {id: string - should be unique, expression: array, primaryColumnId: string, label: string }customFields: [ { id: 'custom4', label: 'MyCustomColumn', primaryColumnId: '2', expression: ['2', '1', ['template1'], '3', ['template2'] ] } ]

Reference to the Component ("compRef" in below example)

APIs exposed on the component ref are accessible via compRef.current.<API_NAME> (like compRef.current.refreshView)

API_NAMEDefault valuesNotesExample
8.0.0-build.49.1

5 months ago

8.0.0-build.49.0

5 months ago

8.0.0-build.48.1

5 months ago

8.0.0-build.48.0

5 months ago

8.0.0-build.47.7

5 months ago

8.0.0-build.47.6

5 months ago

8.0.0-build.47.5

5 months ago

8.0.0-build.47.4

5 months ago

8.0.0-build.47.3

5 months ago

8.0.0-build.47.2

5 months ago

8.0.0-build.47.1

5 months ago

8.0.0-build.47.0

5 months ago

8.0.0-build.46.1

5 months ago

8.0.0-build.46.0

5 months ago

8.0.0-build.45.3

5 months ago

8.0.0-build.45.2

5 months ago

8.0.0-build.45.1

5 months ago

8.0.0-build.45.0

5 months ago

8.0.0-build.44.6

5 months ago

8.0.0-build.44.5

5 months ago

8.0.0-build.44.4

5 months ago

8.0.0-build.44.3

5 months ago

8.0.0-build.44.2

5 months ago

8.0.0-build.44.1

5 months ago

8.0.0-build.44.0

5 months ago

8.0.0-build.43.6

5 months ago

8.0.0-build.43.5

5 months ago

8.0.0-build.43.4

5 months ago

8.0.0-build.43.3

5 months ago

8.0.0-build.43.2

5 months ago

8.0.0-build.43.1

6 months ago

8.0.0-build.43.0

6 months ago

8.0.0-build.42.0

6 months ago

8.0.0-build.41.2

6 months ago

8.0.0-build.41.1

6 months ago

8.0.0-build.41.0

6 months ago

8.0.0-build.40.2

6 months ago

8.0.0-build.40.1

6 months ago

8.0.0-build.40.0

6 months ago

8.0.0-build.39.7

6 months ago

8.0.0-build.39.6

6 months ago

8.0.0-build.39.5

6 months ago

8.0.0-build.39.4

6 months ago

8.0.0-build.39.3

6 months ago

8.0.0-build.39.2

6 months ago

8.0.0-build.39.1

6 months ago

8.0.0-build.39.0

6 months ago

8.0.0-build.38.5

6 months ago

8.0.0-build.38.4

6 months ago

8.0.0-build.38.3

6 months ago

8.0.0-build.38.2

6 months ago

8.0.0-build.38.1

6 months ago

8.0.0-build.38.0

6 months ago

8.0.0-build.37.2

6 months ago

8.0.0-build.37.1

6 months ago

8.0.0-build.37.0

6 months ago

8.0.0-build.36.4

6 months ago

8.0.0-build.36.3

6 months ago

8.0.0-build.36.2

7 months ago

8.0.0-build.36.1

7 months ago

8.0.0-build.36.0

7 months ago

8.0.0-build.35.7

7 months ago

8.0.0-build.35.6

7 months ago

8.0.0-build.35.5

7 months ago

8.0.0-build.35.4

7 months ago

8.0.0-build.35.3

7 months ago

8.0.0-build.35.2

7 months ago

8.0.0-build.35.1

7 months ago

8.0.0-build.35.0

7 months ago

8.0.0-build.34.5

7 months ago

8.0.0-build.34.4

7 months ago

8.0.0-build.34.3

7 months ago

8.0.0-build.34.2

7 months ago

8.0.0-build.34.1

7 months ago

8.0.0-build.34.0

7 months ago

8.0.0-build.33.0

7 months ago

8.0.0-build.32.0

7 months ago

8.0.0-build.31.1

7 months ago

8.0.0-build.31.0

7 months ago

8.0.0-build.30.3

7 months ago

8.0.0-build.30.2

7 months ago

8.0.0-build.30.1

7 months ago

8.0.0-build.30.0

7 months ago

8.0.0-build.29.2

7 months ago

8.0.0-build.29.1

7 months ago

8.0.0-build.29.0

7 months ago

8.0.0-build.28.11

7 months ago

8.0.0-build.28.10

8 months ago

8.0.0-build.28.9

8 months ago

8.0.0-build.28.8

8 months ago

8.0.0-build.28.7

8 months ago

8.0.0-build.28.6

8 months ago

8.0.0-build.28.5

8 months ago

8.0.0-build.28.4

8 months ago

8.0.0-build.28.3

8 months ago

8.0.0-build.28.2

8 months ago

8.0.0-build.28.1

8 months ago

8.0.0-build.28.0

8 months ago

8.0.0-build.27.14

8 months ago