@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
Parameter | Type |
---|---|
host | DataFieldManager |
Returns
Properties
Property | Modifier | Type | Default value | Defined in |
---|---|---|---|---|
customFields | public | Record <string , DataField > | {} | field/fields-collection.ts:23 |
dataRecordCount | public | number | undefined | field/fields-collection.ts:26 |
displayNameRecord | public | Record <string , string > | {} | field/fields-collection.ts:19 |
fieldIds | public | string [] | [] | field/fields-collection.ts:15 |
host | readonly | DataFieldManager | undefined | field/fields-collection.ts:27 |
range | public | any | undefined | field/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
Parameter | Type |
---|---|
fieldId | string |
displayName | string |
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
Parameter | Type |
---|---|
jsonData | IFieldsCollectionJSON |
Returns
void
getDataFieldBySourceName()
getDataFieldBySourceName(sourceName): undefined | DataField
Defined in: field/fields-collection.ts:133
Parameters
Parameter | Type |
---|---|
sourceName | string |
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
Parameter | Type | Description |
---|---|---|
fieldId | string | the data field id. |
Returns
string
the display name of the field.
getFieldById()
getFieldById(id): DataField
Defined in: field/fields-collection.ts:118
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The field id. |
Returns
- 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
-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
Parameter | Type |
---|---|
displayName | string |
displayNameRecord ? | Record <string , string > |
Returns
string
hasField()
hasField(fieldId): boolean
Defined in: field/fields-collection.ts:37
Parameters
Parameter | Type |
---|---|
fieldId | string |
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
Parameter | Type | Description |
---|---|---|
sourceName | string | the 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
Parameter | Type |
---|---|
count | number |
Returns
void
setDisplayName()
setDisplayName(
fieldId,
fieldName,
displayNameRecord?): void
Defined in: field/fields-collection.ts:80
Parameters
Parameter | Type |
---|---|
fieldId | string |
fieldName | string |
displayNameRecord ? | Record <string , string > |
Returns
void
setRange()
setRange(range): void
Defined in: field/fields-collection.ts:51
Parameters
Parameter | Type |
---|---|
range | any |
Returns
void
toJSON()
toJSON(): IFieldsCollectionJSON
Defined in: field/fields-collection.ts:157
Returns
updateAllDisplayName()
updateAllDisplayName(): void
Defined in: field/fields-collection.ts:105
Returns
void
Description
remove the field from the collection.