@univerjs-prosheets-pivotindexclassesSheetspivotdatasourcemodel

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


Class: SheetsPivotDataSourceModel

Extends

Constructors

new SheetsPivotDataSourceModel()

new SheetsPivotDataSourceModel(
   _injector, 
   _univerInstanceService, 
   _lifecycleService, 
   _configService, 
   _commandService, 
   _resourceManagerService): SheetsPivotDataSourceModel

Parameters

ParameterType
_injectorInjector
_univerInstanceServiceIUniverInstanceService
_lifecycleServiceLifecycleService
_configServiceIConfigService
_commandServiceICommandService
_resourceManagerServiceIResourceManagerService

Returns

SheetsPivotDataSourceModel

Overrides

Disposable.constructor

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:43

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:93
_lifecycleServicereadonlyLifecycleServiceundefined-packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:46
collectionChange$publicObservable<ICollectionChangeInfo>undefined-packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:27
fieldsCollectionChange$publicObservable<Record<string, FieldsCollection>>undefined-packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:33
needSameDeleteModelpublic{ deleteUnitId: (unitId) => void; }[][]-packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:36
viewData$publicObservable<{ pivotTableId: string; subUnitId: string; unitId: string; }>undefined-packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:30

Methods

addCollectionByJSON()

addCollectionByJSON(
   token, 
   collectionJSON, 
   sourceRangeInfo, 
   targetCellInfo): IUpdateInfo

Parameters

ParameterType
tokenstring
collectionJSONIFieldsCollectionJSON
sourceRangeInfoIUnitRangeNameWithSubUnitId
targetCellInfoIPivotCellPositionInfo

Returns

IUpdateInfo

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:342


addDirtyPivotTable()

addDirtyPivotTable(dirtyInfo): void

Parameters

ParameterType
dirtyInfoIPivotMutationDirtyViewInfo

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:406


addPivotTable()

addPivotTable(
   unitId, 
   subUnitId, 
   pivotTableId, 
   pivotTable, 
   pivotTableConfig): void

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
pivotTablePivotTable
pivotTableConfigIPivotTableConfig

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:281


broadcastCollectionChange()

broadcastCollectionChange(info): void

Parameters

ParameterType
infoICollectionChangeInfo

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:131


createCollectionWithDataRange()

createCollectionWithDataRange(dataRangeInfo): IUpdateInfo
  • this function just create a collection with data range info, but wil not add it to the dataFieldManager

Parameters

ParameterType
dataRangeInfoIUnitRangeNameWithSubUnitId

Returns

IUpdateInfo

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:349


deleteUnitId()

deleteUnitId(unitId): void

Parameters

ParameterType
unitIdstring

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:328


dispose()

dispose(): void

Returns

void

Overrides

Disposable.dispose

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:394


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:96


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

Disposable.ensureNotDisposed

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:100


fromJSON()

fromJSON(jsonData): void

Parameters

ParameterType
jsonDataIPivotTableJson

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:475


getCollection()

getCollection(unitId, token): FieldsCollection

Parameters

ParameterType
unitIdstring
tokenstring

Returns

FieldsCollection

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:147


getDataFieldManager()

getDataFieldManager(unitId): SheetsPivotDataFieldManager

Parameters

ParameterType
unitIdstring

Returns

SheetsPivotDataFieldManager

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:135


getPivotTableConfig()

getPivotTableConfig(
   unitId, 
   subUnitId, 
   pivotTableId): undefined | IPivotTableConfig

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring

Returns

undefined | IPivotTableConfig

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:301


getPivotTableInstance()

getPivotTableInstance(pivotTableId): undefined | PivotTable

Parameters

ParameterType
pivotTableIdstring

Returns

undefined | PivotTable

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:324


getPivotTableModelConfig()

getPivotTableModelConfig(
   unitId, 
   subUnitId, 
   pivotTableId): undefined | IPivotTableSnapshot
  • get the pivot table model json config

Parameters

ParameterTypeDescription
unitIdstring-
subUnitIdstring-
pivotTableIdstringthe pivot table id

Returns

undefined | IPivotTableSnapshot

the pivot table model json config

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:316


getSubUnitPivotConfigs()

