@univerjs-pro/collaboration v0.5.4
Class: TransformService
Defined in: packages/collaboration/src/services/transform/transform.service.ts:116
This service’s responsibility is to transform mutations (changesets).
Features could register transform algorithms to this service, so this the service could transform more mutations.
This should be used both on client and server.
This service is also business-agnostic, so it could be used in docs, sheets and slides.
Extends
Implements
Constructors
new TransformService()
new TransformService(): TransformService
Returns
Inherited from
Properties
Property | Modifier | Type | Default value | Inherited from | Defined in |
---|---|---|---|---|---|
_disposed | protected | boolean | false | Disposable ._disposed | submodules/univer/packages/core/src/shared/lifecycle.ts:96 |
Methods
dispose()
dispose(): void
Defined in: packages/collaboration/src/services/transform/transform.service.ts:119
Returns
void
Overrides
disposeWithMe()
disposeWithMe(disposable): IDisposable
Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
ensureNotDisposed()
protected ensureNotDisposed(): void
Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103
Returns
void
Inherited from
registerTransformAlgorithm()
registerTransformAlgorithm(algorithm): void
Defined in: packages/collaboration/src/services/transform/transform.service.ts:123
Register an algorithm to transform two kinds of mutations.
Note that this method is not the same as other registering methods in Univer, it wouldn’t return a disposable, because it would cause critical problems if you unregister a transform algorithm.
Parameters
Parameter | Type |
---|---|
algorithm | IMutationTransformAlgorithm |
Returns
void
Implementation of
ITransformService
.registerTransformAlgorithm
transformChangesets()
Call Signature
transformChangesets(c1, c2): ITransformChangesetsResult
Defined in: packages/collaboration/src/services/transform/transform.service.ts:280
Internal
Transform two arrays of changesets
Parameters
Parameter | Type |
---|---|
c1 | IChangeset [] |
c2 | IChangeset [] |
Returns
Implementation of
ITransformService
.transformChangesets
Call Signature
transformChangesets(
c1,
c2,
onlyLater):
| IFailureTransformChangesetsResult
| Omit<ISuccessTransformChangesetsResult, "c1Prime">
Defined in: packages/collaboration/src/services/transform/transform.service.ts:281
Parameters
Parameter | Type |
---|---|
c1 | IChangeset [] |
c2 | IChangeset [] |
onlyLater | true |
Returns
| IFailureTransformChangesetsResult
| Omit
<ISuccessTransformChangesetsResult
, "c1Prime"
>
Implementation of
ITransformService
.transformChangesets
transformMutation()
Call Signature
transformMutation(m1, m2): ITransformMutationResult
Defined in: packages/collaboration/src/services/transform/transform.service.ts:137
Internal
Transform two single mutations. Note that m1Prime and m2Prime may not be single mutations. 1x1 may result in nxn.
Visualization:
/\
m1 / \ m2
/ \
\ /
m2Prime \ / m1Prime
/
Parameters
Parameter | Type |
---|---|
m1 | IMutationInfo |
m2 | IMutationInfo |
Returns
Implementation of
ITransformService
.transformMutation
Call Signature
transformMutation(
m1,
m2,
onlyLater):
| IFailureTransformMutationResult
| Omit<ISuccessTransformMutationResult, "m1Prime">
Defined in: packages/collaboration/src/services/transform/transform.service.ts:138
Parameters
Parameter | Type |
---|---|
m1 | IMutationInfo |
m2 | IMutationInfo |
onlyLater | true |
Returns
| IFailureTransformMutationResult
| Omit
<ISuccessTransformMutationResult
, "m1Prime"
>
Implementation of
ITransformService
.transformMutation
transformMutations()
Call Signature
transformMutations(m1, m2): ITransformMutationsResult
Defined in: packages/collaboration/src/services/transform/transform.service.ts:158
Internal
Transform two array of mutations. Not that the time complexity (also memory complexity) of this method is O(m*n), in which m & n are numbers of mutations in each array.
Visualization:
/\
m1 / \ m2
/ \
/\ /\
/ \ / \
/ / \
\ /\ /
\ / \ /
/ /
\ /
\ /
m2Prime / m1Prime
Parameters
Parameter | Type |
---|---|
m1 | IMutationInfo [] |
m2 | IMutationInfo [] |
Returns
Implementation of
ITransformService
.transformMutations
Call Signature
transformMutations(
m1,
m2,
onlyLater):
| IFailureTransformMutationsResult
| Omit<ISuccessTransformMutationsResult, "m1Prime">
Defined in: packages/collaboration/src/services/transform/transform.service.ts:159
Parameters
Parameter | Type |
---|---|
m1 | IMutationInfo [] |
m2 | IMutationInfo [] |
onlyLater | true |
Returns
| IFailureTransformMutationsResult
| Omit
<ISuccessTransformMutationsResult
, "m1Prime"
>
Implementation of
ITransformService
.transformMutations
transformMutationsWithChangeset()
transformMutationsWithChangeset(c1, m2): ITransformMutationsWithChangesetResult
Defined in: packages/collaboration/src/services/transform/transform.service.ts:337
Internal
Transform mutations with changesets. We only wants transformed mutations here.
Parameters
Parameter | Type |
---|---|
c1 | IChangeset |
m2 | IMutationInfo [] |
Returns
ITransformMutationsWithChangesetResult