@univerjs-prosheets-pivotindexclassesSheetspivotdatasourcemodel

@univerjs-pro/sheets-pivot v0.5.4


Class: SheetsPivotDataSourceModel

Defined in: packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:19

Extends

Constructors

new SheetsPivotDataSourceModel()

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

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

Parameters

ParameterType
_injectorInjector
_univerInstanceServiceIUniverInstanceService
_lifecycleServiceLifecycleService
_configServiceIConfigService
_commandServiceICommandService
_resourceManagerServiceIResourceManagerService

Returns

SheetsPivotDataSourceModel

Overrides

Disposable.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
_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

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

Parameters

ParameterType
tokenstring
collectionJSONIFieldsCollectionJSON
sourceRangeInfoIUnitRangeNameWithSubUnitId
targetCellInfoIPivotCellPositionInfo

Returns

IUpdateInfo


addDirtyPivotTable()

addDirtyPivotTable(dirtyInfo): void

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

Parameters

ParameterType
dirtyInfoIPivotMutationDirtyViewInfo

Returns

void


addPivotTable()

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

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
pivotTablePivotTable
pivotTableConfigIPivotTableConfig

Returns

void


broadcastCollectionChange()

broadcastCollectionChange(info): void

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

Parameters

ParameterType
infoICollectionChangeInfo

Returns

void


createCollectionWithDataRange()

createCollectionWithDataRange(dataRangeInfo): IUpdateInfo

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

  • this function just create a collection with data range info, but wil not add it to the dataFieldManager

Parameters

ParameterType
dataRangeInfoIUnitRangeNameWithSubUnitId

Returns

IUpdateInfo


deleteUnitId()

deleteUnitId(unitId): void

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

Parameters

ParameterType
unitIdstring

Returns

void


dispose()

dispose(): void

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

Returns

void

Overrides

Disposable.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

Disposable.ensureNotDisposed


fromJSON()

fromJSON(jsonData): void

Defined in: packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:477

Parameters

ParameterType
jsonDataIPivotTableJson

Returns

void


getCollection()

getCollection(unitId, token): FieldsCollection

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

Parameters

ParameterType
unitIdstring
tokenstring

Returns

FieldsCollection


getDataFieldManager()

getDataFieldManager(unitId): SheetsPivotDataFieldManager

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

Parameters

ParameterType
unitIdstring

Returns

SheetsPivotDataFieldManager


getPivotTableConfig()

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

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring

Returns

undefined | IPivotTableConfig


getPivotTableInstance()

getPivotTableInstance(pivotTableId): undefined | PivotTable

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

Parameters

ParameterType
pivotTableIdstring

Returns

undefined | PivotTable


getPivotTableModelConfig()

getPivotTableModelConfig(
   unitId, 
   subUnitId, 
   pivotTableId): 
  | undefined
  | IPivotTableSnapshot

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

  • get the pivot table model json config

Parameters

ParameterTypeDescription
unitIdstring-
subUnitIdstring-
pivotTableIdstringthe pivot table id

Returns

| undefined | IPivotTableSnapshot

the pivot table model json config


getSubUnitPivotConfigs()

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

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

Parameters

ParameterType
unitIdstring
subUnitIdstring

Returns

| undefined | Map<string, IPivotTableConfig>


getTargetByPivotId()

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

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

Parameters

ParameterType
pivotTableIdstring

Returns

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


getTextInfo()

getTextInfo(): Record<string, string>

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

Returns

Record<string, string>


getUpdateRangeDeleteIds()

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

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

Parameters

ParameterType
unitIdstring
tokenstring
dataRangeInfoIUnitRangeName

Returns

undefined | string[]


getViewData()

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

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring

Returns

null | IPivotWorkerItemCache


handleMoveRange()

handleMoveRange(params): void

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

Parameters

ParameterType
paramsIMoveRangeMutationParams

Returns

void


queryDirtyPivotTable()

queryDirtyPivotTable(dirtyInfo): void

Defined in: packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:431

trigger the pivot table query

Parameters

ParameterType
dirtyInfoIPivotMutationDirtyViewInfo

Returns

void


refreshData()

refreshData(
   collection, 
   updateDataFieldList, 
   dataRangeInfo): void

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

Parameters

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

Returns

void


removeCollections()

removeCollections(unitId, token): void

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

Parameters

ParameterType
unitIdstring
tokenstring

Returns

void


removeDataField()

removeDataField(unitId, dataFieldId): void

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

Parameters

ParameterType
unitIdstring
dataFieldIdstring

Returns

void


removePivotTable()

removePivotTable(
   unitId, 
   subUnitId, 
   pivotTableId): void

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring

Returns

void


setPivotTable()

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

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
pivotTableConfigIPivotTableConfig

Returns

void


setTextInfo()

setTextInfo(textInfo): void

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

Parameters

ParameterType
textInfoRecord<string, string>

Returns

void


sideEffectUpdateWorkerCache()

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

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

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
workerCache?IPivotWorkerItemCache

Returns

void


toJSON()

toJSON(unitId): IPivotTableJson

Defined in: packages/sheets-pivot/src/models/sheets-pivot-data-source-model.ts:445

Parameters

ParameterType
unitIdstring

Returns

IPivotTableJson


updateConfig()

updateConfig(info): void

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

Parameters

ParameterType
infoISendPivotConfigLocalMutationParams

Returns

void


updateDirtyPivotTable()

updateDirtyPivotTable(dirtyInfo): void

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

Parameters

ParameterType
dirtyInfoIPivotMutationDirtyViewInfo

Returns

void


updateView()

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

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

Parameters

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

Returns

void


updateViewData()

updateViewData(ctx, ignoreDirty): void

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

  • 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