@univerjs/sheets-conditional-formatting 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1909
- package/lib/es/index.js +1 -1999
- package/lib/facade.js +1 -1909
- package/lib/index.js +1 -1999
- package/lib/types/assets/icon-map.d.ts +79 -0
- package/lib/types/base/const.d.ts +16 -1
- package/lib/types/commands/commands/add-cf.command.d.ts +18 -3
- package/lib/types/commands/commands/clear-range-cf.command.d.ts +16 -1
- package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +16 -1
- package/lib/types/commands/commands/delete-cf.command.d.ts +16 -1
- package/lib/types/commands/commands/move-cf.command.d.ts +17 -2
- package/lib/types/commands/commands/set-cf.command.d.ts +17 -2
- package/lib/types/commands/mutations/add-conditional-rule.mutation.d.ts +18 -3
- package/lib/types/commands/mutations/delete-conditional-rule.mutation.d.ts +16 -1
- package/lib/types/commands/mutations/formula-mark-dirty.mutation.d.ts +16 -1
- package/lib/types/commands/mutations/move-conditional-rule.mutation.d.ts +17 -2
- package/lib/types/commands/mutations/set-conditional-rule.mutation.d.ts +17 -2
- package/lib/types/facade/f-conditional-formatting-builder.d.ts +18 -2
- package/lib/types/facade/f-enum.d.ts +15 -0
- package/lib/types/facade/f-range.d.ts +16 -1
- package/lib/types/facade/f-worksheet.d.ts +16 -1
- package/lib/types/models/calculate-unit-v2/__test__/test.util.d.ts +24 -8
- package/lib/types/models/calculate-unit-v2/base-calculate-unit.d.ts +18 -3
- package/lib/types/models/calculate-unit-v2/color-scale-calculate-unit.d.ts +17 -1
- package/lib/types/models/calculate-unit-v2/data-bar-calculate-unit.d.ts +17 -1
- package/lib/types/models/calculate-unit-v2/highlight-cell-calculate-unit.d.ts +19 -3
- package/lib/types/models/calculate-unit-v2/icon-set-calculate-unit.d.ts +19 -3
- package/lib/types/models/calculate-unit-v2/utils.d.ts +19 -3
- package/lib/types/models/conditional-formatting-rule-model.d.ts +21 -6
- package/lib/types/models/conditional-formatting-view-model.d.ts +16 -1
- package/lib/types/models/type.d.ts +18 -3
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/render/data-bar.render.d.ts +18 -2
- package/lib/types/render/icon.render.d.ts +18 -2
- package/lib/types/render/type.d.ts +17 -2
- package/lib/types/services/conditional-formatting-formula.service.d.ts +18 -2
- package/lib/types/services/conditional-formatting.service.d.ts +17 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +10 -9
- package/lib/types/assets/icon-map.json.d.ts +0 -82
- package/lib/types/models/calculate-unit-v2/__test__/base-calculate.spec.d.ts +0 -16
- package/lib/types/models/calculate-unit-v2/__test__/calculate.color.spec.d.ts +0 -16
- package/lib/types/models/calculate-unit-v2/__test__/calculate.databar.spec.d.ts +0 -16
- package/lib/types/models/calculate-unit-v2/__test__/calculate.highlight.spec.d.ts +0 -16
- package/lib/types/utils/__test__/anchor.spec.d.ts +0 -16
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import type { IConditionFormattingRule, IValueConfig } from '../type';
|
|
18
|
+
import type { IContext } from './base-calculate-unit';
|
|
19
|
+
import { ColorKit, ObjectMatrix } from '@univerjs/core';
|
|
4
20
|
import { FormulaResultStatus } from '@univerjs/engine-formula';
|
|
5
21
|
import { CFNumberOperator } from '../../base/const';
|
|
6
22
|
export declare function isFloatsEqual(a: number, b: number): boolean;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IAnchor } from '../utils/anchor';
|
|
17
|
+
import type { IConditionFormattingRule, IRuleModel } from './type';
|
|
3
18
|
type RuleOperatorType = 'delete' | 'set' | 'add' | 'sort';
|
|
4
19
|
export declare class ConditionalFormattingRuleModel {
|
|
5
20
|
private _model;
|
|
6
21
|
private _ruleChange$;
|
|
7
|
-
$ruleChange: import(
|
|
22
|
+
$ruleChange: import("rxjs").Observable<{
|
|
8
23
|
rule: IConditionFormattingRule;
|
|
9
24
|
oldRule?: IConditionFormattingRule;
|
|
10
25
|
unitId: string;
|
|
@@ -12,9 +27,9 @@ export declare class ConditionalFormattingRuleModel {
|
|
|
12
27
|
type: RuleOperatorType;
|
|
13
28
|
}>;
|
|
14
29
|
private _ensureList;
|
|
15
|
-
getRule(unitId: string, subUnitId: string, cfId?: string): IConditionFormattingRule<import(
|
|
16
|
-
getUnitRules(unitId: string): Map<string, IConditionFormattingRule<import(
|
|
17
|
-
getSubunitRules(unitId: string, subUnitId: string): IConditionFormattingRule<import(
|
|
30
|
+
getRule(unitId: string, subUnitId: string, cfId?: string): IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig> | null | undefined;
|
|
31
|
+
getUnitRules(unitId: string): Map<string, IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig>[]> | null;
|
|
32
|
+
getSubunitRules(unitId: string, subUnitId: string): IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig>[] | null;
|
|
18
33
|
getAll(): IRuleModel;
|
|
19
34
|
deleteRule(unitId: string, subUnitId: string, cfId: string): void;
|
|
20
35
|
setRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule, oldCfId: string): void;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
import { Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
|
|
2
17
|
import { ConditionalFormattingFormulaService } from '../services/conditional-formatting-formula.service';
|
|
3
18
|
import { ConditionalFormattingRuleModel } from './conditional-formatting-rule-model';
|
|
@@ -18,7 +33,7 @@ export declare class ConditionalFormattingViewModel extends Disposable {
|
|
|
18
33
|
* The rendering layer listens to this variable to determine whether a reRender is necessary.
|
|
19
34
|
* @memberof ConditionalFormattingViewModel
|
|
20
35
|
*/
|
|
21
|
-
markDirty$: import(
|
|
36
|
+
markDirty$: import("rxjs").Observable<{
|
|
22
37
|
cfId: string;
|
|
23
38
|
unitId: string;
|
|
24
39
|
subUnitId: string;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IRange, IStyleBase } from '@univerjs/core';
|
|
17
|
+
import type { CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType } from '../base/const';
|
|
18
|
+
import type { IIconType } from './icon-map';
|
|
4
19
|
export interface IBaseCfRule {
|
|
5
20
|
type: string;
|
|
6
21
|
}
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IUniverSheetsConditionalFormattingConfig } from './config/config';
|
|
2
17
|
import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
3
18
|
export declare class UniverSheetsConditionalFormattingPlugin extends Plugin {
|
|
4
19
|
private readonly _config;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IRange, IScale } from '@univerjs/core';
|
|
17
|
+
import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
|
|
18
|
+
import { SheetExtension } from '@univerjs/engine-render';
|
|
3
19
|
export declare const dataBarUKey = "sheet-conditional-rule-data-bar";
|
|
4
20
|
export declare const defaultDataBarPositiveColor = "#ffbe38";
|
|
5
21
|
export declare const defaultDataBarNativeColor = "#abd91a";
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IRange, IScale } from '@univerjs/core';
|
|
17
|
+
import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
|
|
18
|
+
import { SheetExtension } from '@univerjs/engine-render';
|
|
3
19
|
export declare const IconUKey = "sheet-conditional-rule-icon";
|
|
4
20
|
export declare const DEFAULT_WIDTH = 15;
|
|
5
21
|
export declare const DEFAULT_PADDING = 2;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ICellData } from '@univerjs/core';
|
|
17
|
+
import type { IIconType } from '../models/icon-map';
|
|
3
18
|
export interface IDataBarRenderParams {
|
|
4
19
|
color: string;
|
|
5
20
|
value: number;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IRange } from '@univerjs/core';
|
|
17
|
+
import { Disposable, ObjectMatrix, RefAlias } from '@univerjs/core';
|
|
2
18
|
import { FormulaResultStatus, RegisterOtherFormulaService } from '@univerjs/engine-formula';
|
|
3
19
|
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
4
20
|
type IFormulaItem = {
|
|
@@ -14,7 +30,7 @@ export declare class ConditionalFormattingFormulaService extends Disposable {
|
|
|
14
30
|
private _conditionalFormattingRuleModel;
|
|
15
31
|
private _formulaMap;
|
|
16
32
|
private _result$;
|
|
17
|
-
result$: import(
|
|
33
|
+
result$: import("rxjs").Observable<IFormulaItem & {
|
|
18
34
|
isAllFinished: boolean;
|
|
19
35
|
}>;
|
|
20
36
|
constructor(_registerOtherFormulaService: RegisterOtherFormulaService, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel);
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IHighlightCell } from '../models/type';
|
|
17
|
+
import type { IDataBarCellData, IIconSetCellData } from '../render/type';
|
|
3
18
|
import { Disposable, ICommandService, Injector, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
|
|
4
19
|
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
5
20
|
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets/facade"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets/facade","@univerjs/core/facade"],u):(i=typeof globalThis<"u"?globalThis:i||self,u(i.UniverSheetsConditionalFormattingFacade={},i.UniverCore,i.UniverSheetsConditionalFormatting,i.UniverSheetsFacade,i.UniverCoreFacade))})(this,(function(i,u,t,C,y){"use strict";var d=Object.defineProperty;var R=(i,u,t)=>u in i?d(i,u,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[u]=t;var T=(i,u,t)=>R(i,typeof u!="symbol"?u+"":u,t);class o{constructor(e={}){T(this,"_rule",{});this._rule=e,this._ensureAttr(this._rule,["rule"])}get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=t.CFRuleType.highlightCell){switch(e){case t.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new u.ColorKit("").toRgbString(),value:{type:t.CFValueType.min}},{index:0,color:new u.ColorKit("green").toRgbString(),value:{type:t.CFValueType.max}}]};case t.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:t.CFValueType.min},max:{type:t.CFValueType.max},positiveColor:new u.ColorKit("green").toRgbString(),nativeColor:new u.ColorKit("").toRgbString(),isGradient:!1}};case t.CFRuleType.highlightCell:return{type:e,subType:t.CFSubRuleType.text,operator:t.CFTextOperator.containsText,value:"abc",style:{}};case t.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.min},iconType:t.EMPTY_ICON_TYPE,iconId:""},{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.percentile,value:.5},iconType:t.EMPTY_ICON_TYPE,iconId:""},{operator:t.CFNumberOperator.lessThanOrEqual,value:{type:t.CFValueType.max},iconType:t.EMPTY_ICON_TYPE,iconId:""}]}}}_ensureAttr(e,r){return r.reduce((l,s)=>(l[s]||(l[s]={}),l[s]),e),e}build(){var l;this._rule.cfId||(this._rule.cfId=t.createCfId()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(l=this._rule.rule)!=null&&l.type||(this._rule.rule.type=t.CFRuleType.highlightCell,this._ensureAttr(this._rule,["rule","style"]));const e=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...e,...this._rule.rule}}}copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new o(e)}getRanges(){return this._rule.ranges||[]}getIconMap(){return t.iconMap}createCfId(){return t.createCfId()}setRanges(e){return this._rule.ranges=e,this}}class n extends o{constructor(e={}){super(e),this._ensureAttr(this._rule,["rule","style"])}copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new n(e)}setAverage(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.average,r.operator=e,this}setUniqueValues(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.uniqueValues,this}setDuplicateValues(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.duplicateValues,this}setRank(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.rank,r.isBottom=e.isBottom,r.isPercent=e.isPercent,r.value=e.value,this}setBackground(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,["style","bg"]);const l=new u.ColorKit(e);this._ruleConfig.style.bg.rgb=l.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.bl=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setFontColor(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(e){const l=new u.ColorKit(e);this._ensureAttr(this._ruleConfig,["style","cl"]),this._ruleConfig.style.cl.rgb=l.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.it=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setStrikethrough(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","st"]),this._ruleConfig.style.st.s=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setUnderline(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","ul"]),this._ruleConfig.style.ul.s=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}whenCellEmpty(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value="",e.operator=t.CFTextOperator.equal,this}whenCellNotEmpty(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value="",e.operator=t.CFTextOperator.notEqual,this}whenDate(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.timePeriod,r.operator=e,this}whenFormulaSatisfied(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.formula,r.value=e,this}whenNumberBetween(e,r){const l=Math.min(e,r),s=Math.max(e,r),h=this._ruleConfig;return h.type=t.CFRuleType.highlightCell,h.subType=t.CFSubRuleType.number,h.value=[l,s],h.operator=t.CFNumberOperator.between,this}whenNumberEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.equal,this}whenNumberGreaterThan(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,r){const l=Math.min(e,r),s=Math.max(e,r),h=this._ruleConfig;return h.type=t.CFRuleType.highlightCell,h.subType=t.CFSubRuleType.number,h.value=[l,s],h.operator=t.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.notEqual,this}whenTextContains(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.containsText,this}whenTextDoesNotContain(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.notContainsText,this}whenTextEndsWith(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.endsWith,this}whenTextEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.equal,this}whenTextStartsWith(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.beginsWith,this}}class a extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new a(e)}setDataBar(e){const r=this._ruleConfig;return r.type=t.CFRuleType.dataBar,r.isShowValue=!!e.isShowValue,r.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}}class f extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new f(e)}setColorScale(e){const r=this._ruleConfig;return r.type=t.CFRuleType.colorScale,r.config=e,this}}class c extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new c(e)}setIconSet(e){const r=this._ruleConfig;return r.type=t.CFRuleType.iconSet,r.config=e.iconConfigs,r.isShowValue=e.isShowValue,this}}class p{constructor(e={}){this._initConfig=e}build(){return new o(this._initConfig).build()}setAverage(e){return new n(this._initConfig).setAverage(e)}setUniqueValues(){return new n(this._initConfig).setUniqueValues()}setDuplicateValues(){return new n(this._initConfig).setDuplicateValues()}setRank(e){return new n(this._initConfig).setRank(e)}getIconMap(){return t.iconMap}setIconSet(e){return new c(this._initConfig).setIconSet(e)}setColorScale(e){return new f(this._initConfig).setColorScale(e)}setDataBar(e){return new a(this._initConfig).setDataBar(e)}setBackground(e){return new n(this._initConfig).setBackground(e)}setBold(e){return new n(this._initConfig).setBold(e)}setFontColor(e){return new n(this._initConfig).setFontColor(e)}setItalic(e){return new n(this._initConfig).setItalic(e)}setStrikethrough(e){return new n(this._initConfig).setStrikethrough(e)}setUnderline(e){return new n(this._initConfig).setUnderline(e)}whenCellEmpty(){return new n(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new n(this._initConfig).whenCellNotEmpty()}whenDate(e){return new n(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new n(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,r){return new n(this._initConfig).whenNumberBetween(e,r)}whenNumberEqualTo(e){return new n(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new n(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new n(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new n(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new n(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,r){return new n(this._initConfig).whenNumberNotBetween(e,r)}whenNumberNotEqualTo(e){return new n(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new n(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new n(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new n(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new n(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new n(this._initConfig).whenTextStartsWith(e)}}class _ extends C.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(r=>r.ranges.some(l=>u.Rectangle.intersects(l,this._range)))}createConditionalFormattingRule(){return new p({ranges:[this._range]})}addConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,r),this}deleteConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,r),this}moveConditionalFormattingRule(e,r,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:r,type:l}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,s),this}setConditionalFormattingRule(e,r){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:r,cfId:e};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,l),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(t.ClearRangeCfCommand.id,e),this}}C.FRange.extend(_);class w extends C.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new p}newConditionalFormattingRule(){return new p}addConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,r),this}deleteConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,r),this}moveConditionalFormattingRule(e,r,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:r,type:l}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,s),this}setConditionalFormattingRule(e,r){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:r};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,l),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(t.ClearWorksheetCfCommand.id,e),this}}C.FWorksheet.extend(w);class b{get ConditionFormatNumberOperatorEnum(){return t.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return t.CFTimePeriodOperator}}y.FEnum.extend(b),i.FConditionalFormattingBuilder=p,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets-conditional-formatting`),require(`@univerjs/sheets/facade`),require(`@univerjs/core/facade`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-conditional-formatting`,`@univerjs/sheets/facade`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsConditionalFormattingFacade={},e.UniverCore,e.UniverSheetsConditionalFormatting,e.UniverSheetsFacade,e.UniverCoreFacade))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=class e{get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=n.CFRuleType.highlightCell){switch(e){case n.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new t.ColorKit(``).toRgbString(),value:{type:n.CFValueType.min}},{index:0,color:new t.ColorKit(`green`).toRgbString(),value:{type:n.CFValueType.max}}]};case n.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:n.CFValueType.min},max:{type:n.CFValueType.max},positiveColor:new t.ColorKit(`green`).toRgbString(),nativeColor:new t.ColorKit(``).toRgbString(),isGradient:!1}};case n.CFRuleType.highlightCell:return{type:e,subType:n.CFSubRuleType.text,operator:n.CFTextOperator.containsText,value:`abc`,style:{}};case n.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.min},iconType:n.EMPTY_ICON_TYPE,iconId:``},{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.percentile,value:.5},iconType:n.EMPTY_ICON_TYPE,iconId:``},{operator:n.CFNumberOperator.lessThanOrEqual,value:{type:n.CFValueType.max},iconType:n.EMPTY_ICON_TYPE,iconId:``}]}}}constructor(e={}){c(this,`_rule`,{}),this._rule=e,this._ensureAttr(this._rule,[`rule`])}_ensureAttr(e,t){return t.reduce((e,t)=>(e[t]||(e[t]={}),e[t]),e),e}build(){var e;this._rule.cfId||(this._rule.cfId=(0,n.createCfId)()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(e=this._rule.rule)!=null&&e.type||(this._rule.rule.type=n.CFRuleType.highlightCell,this._ensureAttr(this._rule,[`rule`,`style`]));let t=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...t,...this._rule.rule}}}copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}getRanges(){return this._rule.ranges||[]}getIconMap(){return n.iconMap}createCfId(){return(0,n.createCfId)()}setRanges(e){return this._rule.ranges=e,this}},u=class e extends l{constructor(e={}){super(e),this._ensureAttr(this._rule,[`rule`,`style`])}copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setAverage(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.average,t.operator=e,this}setUniqueValues(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.uniqueValues,this}setDuplicateValues(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.duplicateValues,this}setRank(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,[`style`,`bg`]);let n=new t.ColorKit(e);this._ruleConfig.style.bg.rgb=n.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.bl=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setFontColor(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell)if(e){let n=new t.ColorKit(e);this._ensureAttr(this._ruleConfig,[`style`,`cl`]),this._ruleConfig.style.cl.rgb=n.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.it=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setStrikethrough(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`st`]),this._ruleConfig.style.st.s=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setUnderline(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`ul`]),this._ruleConfig.style.ul.s=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}whenCellEmpty(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value=``,e.operator=n.CFTextOperator.equal,this}whenCellNotEmpty(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value=``,e.operator=n.CFTextOperator.notEqual,this}whenDate(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.formula,t.value=e,this}whenNumberBetween(e,t){let r=Math.min(e,t),i=Math.max(e,t),a=this._ruleConfig;return a.type=n.CFRuleType.highlightCell,a.subType=n.CFSubRuleType.number,a.value=[r,i],a.operator=n.CFNumberOperator.between,this}whenNumberEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.equal,this}whenNumberGreaterThan(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,t){let r=Math.min(e,t),i=Math.max(e,t),a=this._ruleConfig;return a.type=n.CFRuleType.highlightCell,a.subType=n.CFSubRuleType.number,a.value=[r,i],a.operator=n.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.notEqual,this}whenTextContains(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.containsText,this}whenTextDoesNotContain(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.notContainsText,this}whenTextEndsWith(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.endsWith,this}whenTextEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.equal,this}whenTextStartsWith(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.beginsWith,this}},d=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setDataBar(e){let t=this._ruleConfig;return t.type=n.CFRuleType.dataBar,t.isShowValue=!!e.isShowValue,t.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}},f=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setColorScale(e){let t=this._ruleConfig;return t.type=n.CFRuleType.colorScale,t.config=e,this}},p=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setIconSet(e){let t=this._ruleConfig;return t.type=n.CFRuleType.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}},m=class{constructor(e={}){this._initConfig=e}build(){return new l(this._initConfig).build()}setAverage(e){return new u(this._initConfig).setAverage(e)}setUniqueValues(){return new u(this._initConfig).setUniqueValues()}setDuplicateValues(){return new u(this._initConfig).setDuplicateValues()}setRank(e){return new u(this._initConfig).setRank(e)}getIconMap(){return n.iconMap}setIconSet(e){return new p(this._initConfig).setIconSet(e)}setColorScale(e){return new f(this._initConfig).setColorScale(e)}setDataBar(e){return new d(this._initConfig).setDataBar(e)}setBackground(e){return new u(this._initConfig).setBackground(e)}setBold(e){return new u(this._initConfig).setBold(e)}setFontColor(e){return new u(this._initConfig).setFontColor(e)}setItalic(e){return new u(this._initConfig).setItalic(e)}setStrikethrough(e){return new u(this._initConfig).setStrikethrough(e)}setUnderline(e){return new u(this._initConfig).setUnderline(e)}whenCellEmpty(){return new u(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new u(this._initConfig).whenCellNotEmpty()}whenDate(e){return new u(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new u(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new u(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new u(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new u(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new u(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new u(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new u(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new u(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new u(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new u(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new u(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new u(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new u(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new u(this._initConfig).whenTextStartsWith(e)}},h=class extends r.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,this._range)))}createConditionalFormattingRule(){return new m({ranges:[this._range]})}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,t){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(n.ClearRangeCfCommand.id,e),this}};r.FRange.extend(h);var g=class extends r.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new m}newConditionalFormattingRule(){return new m}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,t){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:t};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(n.ClearWorksheetCfCommand.id,e),this}};r.FWorksheet.extend(g);var _=class{get ConditionFormatNumberOperatorEnum(){return n.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return n.CFTimePeriodOperator}};i.FEnum.extend(_),e.FConditionalFormattingBuilder=m});
|