@univerjs-pro/engine-pivot v0.5.0-beta.1 • Docs


Class: FieldsCollection

Represents the collection of fields in the pivot table. which one to one with a pivot table.

Description

The collection of fields in the pivot table. The fields collection uses shared the base data field id.For Grouped fields or calculated fields, it will save in custom field. FieldsCollection

Param

The data field manager.

Constructors

new FieldsCollection()

new FieldsCollection(host): FieldsCollection

Parameters

ParameterType
hostDataFieldManager

Returns

FieldsCollection

Defined in

field/fields-collection.ts:29

Properties

PropertyModifierTypeDefault valueDefined in
customFieldspublicRecord<string, DataField>{}field/fields-collection.ts:23
dataRecordCountpublicnumberundefinedfield/fields-collection.ts:26
displayNameRecordpublicRecord<string, string>{}field/fields-collection.ts:19
fieldIdspublicstring[][]field/fields-collection.ts:15
hostreadonlyDataFieldManagerundefinedfield/fields-collection.ts:27
rangepublicanyundefinedfield/fields-collection.ts:25

Methods

addField()

addField(fieldId, displayName): void
  • add a field to the collection. the field should be ensured in the host.

Parameters

ParameterType
fieldIdstring
displayNamestring

Returns

void

Defined in

field/fields-collection.ts:61


dispose()

dispose(): void

Returns

void

Defined in

field/fields-collection.ts:197


fromJSON()

fromJSON(jsonData): void

Parameters

ParameterType
jsonDataIFieldsCollectionJSON

Returns

void

Defined in

field/fields-collection.ts:172


getDataFieldBySourceName()

getDataFieldBySourceName(sourceName): undefined | DataField

Parameters

ParameterType
sourceNamestring

Returns

undefined | DataField

Defined in

field/fields-collection.ts:133


getDataRecordCount()

getDataRecordCount(): number

Returns

number

Defined in

field/fields-collection.ts:129


getDisplayName()

getDisplayName(fieldId): string

get the display name of the field by the field id in this collection, in different collection, the display name may be different.

Parameters

ParameterTypeDescription
fieldIdstringthe data field id.

Returns

string

the display name of the field.

Defined in

field/fields-collection.ts:72


getFieldById()

getFieldById(id): DataField

Parameters

ParameterTypeDescription
idstringThe field id.

Returns

DataField

  • The field.

Description

Gets the field by the specified id.

Defined in

field/fields-collection.ts:118


getFieldIds()

getFieldIds(): string[]

Returns

string[]

Defined in

field/fields-collection.ts:33


getFieldInfo()

getFieldInfo(): IDataFieldInfo[]

Returns

IDataFieldInfo[]

-returns the field infos.

Description

Gets the field by the specified name.

Defined in

field/fields-collection.ts:146


getUniqueDataFieldName()

getUniqueDataFieldName(displayName, displayNameRecord?): string

Parameters

ParameterType
displayNamestring
displayNameRecord?Record<string, string>

Returns

string

Defined in

field/fields-collection.ts:84


hasField()

hasField(fieldId): boolean

Parameters

ParameterType
fieldIdstring

Returns

boolean

Defined in

field/fields-collection.ts:37


hasSourceName()

hasSourceName(sourceName): boolean

find the is there has a data field whose name is the same as the sourceName.

Parameters

ParameterTypeDescription
sourceNamestringthe source name of the field.

Returns

boolean

  • true if has the field, otherwise false.

Defined in

field/fields-collection.ts:46


setDataRecordCount()

setDataRecordCount(count): void

Parameters

ParameterType
countnumber

Returns

void

Defined in

field/fields-collection.ts:125


setDisplayName()

setDisplayName(
   fieldId, 
   fieldName, 
   displayNameRecord?): void

Parameters

ParameterType
fieldIdstring
fieldNamestring
displayNameRecord?Record<string, string>

Returns

void

Defined in

field/fields-collection.ts:80


setRange()

setRange(range): void

Parameters

ParameterType
rangeany

Returns

void

Defined in

field/fields-collection.ts:51


toJSON()

toJSON(): IFieldsCollectionJSON

Returns

IFieldsCollectionJSON

Defined in

field/fields-collection.ts:157


updateAllDisplayName()

updateAllDisplayName(): void

Returns

void

Description

remove the field from the collection.

Defined in

field/fields-collection.ts:105