Skip to content

Commit

Permalink
feat(cf): select changes to update the rules panel(#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gggpound committed Mar 28, 2024
1 parent 52233fd commit 3e72007
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { Select, Tooltip } from '@univerjs/design';

import { useDependency } from '@wendellhu/redi/react-bindings';
import { ICommandService, IUniverInstanceService, LocaleService, Rectangle } from '@univerjs/core';
import { SelectionManagerService, SetWorksheetActiveOperation } from '@univerjs/sheets';
import { SelectionManagerService, SetSelectionsOperation, SetWorksheetActiveOperation } from '@univerjs/sheets';
import { serializeRange } from '@univerjs/engine-formula';
import { DeleteSingle, IncreaseSingle, MoreFunctionSingle } from '@univerjs/icons';
import GridLayout from 'react-grid-layout';
import { debounceTime, merge, Observable } from 'rxjs';
import { debounceTime, Observable } from 'rxjs';
import { addConditionalRuleMutation } from '../../../commands/mutations/addConditionalRule.mutation';
import { setConditionalRuleMutation } from '../../../commands/mutations/setConditionalRule.mutation';
import { deleteConditionalRuleMutation } from '../../../commands/mutations/deleteConditionalRule.mutation';
Expand Down Expand Up @@ -164,10 +164,12 @@ export const RuleList = (props: IRuleListProps) => {
}, [selectValue, fetchRuleListId]);

useEffect(() => {
const subscription = merge(
selectionManagerService.selectionMoveEnd$,
if (selectValue === '2') {
return;
}
const subscription =
new Observable<null>((commandSubscribe) => {
const commandList = [addConditionalRuleMutation.id, setConditionalRuleMutation.id, deleteConditionalRuleMutation.id, moveConditionalRuleMutation.id];
const commandList = [SetSelectionsOperation.id, addConditionalRuleMutation.id, setConditionalRuleMutation.id, deleteConditionalRuleMutation.id, moveConditionalRuleMutation.id];
const disposable = commandService.onCommandExecuted((commandInfo) => {
const { id, params } = commandInfo;
const unitId = univerInstanceService.getCurrentUniverSheetInstance().getUnitId();
Expand All @@ -176,14 +178,14 @@ export const RuleList = (props: IRuleListProps) => {
}
});
return () => disposable.dispose();
})
).subscribe(() => {
ruleListSet(getRuleList);
});
}).pipe(debounceTime(16))
.subscribe(() => {
ruleListSet(getRuleList);
});
return () => {
subscription.unsubscribe();
};
}, [selectionManagerService, univerInstanceService]);
}, [univerInstanceService, selectValue]);

useEffect(() => {
const dispose = conditionalFormatRuleModel.$ruleChange.subscribe(() => {
Expand Down

0 comments on commit 3e72007

Please sign in to comment.