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