/** * Copyright 2023-present DreamNum Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { IRange, ISheetDataValidationRule, IUniverInstanceService } from '@univerjs/core'; export type RangeMutation = { type: 'update'; ruleId: string; oldRanges: IRange[]; newRanges: IRange[]; rule: ISheetDataValidationRule; } | { type: 'delete'; rule: ISheetDataValidationRule; index: number; } | { type: 'add'; rule: ISheetDataValidationRule; }; export declare class RuleMatrix { private _unitId; private _subUnitId; private _univerInstanceService; private _disableTree; private _map; private _tree; private _dirty; constructor(value: Map, _unitId: string, _subUnitId: string, _univerInstanceService: IUniverInstanceService, _disableTree?: boolean); private _buildTree; private _debonceBuildTree; get _worksheet(): import("@univerjs/core").Nullable; private _addRule; addRule(rule: ISheetDataValidationRule): void; removeRange(_ranges: IRange[], ruleIds?: ReadonlySet): void; private _removeRule; removeRule(rule: ISheetDataValidationRule): void; updateRange(ruleId: string, _newRanges: IRange[]): void; /** * The matrix stores concrete coordinates, while the rule keeps its semantic range type (a whole * column/row). `Range.transformRange` and `Rectangle.mergeRanges` rebuild ranges from bounds only, * so the type of the ranges handed to the matrix has to be carried over explicitly. */ private _withInputRangeType; /** * A rule range that the matrix rebuilt from coordinates keeps its type when the rebuilt range * still covers exactly the same cells as the rule's own range. This is what makes an auto fill * or a paste that only rewrites cells inside the rule a no-op instead of a downgrade: the * intermediate subtract/add steps drop the type, but the net coverage is unchanged. */ private _keepRuleRangeType; addRangeRules(rules: { id: string; ranges: IRange[]; }[]): void; diff(rules: ISheetDataValidationRule[]): RangeMutation[]; diffWithAddition(rules: ISheetDataValidationRule[], additionRules: IterableIterator): RangeMutation[]; clone(): RuleMatrix; getValue(row: number, col: number): string | undefined; }