@univerjs-pro/collaboration v0.5.0-beta.1 • Docs
Interface: ITransformService
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.
Properties
Property | Type | Description | Defined in |
---|---|---|---|
registerTransformAlgorithm | (algorithms : IMutationTransformAlgorithm <any , any >) => void | 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. | packages/collaboration/src/services/transform/transform.service.ts:48 |
transformMutationsWithChangeset | (c1 : IChangeset , m2 : IMutationInfo <object >[]) => ITransformMutationsWithChangesetResult | Internal Transform mutations with changesets. We only wants transformed mutations here. | packages/collaboration/src/services/transform/transform.service.ts:111 |
Methods
transformChangesets()
transformChangesets(c1, c2)
transformChangesets(c1, c2): IFailureTransformChangesetsResult | Omit<ISuccessTransformChangesetsResult, "c1Prime">
Internal
Transform two arrays of changesets
Parameters
Parameter | Type |
---|---|
c1 | IChangeset [] |
c2 | IChangeset [] |
Returns
IFailureTransformChangesetsResult
| Omit
<ISuccessTransformChangesetsResult
, "c1Prime"
>
Defined in
packages/collaboration/src/services/transform/transform.service.ts:103
transformChangesets(c1, c2, onlyLater)
transformChangesets(
c1,
c2,
onlyLater): ITransformChangesetsResult
Parameters
Parameter | Type |
---|---|
c1 | IChangeset [] |
c2 | IChangeset [] |
onlyLater | false |
Returns
Defined in
packages/collaboration/src/services/transform/transform.service.ts:104
transformMutation()
transformMutation(m1, m2)
transformMutation(m1, m2): IFailureTransformMutationResult | Omit<ISuccessTransformMutationResult, "m1Prime">
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 <object > |
m2 | IMutationInfo <object > |
Returns
IFailureTransformMutationResult
| Omit
<ISuccessTransformMutationResult
, "m1Prime"
>
Defined in
packages/collaboration/src/services/transform/transform.service.ts:68
transformMutation(m1, m2, onlyLater)
transformMutation(
m1,
m2,
onlyLater): ITransformMutationResult
Parameters
Parameter | Type |
---|---|
m1 | IMutationInfo <object > |
m2 | IMutationInfo <object > |
onlyLater | false |
Returns
Defined in
packages/collaboration/src/services/transform/transform.service.ts:69
transformMutations()
transformMutations(m1, m2)
transformMutations(m1, m2): IFailureTransformMutationsResult | Omit<ISuccessTransformMutationsResult, "m1Prime">
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 <object >[] |
m2 | IMutationInfo <object >[] |
Returns
IFailureTransformMutationsResult
| Omit
<ISuccessTransformMutationsResult
, "m1Prime"
>
Defined in
packages/collaboration/src/services/transform/transform.service.ts:95
transformMutations(m1, m2, onlyLater)
transformMutations(
m1,
m2,
onlyLater): ITransformMutationsResult
Parameters
Parameter | Type |
---|---|
m1 | IMutationInfo <object >[] |
m2 | IMutationInfo <object >[] |
onlyLater | boolean |
Returns
Defined in
packages/collaboration/src/services/transform/transform.service.ts:96