getSubUnitPivotConfigs(unitId, subUnitId): undefined | Map<string, IPivotTableConfig>

Parameters

ParameterType
unitIdstring
subUnitIdstring

Returns

undefined | Map<string, IPivotTableConfig>

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:365


getTargetByPivotId()

getTargetByPivotId(pivotTableId): null | {
  subUnitId: string;
  unitId: string;
}

Parameters

ParameterType
pivotTableIdstring

Returns

null | { subUnitId: string; unitId: string; }

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:369


getTextInfo()

getTextInfo(): Record<string, string>

Returns

Record<string, string>

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:55


getUpdateRangeDeleteIds()

getUpdateRangeDeleteIds(
   unitId, 
   token, 
   dataRangeInfo): undefined | string[]

Parameters

ParameterType
unitIdstring
tokenstring
dataRangeInfoIUnitRangeName

Returns

undefined | string[]

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:151


getViewData()

getViewData(
   unitId, 
   subUnitId, 
   pivotTableId): null | IPivotWorkerItemCache

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring

Returns

null | IPivotWorkerItemCache

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:398


handleMoveRange()

handleMoveRange(params): void

Parameters

ParameterType
paramsIMoveRangeMutationParams

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:66


queryDirtyPivotTable()

queryDirtyPivotTable(dirtyInfo): void

trigger the pivot table query

Parameters

ParameterType
dirtyInfoIPivotMutationDirtyViewInfo

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:429


refreshData()

refreshData(
   collection, 
   updateDataFieldList, 
   dataRangeInfo): void

Parameters

ParameterType
collectionFieldsCollection
updateDataFieldList{ dataField: DataField; index: number; }[]
dataRangeInfoIUnitRangeNameWithSubUnitId

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:353


removeCollections()

removeCollections(unitId, token): void

Parameters

ParameterType
unitIdstring
tokenstring

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:361


removeDataField()

removeDataField(unitId, dataFieldId): void

Parameters

ParameterType
unitIdstring
dataFieldIdstring

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:357


removePivotTable()

removePivotTable(
   unitId, 
   subUnitId, 
   pivotTableId): void

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:286


setPivotTable()

setPivotTable(
   unitId, 
   subUnitId, 
   pivotTableId, 
   pivotTableConfig): void

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
pivotTableConfigIPivotTableConfig

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:297


setTextInfo()

setTextInfo(textInfo): void

Parameters

ParameterType
textInfoRecord<string, string>

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:62


sideEffectUpdateWorkerCache()

sideEffectUpdateWorkerCache(
   unitId, 
   subUnitId, 
   pivotTableId, 
   workerCache?): void

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
workerCache?IPivotWorkerItemCache

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:380


toJSON()

toJSON(unitId): IPivotTableJson

Parameters

ParameterType
unitIdstring

Returns

IPivotTableJson

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:443


updateConfig()

updateConfig(info): void

Parameters

ParameterType
infoISendPivotConfigLocalMutationParams

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:208


updateDirtyPivotTable()

updateDirtyPivotTable(dirtyInfo): void

Parameters

ParameterType
dirtyInfoIPivotMutationDirtyViewInfo

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:410


updateView()

updateView(
   unitId, 
   subUnitId, 
   type, 
   pivotTableId, 
   view, 
   pivotConfig, 
   collectionConfig?, 
   ignoreDirty?): void

Parameters

ParameterTypeDefault value
unitIdstringundefined
subUnitIdstringundefined
typePivotTableOperationEnumundefined
pivotTableIdstringundefined
viewNullable<PivotView>undefined
pivotConfigNullable<IPivotTableConfig>undefined
collectionConfig?IDataFieldManagerJSONundefined
ignoreDirty?booleanfalse

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:223


updateViewData()

updateViewData(ctx, ignoreDirty): void
  • the function is used to save the dirty view data and range for formula calculation

Parameters

ParameterTypeDescription
ctxIViewTranslateCtxthe dirty context
ignoreDirtybooleanthe flag to ignore the dirty view area, only in handleSourceRangeChange , we get a dirty change from the source range change, we need ignore the dirty view area,because the dirty view area has done immediately

Returns

void

Defined in

packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:256