Skip to content

Commit

Permalink
Add PercentageColumn [skip-install]
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Apr 17, 2024
1 parent 35b2a0c commit b904f08
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import strings from 'PortfolioWebPartsStrings'
import { tryParsePercentage } from 'pp365-shared-library'
import React from 'react'
import { ColumnRenderComponent } from '../types'

export const PercentageColumn: ColumnRenderComponent = (props) => (
<span>{tryParsePercentage(props.columnValue, true, 0)}</span>
)

PercentageColumn.key = 'percentage'
PercentageColumn.id = 'Percentage'
PercentageColumn.displayName = strings.ColumnRenderOptionPercentage
PercentageColumn.iconName = 'CalculatorPercentage'
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { GetDataTypeProperties, IColumnDataTypeFieldOption } from './ColumnDataT
import { BooleanColumn } from './BooleanColumn'
import { CurrencyColumn } from './CurrencyColumn'
import { NumberColumn } from './NumberColumn'
import { PercentageColumn } from './PercentageColumn'
import { DateColumn } from './DateColumn'
import { DialogColumn } from './DialogColumn'
import { FileNameColumn } from './FileNameColumn'
Expand Down Expand Up @@ -234,6 +235,7 @@ export function useColumnRenderComponentRegistry() {
FileNameColumn,
CurrencyColumn,
NumberColumn,
PercentageColumn,
ListColumn,
DialogColumn,
TagsColumn,
Expand All @@ -254,11 +256,5 @@ export function useColumnRenderComponentRegistry() {
strings.ColumnRenderOptionNote,
'EditStyle'
)
ColumnRenderComponentRegistry.registerColumnRenderOption(
'percentage',
'Percentage',
strings.ColumnRenderOptionPercentage,
'CalculatorPercentage'
)
}, [])
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type ColumnDataType =
| 'date'
| 'currency'
| 'number'
| 'percentage'
| 'tags'
| 'boolean'
| 'url'
Expand Down
6 changes: 3 additions & 3 deletions Templates/Portfolio/Objects/Lists/Datakilder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@
<pnp:DataRow>
<pnp:DataValue FieldName="GtDataSourceId">fbe4dcc8-ed4c-4c0a-ad52-4247ca90f9b3</pnp:DataValue>
<pnp:DataValue FieldName="Title">Alle ressursallokeringer for underområder</pnp:DataValue>
<pnp:DataValue FieldName="GtSearchQuery">(ContentTypeId:0x010004EAFF7AFCC94C2680042E6881264120* OR ContentTypeId:0x010029F45E75BA9CE340A83EFFB2927E11F4*) DepartmentId:{{sitecollectionid}}</pnp:DataValue>
<pnp:DataValue FieldName="GtSearchQuery">ContentTypeId:0x010004EAFF7AFCC94C2680042E6881264120* DepartmentId:{{sitecollectionid}}</pnp:DataValue>
<pnp:DataValue FieldName="GtDataSourceCategory">Ressursallokering</pnp:DataValue>
<pnp:DataValue FieldName="GtProjectContentColumns">57,58,59,60,61,62,63,64,65</pnp:DataValue>
<pnp:DataValue FieldName="GtProjectContentRefiners">57,58,62,64</pnp:DataValue>
<pnp:DataValue FieldName="GtProjectContentColumns">57,58,59,60,61,62,63</pnp:DataValue>
<pnp:DataValue FieldName="GtProjectContentRefiners">57,58,62</pnp:DataValue>
<pnp:DataValue FieldName="GtIconName">SizeLegacy</pnp:DataValue>
<pnp:DataValue FieldName="GtDataSourceLevel">Overordnet/Program</pnp:DataValue>
</pnp:DataRow>
Expand Down

0 comments on commit b904f08

Please sign in to comment.