@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
Parameter | Type |
---|---|
host | DataFieldManager |
Returns
Defined in
field/fields-collection.ts:29
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
- add a field to the collection. the field should be ensured in the host.
Parameters
Parameter | Type |
---|---|
fieldId | string |
displayName | string |
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
Parameter | Type |
---|---|
jsonData | IFieldsCollectionJSON |
Returns
void
Defined in
field/fields-collection.ts:172
getDataFieldBySourceName()
getDataFieldBySourceName(sourceName): undefined | DataField
Parameters
Parameter | Type |
---|---|
sourceName | string |
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
Parameter | Type | Description |
---|---|---|
fieldId | string | the data field id. |
Returns
string
the display name of the field.
Defined in
field/fields-collection.ts:72
getFieldById()
getFieldById(id): DataField
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The field id. |
Returns
- 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
-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
Parameter | Type |
---|---|
displayName | string |
displayNameRecord ? | Record <string , string > |
Returns
string
Defined in
field/fields-collection.ts:84
hasField()
hasField(fieldId): boolean
Parameters
Parameter | Type |
---|---|
fieldId | string |
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
Parameter | Type | Description |
---|---|---|
sourceName | string | the 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
Parameter | Type |
---|---|
count | number |
Returns
void
Defined in
field/fields-collection.ts:125
setDisplayName()
setDisplayName(
fieldId,
fieldName,
displayNameRecord?): void
Parameters
Parameter | Type |
---|---|
fieldId | string |
fieldName | string |
displayNameRecord ? | Record <string , string > |
Returns
void
Defined in
field/fields-collection.ts:80
setRange()
setRange(range): void
Parameters
Parameter | Type |
---|---|
range | any |
Returns
void
Defined in
field/fields-collection.ts:51
toJSON()
toJSON(): IFieldsCollectionJSON
Returns
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