@univerjs-pro/engine-pivot v0.5.4


Class: FieldsCollection

Defined in: field/fields-collection.ts:11

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

Defined in: field/fields-collection.ts:29

Parameters

ParameterType
hostDataFieldManager

Returns

FieldsCollection

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

Defined in: field/fields-collection.ts:61

  • add a field to the collection. the field should be ensured in the host.

Parameters

ParameterType
fieldIdstring
displayNamestring

Returns

void


dispose()

dispose(): void

Defined in: field/fields-collection.ts:197

Returns

void


fromJSON()

fromJSON(jsonData): void

Defined in: field/fields-collection.ts:172

Parameters

ParameterType
jsonDataIFieldsCollectionJSON

Returns

void


getDataFieldBySourceName()

getDataFieldBySourceName(sourceName): undefined | DataField

Defined in: field/fields-collection.ts:133

Parameters

ParameterType
sourceNamestring

Returns

undefined | DataField


getDataRecordCount()

getDataRecordCount(): number

Defined in: field/fields-collection.ts:129

Returns

number


getDisplayName()

getDisplayName(fieldId): string

Defined in: field/fields-collection.ts:72

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.


getFieldById()

getFieldById(id): DataField

Defined in: field/fields-collection.ts:118

Parameters

ParameterTypeDescription
idstringThe field id.

Returns

DataField

  • The field.

Description

Gets the field by the specified id.


getFieldIds()

getFieldIds(): string[]

Defined in: field/fields-collection.ts:33

Returns

string[]


getFieldInfo()

getFieldInfo(): IDataFieldInfo[]

Defined in: field/fields-collection.ts:146

Returns

IDataFieldInfo[]

-returns the field infos.

Description

Gets the field by the specified name.


getUniqueDataFieldName()

getUniqueDataFieldName(displayName, displayNameRecord?): string

Defined in: field/fields-collection.ts:84

Parameters

ParameterType
displayNamestring
displayNameRecord?Record<string, string>

Returns

string


hasField()

hasField(fieldId): boolean

Defined in: field/fields-collection.ts:37

Parameters

ParameterType
fieldIdstring

Returns

boolean


hasSourceName()

hasSourceName(sourceName): boolean

Defined in: field/fields-collection.ts:46

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.

setDataRecordCount()

setDataRecordCount(count): void

Defined in: field/fields-collection.ts:125

Parameters

ParameterType
countnumber

Returns

void


setDisplayName()

setDisplayName(
   fieldId, 
   fieldName, 
   displayNameRecord?): void

Defined in: field/fields-collection.ts:80

Parameters

ParameterType
fieldIdstring
fieldNamestring
displayNameRecord?Record<string, string>

Returns

void


setRange()

setRange(range): void

Defined in: field/fields-collection.ts:51

Parameters

ParameterType
rangeany

Returns

void


toJSON()

toJSON(): IFieldsCollectionJSON

Defined in: field/fields-collection.ts:157

Returns

IFieldsCollectionJSON


updateAllDisplayName()

updateAllDisplayName(): void

Defined in: field/fields-collection.ts:105

Returns

void

Description

remove the field from the collection.