@univerjs/sheets-conditional-formatting-ui 1.0.0-alpha.3 → 1.0.0-alpha.4
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/index.js +339 -197
- package/lib/es/index.js +345 -204
- package/lib/index.css +74 -6
- package/lib/index.js +345 -204
- package/lib/types/commands/commands/add-data-bar-cf.command.d.ts +1 -1
- package/lib/types/commands/commands/add-icon-set-cf.command.d.ts +25 -0
- package/lib/types/controllers/cf.panel.controller.d.ts +3 -5
- package/lib/types/index.d.ts +1 -0
- package/lib/types/menu/quick-insert.menu.d.ts +20 -0
- package/lib/types/views/Preview.d.ts +2 -2
- package/lib/types/views/panel/RuleList.d.ts +1 -1
- package/lib/types/views/panel/rule-edit/HighlightCell.d.ts +4 -2
- package/lib/umd/index.js +1 -1
- package/package.json +14 -14
package/lib/es/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { BooleanNumber, ColorKit, CommandType, DependentOn, Disposable, DisposableCollection, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LocaleService, ObjectMatrix, Plugin, Range, Rectangle, Tools, UniverInstanceType, createInterceptorKey, generateRandomId, get, merge, registerDependencies, set, toDisposable, touchDependencies } from "@univerjs/core";
|
|
2
2
|
import { AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AutoFillTools, ClearSelectionAllCommand, ClearSelectionFormatCommand, IAutoFillService, INTERCEPTOR_POINT, RangeProtectionPermissionEditPoint, RemoveSheetMutation, SetSelectionsOperation, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, checkRangesEditablePermission, getSheetCommandTarget, rangeToDiscreteRange, setEndForRange } from "@univerjs/sheets";
|
|
3
3
|
import { AddCfCommand, AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingRangeIndexModel, ConditionalFormattingRangeTransformService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingViewModel, DEFAULT_BG_COLOR, DEFAULT_FONT_COLOR, DEFAULT_PADDING, DEFAULT_WIDTH, DeleteCfCommand, DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, IIconSetType, MoveCfCommand, MoveConditionalRuleMutation, SHEET_CONDITIONAL_FORMATTING_PLUGIN, SetCfCommand, SetConditionalRuleMutation, UniverSheetsConditionalFormattingPlugin, compareWithNumber, createCfId, createDefaultRule, createDefaultValue, createDefaultValueByValueType, defaultDataBarNativeColor, defaultDataBarPositiveColor, getColorScaleFromValue, getOppositeOperator, iconGroup, iconMap, removeUndefinedAttr, setConditionalRuleMutationUndoFactory } from "@univerjs/sheets-conditional-formatting";
|
|
4
|
-
import { ComponentManager,
|
|
4
|
+
import { ComponentManager, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonDataGroup, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable, useSidebarClick } from "@univerjs/ui";
|
|
5
5
|
import { COPY_TYPE, FormatPainterStatus, IFormatPainterService, ISheetClipboardService, PREDEFINED_HOOK_NAME_PASTE, SheetSkeletonManagerService, getCurrentRangeDisable$, getRepeatRange, useHighlightRange, virtualizeDiscreteRanges } from "@univerjs/sheets-ui";
|
|
6
|
-
import { Observable, debounceTime, merge as merge$1 } from "rxjs";
|
|
7
|
-
import { bufferTime, debounceTime as debounceTime$1, filter } from "rxjs/operators";
|
|
6
|
+
import { Observable, debounceTime, filter, map, merge as merge$1, share, startWith } from "rxjs";
|
|
7
|
+
import { bufferTime, debounceTime as debounceTime$1, filter as filter$1 } from "rxjs/operators";
|
|
8
8
|
import { FormulaRefRangeService, UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula";
|
|
9
9
|
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
10
|
-
import { BoldIcon, ConditionsDoubleIcon, DeleteIcon, FontColorDoubleIcon, GripVerticalIcon, IncreaseIcon, ItalicIcon, MoreDownIcon, PaintBucketDoubleIcon, SlashDoubleIcon, StrikethroughIcon, UnderlineIcon } from "@univerjs/icons";
|
|
11
|
-
import {
|
|
10
|
+
import { BoldIcon, ConditionsDoubleIcon, DataBarIcon, DeleteIcon, FontColorDoubleIcon, GripVerticalIcon, IncreaseIcon, ItalicIcon, MoreDownIcon, PaintBucketDoubleIcon, RatingIcon, SlashDoubleIcon, StrikethroughIcon, UnderlineIcon } from "@univerjs/icons";
|
|
11
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
12
12
|
import { Button, Checkbox, ColorPicker, DraggableList, Dropdown, Input, InputNumber, Radio, RadioGroup, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
|
|
13
13
|
import { LexerTreeBuilder, deserializeRangeWithSheet, operatorToken, serializeRange } from "@univerjs/engine-formula";
|
|
14
14
|
import { FormulaEditor, RangeSelector } from "@univerjs/sheets-formula-ui";
|
|
@@ -81,8 +81,11 @@ const AddDataBarConditionalRuleCommand = {
|
|
|
81
81
|
type: CommandType.COMMAND,
|
|
82
82
|
id: "sheet.command.add-data-bar-conditional-rule",
|
|
83
83
|
handler(accessor, params) {
|
|
84
|
+
var _params$ranges;
|
|
84
85
|
if (!params) return false;
|
|
85
|
-
const {
|
|
86
|
+
const { min, max, nativeColor, positiveColor, isGradient, stopIfTrue, isShowValue } = params;
|
|
87
|
+
const ranges = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : accessor.get(SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
|
|
88
|
+
if (!ranges.length) return false;
|
|
86
89
|
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
87
90
|
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
|
|
88
91
|
if (!target) return false;
|
|
@@ -143,6 +146,37 @@ const AddDuplicateValuesCfCommand = {
|
|
|
143
146
|
}
|
|
144
147
|
};
|
|
145
148
|
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/commands/commands/add-icon-set-cf.command.ts
|
|
151
|
+
const AddIconSetConditionalRuleCommand = {
|
|
152
|
+
type: CommandType.COMMAND,
|
|
153
|
+
id: "sheet.command.add-icon-set-conditional-rule",
|
|
154
|
+
handler(accessor, params) {
|
|
155
|
+
var _params$ranges;
|
|
156
|
+
if (!params) return false;
|
|
157
|
+
const ranges = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : accessor.get(SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
|
|
158
|
+
if (!ranges.length) return false;
|
|
159
|
+
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
|
|
160
|
+
if (!target) return false;
|
|
161
|
+
const { unitId, subUnitId } = target;
|
|
162
|
+
const rule = {
|
|
163
|
+
ranges,
|
|
164
|
+
cfId: accessor.get(ConditionalFormattingRuleModel).createCfId(unitId, subUnitId),
|
|
165
|
+
stopIfTrue: !!params.stopIfTrue,
|
|
166
|
+
rule: {
|
|
167
|
+
type: CFRuleType.iconSet,
|
|
168
|
+
config: params.config,
|
|
169
|
+
isShowValue: params.isShowValue
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
return accessor.get(ICommandService).executeCommand(AddConditionalRuleMutation.id, {
|
|
173
|
+
unitId,
|
|
174
|
+
subUnitId,
|
|
175
|
+
rule
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
146
180
|
//#endregion
|
|
147
181
|
//#region src/commands/commands/add-number-cf.command.ts
|
|
148
182
|
const AddNumberCfCommand = {
|
|
@@ -393,11 +427,9 @@ function __decorate(decorators, target, key, desc) {
|
|
|
393
427
|
//#region src/controllers/cf.panel.controller.ts
|
|
394
428
|
const CF_PANEL_KEY$1 = "sheet.conditional.formatting.panel";
|
|
395
429
|
let ConditionalFormattingPanelController = class ConditionalFormattingPanelController extends Disposable {
|
|
396
|
-
constructor(_univerInstanceService,
|
|
430
|
+
constructor(_univerInstanceService, _sidebarService, _localeService) {
|
|
397
431
|
super();
|
|
398
432
|
this._univerInstanceService = _univerInstanceService;
|
|
399
|
-
this._injector = _injector;
|
|
400
|
-
this._componentManager = _componentManager;
|
|
401
433
|
this._sidebarService = _sidebarService;
|
|
402
434
|
this._localeService = _localeService;
|
|
403
435
|
_defineProperty(this, "_sidebarDisposable", null);
|
|
@@ -429,10 +461,8 @@ let ConditionalFormattingPanelController = class ConditionalFormattingPanelContr
|
|
|
429
461
|
};
|
|
430
462
|
ConditionalFormattingPanelController = __decorate([
|
|
431
463
|
__decorateParam(0, IUniverInstanceService),
|
|
432
|
-
__decorateParam(1, Inject(
|
|
433
|
-
__decorateParam(2, Inject(
|
|
434
|
-
__decorateParam(3, Inject(ISidebarService)),
|
|
435
|
-
__decorateParam(4, Inject(LocaleService))
|
|
464
|
+
__decorateParam(1, Inject(ISidebarService)),
|
|
465
|
+
__decorateParam(2, Inject(LocaleService))
|
|
436
466
|
], ConditionalFormattingPanelController);
|
|
437
467
|
|
|
438
468
|
//#endregion
|
|
@@ -799,17 +829,155 @@ function FactoryManageConditionalFormattingRule(accessor) {
|
|
|
799
829
|
};
|
|
800
830
|
}
|
|
801
831
|
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/menu/quick-insert.menu.ts
|
|
834
|
+
const DATA_BAR_PARAMS = {
|
|
835
|
+
min: { type: CFValueType.min },
|
|
836
|
+
max: { type: CFValueType.max },
|
|
837
|
+
nativeColor: defaultDataBarNativeColor,
|
|
838
|
+
positiveColor: defaultDataBarPositiveColor,
|
|
839
|
+
isGradient: false,
|
|
840
|
+
isShowValue: true
|
|
841
|
+
};
|
|
842
|
+
function createIconSetParams(iconType) {
|
|
843
|
+
return {
|
|
844
|
+
config: [
|
|
845
|
+
{
|
|
846
|
+
iconType,
|
|
847
|
+
iconId: "0",
|
|
848
|
+
operator: CFNumberOperator.greaterThanOrEqual,
|
|
849
|
+
value: {
|
|
850
|
+
type: CFValueType.percent,
|
|
851
|
+
value: 67
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
iconType,
|
|
856
|
+
iconId: "1",
|
|
857
|
+
operator: CFNumberOperator.greaterThanOrEqual,
|
|
858
|
+
value: {
|
|
859
|
+
type: CFValueType.percent,
|
|
860
|
+
value: 33
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
iconType,
|
|
865
|
+
iconId: "2",
|
|
866
|
+
operator: CFNumberOperator.lessThanOrEqual,
|
|
867
|
+
value: {
|
|
868
|
+
type: CFValueType.percent,
|
|
869
|
+
value: Number.MAX_SAFE_INTEGER
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
],
|
|
873
|
+
isShowValue: true
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
function getQuickConditionalFormattingMenuState(accessor) {
|
|
877
|
+
return {
|
|
878
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
879
|
+
disabled$: getCurrentRangeDisable$(accessor, {
|
|
880
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
881
|
+
worksheetTypes: [WorksheetSetCellStylePermission, WorksheetEditPermission],
|
|
882
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
883
|
+
})
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function quickDataBarMenuFactory(accessor) {
|
|
887
|
+
return {
|
|
888
|
+
id: AddDataBarConditionalRuleCommand.id,
|
|
889
|
+
type: MenuItemType.BUTTON_SELECTOR,
|
|
890
|
+
icon: "DataBarIcon",
|
|
891
|
+
tooltip: "sheets-conditional-formatting-ui.ruleType.dataBar",
|
|
892
|
+
params: DATA_BAR_PARAMS,
|
|
893
|
+
selectionsCommandId: AddDataBarConditionalRuleCommand.id,
|
|
894
|
+
selections: [
|
|
895
|
+
{
|
|
896
|
+
label: "sheets-conditional-formatting-ui.ruleType.dataBar",
|
|
897
|
+
value: CFRuleType.dataBar,
|
|
898
|
+
params: DATA_BAR_PARAMS
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
id: OpenConditionalFormattingOperator.id,
|
|
902
|
+
label: "sheets-conditional-formatting-ui.menu.createConditionalFormatting",
|
|
903
|
+
value: 7,
|
|
904
|
+
params: { value: 7 }
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
id: ClearRangeCfCommand.id,
|
|
908
|
+
label: "sheets-conditional-formatting-ui.menu.clearRangeRules",
|
|
909
|
+
value: CFRuleType.dataBar,
|
|
910
|
+
params: { types: [CFRuleType.dataBar] }
|
|
911
|
+
}
|
|
912
|
+
],
|
|
913
|
+
...getQuickConditionalFormattingMenuState(accessor)
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function quickIconSetMenuFactory(accessor) {
|
|
917
|
+
const ratingParams = createIconSetParams(IIconSetType.threeStars);
|
|
918
|
+
return {
|
|
919
|
+
id: AddIconSetConditionalRuleCommand.id,
|
|
920
|
+
type: MenuItemType.BUTTON_SELECTOR,
|
|
921
|
+
icon: "RatingIcon",
|
|
922
|
+
tooltip: "sheets-conditional-formatting-ui.ruleType.iconSet",
|
|
923
|
+
params: ratingParams,
|
|
924
|
+
selectionsCommandId: AddIconSetConditionalRuleCommand.id,
|
|
925
|
+
selections: [
|
|
926
|
+
{
|
|
927
|
+
label: "sheets-conditional-formatting-ui.iconSet.rank",
|
|
928
|
+
value: IIconSetType.threeStars,
|
|
929
|
+
params: ratingParams
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
label: "sheets-conditional-formatting-ui.iconSet.shape",
|
|
933
|
+
value: IIconSetType.threeTrafficLights1,
|
|
934
|
+
params: createIconSetParams(IIconSetType.threeTrafficLights1)
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
label: "sheets-conditional-formatting-ui.iconSet.direction",
|
|
938
|
+
value: IIconSetType.threeArrows,
|
|
939
|
+
params: createIconSetParams(IIconSetType.threeArrows)
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
id: OpenConditionalFormattingOperator.id,
|
|
943
|
+
label: "sheets-conditional-formatting-ui.menu.createConditionalFormatting",
|
|
944
|
+
value: 8,
|
|
945
|
+
params: { value: 8 }
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
id: ClearRangeCfCommand.id,
|
|
949
|
+
label: "sheets-conditional-formatting-ui.menu.clearRangeRules",
|
|
950
|
+
value: CFRuleType.iconSet,
|
|
951
|
+
params: { types: [CFRuleType.iconSet] }
|
|
952
|
+
}
|
|
953
|
+
],
|
|
954
|
+
...getQuickConditionalFormattingMenuState(accessor)
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
|
|
802
958
|
//#endregion
|
|
803
959
|
//#region src/menu/schema.ts
|
|
804
|
-
const menuSchema = {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
960
|
+
const menuSchema = {
|
|
961
|
+
[RibbonInsertGroup.CELL]: {
|
|
962
|
+
[AddDataBarConditionalRuleCommand.id]: {
|
|
963
|
+
order: 3,
|
|
964
|
+
menuItemFactory: quickDataBarMenuFactory
|
|
965
|
+
},
|
|
966
|
+
[AddIconSetConditionalRuleCommand.id]: {
|
|
967
|
+
order: 4,
|
|
968
|
+
menuItemFactory: quickIconSetMenuFactory
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
[RibbonDataGroup.RULES]: { [OpenConditionalFormattingOperator.id]: {
|
|
972
|
+
order: 1,
|
|
973
|
+
menuItemFactory: FactoryManageConditionalFormattingRule
|
|
974
|
+
} }
|
|
975
|
+
};
|
|
808
976
|
|
|
809
977
|
//#endregion
|
|
810
978
|
//#region package.json
|
|
811
979
|
var name = "@univerjs/sheets-conditional-formatting-ui";
|
|
812
|
-
var version = "1.0.0-alpha.
|
|
980
|
+
var version = "1.0.0-alpha.4";
|
|
813
981
|
|
|
814
982
|
//#endregion
|
|
815
983
|
//#region src/config/config.ts
|
|
@@ -1390,7 +1558,7 @@ let SheetsCfRenderController = class SheetsCfRenderController extends Disposable
|
|
|
1390
1558
|
})));
|
|
1391
1559
|
}
|
|
1392
1560
|
_initSkeleton() {
|
|
1393
|
-
this.disposeWithMe(merge$1(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe(bufferTime(16), filter((v) => !!v.length), filter((v) => {
|
|
1561
|
+
this.disposeWithMe(merge$1(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe(bufferTime(16), filter$1((v) => !!v.length), filter$1((v) => {
|
|
1394
1562
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
1395
1563
|
if (!workbook) return false;
|
|
1396
1564
|
const worksheet = workbook.getActiveSheet();
|
|
@@ -1462,6 +1630,7 @@ let UniverSheetsConditionalFormattingMobileUIPlugin = class UniverSheetsConditio
|
|
|
1462
1630
|
AddAverageCfCommand,
|
|
1463
1631
|
AddColorScaleConditionalRuleCommand,
|
|
1464
1632
|
AddDataBarConditionalRuleCommand,
|
|
1633
|
+
AddIconSetConditionalRuleCommand,
|
|
1465
1634
|
AddDuplicateValuesCfCommand,
|
|
1466
1635
|
AddNumberCfCommand,
|
|
1467
1636
|
AddRankCfCommand,
|
|
@@ -2092,11 +2261,10 @@ const ColorPicker$1 = (props) => {
|
|
|
2092
2261
|
|
|
2093
2262
|
//#endregion
|
|
2094
2263
|
//#region src/views/Preview.tsx
|
|
2095
|
-
|
|
2096
|
-
const rule = props
|
|
2097
|
-
if (!rule) return null;
|
|
2264
|
+
function Preview(props) {
|
|
2265
|
+
const { rule } = props;
|
|
2098
2266
|
const colorList = useMemo(() => {
|
|
2099
|
-
if (rule.type === CFRuleType.colorScale) {
|
|
2267
|
+
if ((rule === null || rule === void 0 ? void 0 : rule.type) === CFRuleType.colorScale) {
|
|
2100
2268
|
const config = rule.config.map((c, index) => ({
|
|
2101
2269
|
color: new ColorKit(c.color),
|
|
2102
2270
|
value: index
|
|
@@ -2107,11 +2275,12 @@ const Preview = (props) => {
|
|
|
2107
2275
|
return null;
|
|
2108
2276
|
}, [rule]);
|
|
2109
2277
|
const iconSet = useMemo(() => {
|
|
2110
|
-
if (rule.type === CFRuleType.iconSet) return rule.config.map((item) => {
|
|
2278
|
+
if ((rule === null || rule === void 0 ? void 0 : rule.type) === CFRuleType.iconSet) return rule.config.map((item) => {
|
|
2111
2279
|
const iconList = iconMap[item.iconType];
|
|
2112
2280
|
return iconList && iconList[Number(item.iconId)];
|
|
2113
2281
|
});
|
|
2114
2282
|
}, [rule]);
|
|
2283
|
+
if (!rule) return null;
|
|
2115
2284
|
const previewClassName = "univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";
|
|
2116
2285
|
switch (rule.type) {
|
|
2117
2286
|
case CFRuleType.dataBar: {
|
|
@@ -2177,7 +2346,7 @@ const Preview = (props) => {
|
|
|
2177
2346
|
});
|
|
2178
2347
|
}
|
|
2179
2348
|
}
|
|
2180
|
-
}
|
|
2349
|
+
}
|
|
2181
2350
|
|
|
2182
2351
|
//#endregion
|
|
2183
2352
|
//#region src/views/panel/rule-edit/styles.ts
|
|
@@ -3237,6 +3406,12 @@ const WrapperError = (props) => {
|
|
|
3237
3406
|
|
|
3238
3407
|
//#endregion
|
|
3239
3408
|
//#region src/views/panel/rule-edit/HighlightCell.tsx
|
|
3409
|
+
const textOperators = new Set(Object.values(CFTextOperator));
|
|
3410
|
+
const numberOperators = new Set(Object.values(CFNumberOperator));
|
|
3411
|
+
const timePeriodOperators = new Set(Object.values(CFTimePeriodOperator));
|
|
3412
|
+
const isTextOperator = (value) => typeof value === "string" && textOperators.has(value);
|
|
3413
|
+
const isNumberOperator = (value) => typeof value === "string" && numberOperators.has(value);
|
|
3414
|
+
const isTimePeriodOperator = (value) => typeof value === "string" && timePeriodOperators.has(value);
|
|
3240
3415
|
const createOptionItem = (text) => ({
|
|
3241
3416
|
label: `sheets-conditional-formatting-ui.operator.${text}`,
|
|
3242
3417
|
value: text
|
|
@@ -3478,81 +3653,66 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3478
3653
|
var _operatorOptions$;
|
|
3479
3654
|
const defaultV = (_operatorOptions$ = operatorOptions[0]) === null || _operatorOptions$ === void 0 ? void 0 : _operatorOptions$.value;
|
|
3480
3655
|
if (!rule) return defaultV;
|
|
3481
|
-
return rule.operator
|
|
3656
|
+
return "operator" in rule ? rule.operator : defaultV;
|
|
3482
3657
|
});
|
|
3483
3658
|
const [value, setValue] = useState(() => {
|
|
3484
|
-
var _value2;
|
|
3485
3659
|
const defaultV = "";
|
|
3486
3660
|
if (!rule) return defaultV;
|
|
3487
|
-
|
|
3661
|
+
if ("value" in rule && rule.value !== void 0) return rule.value;
|
|
3662
|
+
return "operator" in rule ? createDefaultValue(rule.subType, rule.operator) : defaultV;
|
|
3488
3663
|
});
|
|
3489
3664
|
const [style, setStyle] = useState({});
|
|
3490
3665
|
const getResult = useMemo(() => (option) => {
|
|
3491
|
-
var _option$
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
case CFSubRuleType.number:
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
CFNumberOperator.greaterThan,
|
|
3525
|
-
CFNumberOperator.greaterThanOrEqual,
|
|
3526
|
-
CFNumberOperator.lessThan,
|
|
3527
|
-
CFNumberOperator.lessThanOrEqual
|
|
3528
|
-
].includes(operator)) {
|
|
3529
|
-
var _option$subType3, _option$operator2, _option$style3, _option$value2;
|
|
3530
|
-
return {
|
|
3531
|
-
type: CFRuleType.highlightCell,
|
|
3532
|
-
subType: (_option$subType3 = option.subType) !== null && _option$subType3 !== void 0 ? _option$subType3 : subType,
|
|
3533
|
-
operator: (_option$operator2 = option.operator) !== null && _option$operator2 !== void 0 ? _option$operator2 : operator,
|
|
3534
|
-
style: (_option$style3 = option.style) !== null && _option$style3 !== void 0 ? _option$style3 : style,
|
|
3535
|
-
value: (_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : value
|
|
3536
|
-
};
|
|
3537
|
-
}
|
|
3538
|
-
if ([CFNumberOperator.between, CFNumberOperator.notBetween].includes(operator)) {
|
|
3539
|
-
var _option$subType4, _option$operator3, _option$style4, _option$value3;
|
|
3666
|
+
var _option$subType, _option$operator, _option$value, _option$style;
|
|
3667
|
+
const nextSubType = (_option$subType = option.subType) !== null && _option$subType !== void 0 ? _option$subType : subType;
|
|
3668
|
+
const nextOperator = (_option$operator = option.operator) !== null && _option$operator !== void 0 ? _option$operator : operator;
|
|
3669
|
+
const nextValue = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : value;
|
|
3670
|
+
const nextStyle = (_option$style = option.style) !== null && _option$style !== void 0 ? _option$style : style;
|
|
3671
|
+
switch (nextSubType) {
|
|
3672
|
+
case CFSubRuleType.duplicateValues: return {
|
|
3673
|
+
type: CFRuleType.highlightCell,
|
|
3674
|
+
subType: CFSubRuleType.duplicateValues,
|
|
3675
|
+
style: nextStyle
|
|
3676
|
+
};
|
|
3677
|
+
case CFSubRuleType.uniqueValues: return {
|
|
3678
|
+
type: CFRuleType.highlightCell,
|
|
3679
|
+
subType: CFSubRuleType.uniqueValues,
|
|
3680
|
+
style: nextStyle
|
|
3681
|
+
};
|
|
3682
|
+
case CFSubRuleType.text: return {
|
|
3683
|
+
type: CFRuleType.highlightCell,
|
|
3684
|
+
subType: CFSubRuleType.text,
|
|
3685
|
+
operator: isTextOperator(nextOperator) ? nextOperator : CFTextOperator.containsText,
|
|
3686
|
+
style: nextStyle,
|
|
3687
|
+
value: typeof nextValue === "string" ? nextValue : void 0
|
|
3688
|
+
};
|
|
3689
|
+
case CFSubRuleType.timePeriod: return {
|
|
3690
|
+
type: CFRuleType.highlightCell,
|
|
3691
|
+
subType: CFSubRuleType.timePeriod,
|
|
3692
|
+
operator: isTimePeriodOperator(nextOperator) ? nextOperator : CFTimePeriodOperator.today,
|
|
3693
|
+
style: nextStyle
|
|
3694
|
+
};
|
|
3695
|
+
case CFSubRuleType.number: {
|
|
3696
|
+
const numberOperator = isNumberOperator(nextOperator) ? nextOperator : CFNumberOperator.equal;
|
|
3697
|
+
if (numberOperator === CFNumberOperator.between || numberOperator === CFNumberOperator.notBetween) {
|
|
3698
|
+
const range = Array.isArray(nextValue) ? nextValue : [0, 100];
|
|
3540
3699
|
return {
|
|
3541
3700
|
type: CFRuleType.highlightCell,
|
|
3542
|
-
subType:
|
|
3543
|
-
operator:
|
|
3544
|
-
style:
|
|
3545
|
-
value:
|
|
3701
|
+
subType: CFSubRuleType.number,
|
|
3702
|
+
operator: numberOperator,
|
|
3703
|
+
style: nextStyle,
|
|
3704
|
+
value: range
|
|
3546
3705
|
};
|
|
3547
3706
|
}
|
|
3548
|
-
|
|
3707
|
+
return {
|
|
3708
|
+
type: CFRuleType.highlightCell,
|
|
3709
|
+
subType: CFSubRuleType.number,
|
|
3710
|
+
operator: numberOperator,
|
|
3711
|
+
style: nextStyle,
|
|
3712
|
+
value: typeof nextValue === "number" ? nextValue : void 0
|
|
3713
|
+
};
|
|
3714
|
+
}
|
|
3549
3715
|
}
|
|
3550
|
-
return {
|
|
3551
|
-
type: CFRuleType.highlightCell,
|
|
3552
|
-
subType: (_option$subType5 = option.subType) !== null && _option$subType5 !== void 0 ? _option$subType5 : subType,
|
|
3553
|
-
operator: (_option$operator4 = option.operator) !== null && _option$operator4 !== void 0 ? _option$operator4 : operator,
|
|
3554
|
-
style: (_option$style5 = option.style) !== null && _option$style5 !== void 0 ? _option$style5 : style
|
|
3555
|
-
};
|
|
3556
3716
|
}, [
|
|
3557
3717
|
subType,
|
|
3558
3718
|
operator,
|
|
@@ -3568,8 +3728,9 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3568
3728
|
if (!typeOptions.some((item) => item.value === subType)) setSubType(typeOptions[0].value);
|
|
3569
3729
|
}, [typeOptions]);
|
|
3570
3730
|
const onTypeChange = (v) => {
|
|
3571
|
-
var _operatorList$;
|
|
3572
|
-
const _subType = v;
|
|
3731
|
+
var _typeOptions$find, _operatorList$;
|
|
3732
|
+
const _subType = (_typeOptions$find = typeOptions.find((item) => item.value === v)) === null || _typeOptions$find === void 0 ? void 0 : _typeOptions$find.value;
|
|
3733
|
+
if (!_subType) return;
|
|
3573
3734
|
const _operator = (_operatorList$ = getOperatorOptions(_subType).map((option) => ({
|
|
3574
3735
|
...option,
|
|
3575
3736
|
label: localeService.t(option.label)
|
|
@@ -3583,7 +3744,9 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3583
3744
|
}));
|
|
3584
3745
|
};
|
|
3585
3746
|
const onOperatorChange = (v) => {
|
|
3586
|
-
|
|
3747
|
+
var _operatorOptions$find;
|
|
3748
|
+
const _operator = (_operatorOptions$find = operatorOptions.find((item) => item.value === v)) === null || _operatorOptions$find === void 0 ? void 0 : _operatorOptions$find.value;
|
|
3749
|
+
if (!_operator) return;
|
|
3587
3750
|
setOperator(_operator);
|
|
3588
3751
|
onChange(getResult({ operator: _operator }));
|
|
3589
3752
|
};
|
|
@@ -3591,9 +3754,6 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3591
3754
|
setValue(value);
|
|
3592
3755
|
onChange(getResult({ value }));
|
|
3593
3756
|
};
|
|
3594
|
-
const inputRenderKey = useMemo(() => {
|
|
3595
|
-
return `${subType}_${operator}_${Math.random()}`;
|
|
3596
|
-
}, [subType, operator]);
|
|
3597
3757
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
3598
3758
|
/* @__PURE__ */ jsx("div", {
|
|
3599
3759
|
className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
|
|
@@ -3620,7 +3780,7 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3620
3780
|
operator,
|
|
3621
3781
|
rule,
|
|
3622
3782
|
onChange: onInputChange
|
|
3623
|
-
},
|
|
3783
|
+
}, `${subType}_${operator}`),
|
|
3624
3784
|
/* @__PURE__ */ jsx("div", {
|
|
3625
3785
|
className: previewClassName,
|
|
3626
3786
|
children: /* @__PURE__ */ jsx(Preview, { rule: getResult({}) })
|
|
@@ -3688,34 +3848,34 @@ const createDefaultConfigItem = (iconType, index, list) => ({
|
|
|
3688
3848
|
iconType,
|
|
3689
3849
|
iconId: String(index)
|
|
3690
3850
|
});
|
|
3691
|
-
const IconGroupList =
|
|
3692
|
-
const { onClick } = props;
|
|
3851
|
+
const IconGroupList = (props) => {
|
|
3852
|
+
const { iconType, onClick } = props;
|
|
3693
3853
|
const localeService = useDependency(LocaleService);
|
|
3694
|
-
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
3695
|
-
const handleClick = (iconType) => {
|
|
3696
|
-
onClick(iconType);
|
|
3697
|
-
};
|
|
3698
3854
|
return /* @__PURE__ */ jsx("div", {
|
|
3699
|
-
|
|
3700
|
-
dir: direction,
|
|
3855
|
+
dir: useObservable(localeService.direction$, localeService.getDirection()),
|
|
3701
3856
|
className: "univer-w-80",
|
|
3702
|
-
children: iconGroup.map((group
|
|
3857
|
+
children: iconGroup.map((group) => {
|
|
3703
3858
|
return /* @__PURE__ */ jsxs("div", {
|
|
3704
|
-
className: "univer-mb-
|
|
3859
|
+
className: "univer-mb-4 last:univer-mb-0",
|
|
3705
3860
|
children: [/* @__PURE__ */ jsx("div", {
|
|
3706
|
-
className: "univer-mb-1 univer-text-
|
|
3861
|
+
className: "univer-mb-2 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400",
|
|
3707
3862
|
children: localeService.t(group.title)
|
|
3708
3863
|
}), /* @__PURE__ */ jsx("div", {
|
|
3709
|
-
className: "univer-
|
|
3710
|
-
children: group.group.map((groupItem) => {
|
|
3711
|
-
|
|
3712
|
-
|
|
3864
|
+
className: "univer-grid univer-grid-cols-2 univer-gap-1",
|
|
3865
|
+
children: group.group.map((groupItem, groupItemIndex) => {
|
|
3866
|
+
const selected = groupItem.name === iconType;
|
|
3867
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3868
|
+
type: "button",
|
|
3869
|
+
"aria-label": `${localeService.t(group.title)} ${groupItemIndex + 1}`,
|
|
3870
|
+
"aria-pressed": selected,
|
|
3871
|
+
className: clsx("univer-flex univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-md univer-border-0 univer-bg-transparent univer-px-2 univer-outline-none univer-transition-colors focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 rtl:univer-flex-row-reverse", selected ? "univer-bg-primary-50 univer-ring-1 univer-ring-primary-600 dark:!univer-bg-primary-900" : "hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700"),
|
|
3713
3872
|
onClick: () => {
|
|
3714
|
-
|
|
3873
|
+
onClick(groupItem.name);
|
|
3715
3874
|
},
|
|
3716
|
-
children: /* @__PURE__ */ jsx("
|
|
3717
|
-
className: "univer-flex univer-
|
|
3875
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
3876
|
+
className: "univer-flex univer-items-center univer-gap-0.5",
|
|
3718
3877
|
children: groupItem.list.map((base64, index) => /* @__PURE__ */ jsx("img", {
|
|
3878
|
+
alt: "",
|
|
3719
3879
|
className: "univer-size-5",
|
|
3720
3880
|
src: base64,
|
|
3721
3881
|
draggable: false
|
|
@@ -3724,10 +3884,10 @@ const IconGroupList = forwardRef((props, ref) => {
|
|
|
3724
3884
|
}, groupItem.name);
|
|
3725
3885
|
})
|
|
3726
3886
|
})]
|
|
3727
|
-
},
|
|
3887
|
+
}, group.title);
|
|
3728
3888
|
})
|
|
3729
3889
|
});
|
|
3730
|
-
}
|
|
3890
|
+
};
|
|
3731
3891
|
const IconItemList = (props) => {
|
|
3732
3892
|
const { onClick } = props;
|
|
3733
3893
|
const localeService = useDependency(LocaleService);
|
|
@@ -3879,7 +4039,7 @@ const IconSetRuleEdit = (props) => {
|
|
|
3879
4039
|
src: icon,
|
|
3880
4040
|
className: "univer-size-4",
|
|
3881
4041
|
draggable: false
|
|
3882
|
-
}) : /* @__PURE__ */ jsx(SlashDoubleIcon, {
|
|
4042
|
+
}) : /* @__PURE__ */ jsx(SlashDoubleIcon, {}), /* @__PURE__ */ jsx(MoreDownIcon, {})]
|
|
3883
4043
|
})
|
|
3884
4044
|
})
|
|
3885
4045
|
}), !isEnd ? /* @__PURE__ */ jsx(Select, {
|
|
@@ -4065,9 +4225,6 @@ const IconSet = (props) => {
|
|
|
4065
4225
|
});
|
|
4066
4226
|
setConfigList([...configList]);
|
|
4067
4227
|
};
|
|
4068
|
-
const layoutService = useDependency(ILayoutService);
|
|
4069
|
-
const [iconGroupListEl, setIconGroupListEl] = useState();
|
|
4070
|
-
useScrollYOverContainer(iconGroupListEl, layoutService.rootContainerElement);
|
|
4071
4228
|
return /* @__PURE__ */ jsxs("div", {
|
|
4072
4229
|
"data-u-comp": "cf-icon-set-editor",
|
|
4073
4230
|
dir: direction,
|
|
@@ -4081,11 +4238,8 @@ const IconSet = (props) => {
|
|
|
4081
4238
|
children: /* @__PURE__ */ jsx(Dropdown, {
|
|
4082
4239
|
overlay: /* @__PURE__ */ jsx("div", {
|
|
4083
4240
|
dir: direction,
|
|
4084
|
-
className: "univer-rounded-lg univer-p-
|
|
4241
|
+
className: "univer-rounded-lg univer-p-3",
|
|
4085
4242
|
children: /* @__PURE__ */ jsx(IconGroupList, {
|
|
4086
|
-
ref: (el) => {
|
|
4087
|
-
!iconGroupListEl && el && setIconGroupListEl(el);
|
|
4088
|
-
},
|
|
4089
4243
|
iconType: currentIconType,
|
|
4090
4244
|
onClick: handleClickIconList
|
|
4091
4245
|
})
|
|
@@ -4188,34 +4342,36 @@ const RankStyleEditor = (props) => {
|
|
|
4188
4342
|
const [style, setStyle] = useState({});
|
|
4189
4343
|
const getResult = (config) => {
|
|
4190
4344
|
const { type, isPercent, value, style } = config;
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4345
|
+
switch (type) {
|
|
4346
|
+
case "isNotBottom": return {
|
|
4347
|
+
type: CFRuleType.highlightCell,
|
|
4348
|
+
subType: CFSubRuleType.rank,
|
|
4349
|
+
isPercent,
|
|
4350
|
+
isBottom: false,
|
|
4351
|
+
value,
|
|
4352
|
+
style
|
|
4353
|
+
};
|
|
4354
|
+
case "isBottom": return {
|
|
4355
|
+
type: CFRuleType.highlightCell,
|
|
4356
|
+
subType: CFSubRuleType.rank,
|
|
4357
|
+
isPercent,
|
|
4358
|
+
isBottom: true,
|
|
4359
|
+
value,
|
|
4360
|
+
style
|
|
4361
|
+
};
|
|
4362
|
+
case "greaterThanAverage": return {
|
|
4363
|
+
type: CFRuleType.highlightCell,
|
|
4364
|
+
subType: CFSubRuleType.average,
|
|
4365
|
+
operator: CFNumberOperator.greaterThan,
|
|
4366
|
+
style
|
|
4367
|
+
};
|
|
4368
|
+
case "lessThanAverage": return {
|
|
4369
|
+
type: CFRuleType.highlightCell,
|
|
4370
|
+
subType: CFSubRuleType.average,
|
|
4371
|
+
operator: CFNumberOperator.lessThan,
|
|
4372
|
+
style
|
|
4373
|
+
};
|
|
4374
|
+
}
|
|
4219
4375
|
};
|
|
4220
4376
|
useEffect(() => {
|
|
4221
4377
|
return interceptorManager.intercept(interceptorManager.getInterceptPoints().submit, { handler() {
|
|
@@ -4246,13 +4402,17 @@ const RankStyleEditor = (props) => {
|
|
|
4246
4402
|
value: type,
|
|
4247
4403
|
options,
|
|
4248
4404
|
onChange: (v) => {
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4405
|
+
var _options$find;
|
|
4406
|
+
const nextType = (_options$find = options.find((option) => option.value === v)) === null || _options$find === void 0 ? void 0 : _options$find.value;
|
|
4407
|
+
if (nextType) {
|
|
4408
|
+
setType(nextType);
|
|
4409
|
+
_onChange({
|
|
4410
|
+
type: nextType,
|
|
4411
|
+
isPercent,
|
|
4412
|
+
value,
|
|
4413
|
+
style
|
|
4414
|
+
});
|
|
4415
|
+
}
|
|
4256
4416
|
}
|
|
4257
4417
|
}),
|
|
4258
4418
|
["isNotBottom", "isBottom"].includes(type) && /* @__PURE__ */ jsxs("div", {
|
|
@@ -4578,7 +4738,7 @@ const getRuleDescribe = (rule, localeService) => {
|
|
|
4578
4738
|
}
|
|
4579
4739
|
}
|
|
4580
4740
|
};
|
|
4581
|
-
|
|
4741
|
+
function RuleList(props) {
|
|
4582
4742
|
const { onClick } = props;
|
|
4583
4743
|
const conditionalFormattingRuleModel = useDependency(ConditionalFormattingRuleModel);
|
|
4584
4744
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
@@ -4589,12 +4749,9 @@ const RuleList = (props) => {
|
|
|
4589
4749
|
const conditionalFormattingI18nController = useDependency(ConditionalFormattingI18nController);
|
|
4590
4750
|
const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
4591
4751
|
const unitId = workbook.getUnitId();
|
|
4592
|
-
const
|
|
4593
|
-
if (!worksheet) throw new Error("No active sheet found");
|
|
4594
|
-
const subUnitId = worksheet.getSheetId();
|
|
4752
|
+
const subUnitId = workbook.getActiveSheet().getSheetId();
|
|
4595
4753
|
const [currentRuleRanges, setCurrentRuleRanges] = useState([]);
|
|
4596
4754
|
const [selectValue, setSelectValue] = useState("2");
|
|
4597
|
-
const [fetchRuleListId, setFetchRuleListId] = useState(0);
|
|
4598
4755
|
const [draggingId, setDraggingId] = useState("");
|
|
4599
4756
|
const selectOption = [{
|
|
4600
4757
|
label: localeService.t("sheets-conditional-formatting-ui.panel.workSheet"),
|
|
@@ -4616,25 +4773,8 @@ const RuleList = (props) => {
|
|
|
4616
4773
|
} else if (selectValue === "2") return [...ruleList];
|
|
4617
4774
|
return [];
|
|
4618
4775
|
};
|
|
4619
|
-
const
|
|
4620
|
-
|
|
4621
|
-
useEffect(() => {
|
|
4622
|
-
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
4623
|
-
if (commandInfo.id === SetWorksheetActiveOperation.id) setFetchRuleListId(Math.random());
|
|
4624
|
-
});
|
|
4625
|
-
return () => disposable.dispose();
|
|
4626
|
-
});
|
|
4627
|
-
useEffect(() => {
|
|
4628
|
-
setRuleList(getRuleList);
|
|
4629
|
-
}, [
|
|
4630
|
-
selectValue,
|
|
4631
|
-
fetchRuleListId,
|
|
4632
|
-
unitId,
|
|
4633
|
-
subUnitId
|
|
4634
|
-
]);
|
|
4635
|
-
useEffect(() => {
|
|
4636
|
-
if (selectValue === "2") return;
|
|
4637
|
-
const subscription = new Observable((commandSubscribe) => {
|
|
4776
|
+
const ruleList = useObservable(() => {
|
|
4777
|
+
const commandEvent$ = new Observable((subscriber) => {
|
|
4638
4778
|
const commandList = [
|
|
4639
4779
|
SetSelectionsOperation.id,
|
|
4640
4780
|
AddConditionalRuleMutation.id,
|
|
@@ -4643,29 +4783,25 @@ const RuleList = (props) => {
|
|
|
4643
4783
|
MoveConditionalRuleMutation.id
|
|
4644
4784
|
];
|
|
4645
4785
|
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4786
|
+
var _commandInfo$params;
|
|
4787
|
+
if (commandInfo.id === SetWorksheetActiveOperation.id) {
|
|
4788
|
+
subscriber.next("immediate");
|
|
4789
|
+
return;
|
|
4790
|
+
}
|
|
4791
|
+
const commandUnitId = (_commandInfo$params = commandInfo.params) === null || _commandInfo$params === void 0 ? void 0 : _commandInfo$params.unitId;
|
|
4792
|
+
if (selectValue === "1" && commandList.includes(commandInfo.id) && commandUnitId === unitId) subscriber.next("debounced");
|
|
4649
4793
|
});
|
|
4650
4794
|
return () => disposable.dispose();
|
|
4651
|
-
}).pipe(
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
};
|
|
4657
|
-
}, [
|
|
4658
|
-
univerInstanceService,
|
|
4795
|
+
}).pipe(share());
|
|
4796
|
+
return merge$1(conditionalFormattingRuleModel.$ruleChange, commandEvent$.pipe(filter((event) => event === "immediate")), commandEvent$.pipe(filter((event) => event === "debounced"), debounceTime(16))).pipe(map(getRuleList), startWith(getRuleList()));
|
|
4797
|
+
}, [], false, [
|
|
4798
|
+
commandService,
|
|
4799
|
+
conditionalFormattingRuleModel,
|
|
4659
4800
|
selectValue,
|
|
4660
|
-
|
|
4661
|
-
|
|
4801
|
+
subUnitId,
|
|
4802
|
+
unitId
|
|
4662
4803
|
]);
|
|
4663
|
-
|
|
4664
|
-
const dispose = conditionalFormattingRuleModel.$ruleChange.subscribe(() => {
|
|
4665
|
-
setFetchRuleListId(Math.random());
|
|
4666
|
-
});
|
|
4667
|
-
return () => dispose.unsubscribe();
|
|
4668
|
-
}, [conditionalFormattingRuleModel]);
|
|
4804
|
+
useHighlightRange(currentRuleRanges);
|
|
4669
4805
|
const handleDelete = (rule) => {
|
|
4670
4806
|
var _getActiveSheet;
|
|
4671
4807
|
const unitId = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId();
|
|
@@ -4817,7 +4953,7 @@ const RuleList = (props) => {
|
|
|
4817
4953
|
]
|
|
4818
4954
|
})
|
|
4819
4955
|
}) })] });
|
|
4820
|
-
}
|
|
4956
|
+
}
|
|
4821
4957
|
|
|
4822
4958
|
//#endregion
|
|
4823
4959
|
//#region src/views/ConditionFormattingPanel.tsx
|
|
@@ -4877,7 +5013,11 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
4877
5013
|
this.disposeWithMe(this._componentManager.register(CF_PANEL_KEY, ConditionFormattingPanel));
|
|
4878
5014
|
}
|
|
4879
5015
|
_registerIcons() {
|
|
4880
|
-
this.disposeWithMe(this._iconManager.register({
|
|
5016
|
+
this.disposeWithMe(this._iconManager.register({
|
|
5017
|
+
ConditionsDoubleIcon,
|
|
5018
|
+
DataBarIcon,
|
|
5019
|
+
RatingIcon
|
|
5020
|
+
}));
|
|
4881
5021
|
}
|
|
4882
5022
|
};
|
|
4883
5023
|
ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
|
|
@@ -4961,6 +5101,7 @@ let UniverSheetsConditionalFormattingUIPlugin = class UniverSheetsConditionalFor
|
|
|
4961
5101
|
AddAverageCfCommand,
|
|
4962
5102
|
AddColorScaleConditionalRuleCommand,
|
|
4963
5103
|
AddDataBarConditionalRuleCommand,
|
|
5104
|
+
AddIconSetConditionalRuleCommand,
|
|
4964
5105
|
AddDuplicateValuesCfCommand,
|
|
4965
5106
|
AddNumberCfCommand,
|
|
4966
5107
|
AddRankCfCommand,
|
|
@@ -4985,4 +5126,4 @@ UniverSheetsConditionalFormattingUIPlugin = __decorate([
|
|
|
4985
5126
|
], UniverSheetsConditionalFormattingUIPlugin);
|
|
4986
5127
|
|
|
4987
5128
|
//#endregion
|
|
4988
|
-
export { AddAverageCfCommand, AddColorScaleConditionalRuleCommand, AddDataBarConditionalRuleCommand, AddDuplicateValuesCfCommand, AddNumberCfCommand, AddRankCfCommand, AddTextCfCommand, AddTimePeriodCfCommand, AddUniqueValuesCfCommand, ConditionalFormattingClearController, OpenConditionalFormattingOperator, menuSchema as SheetsConditionalFormattingUIMenuSchema, UniverSheetsConditionalFormattingMobileUIPlugin, UniverSheetsConditionalFormattingUIPlugin };
|
|
5129
|
+
export { AddAverageCfCommand, AddColorScaleConditionalRuleCommand, AddDataBarConditionalRuleCommand, AddDuplicateValuesCfCommand, AddIconSetConditionalRuleCommand, AddNumberCfCommand, AddRankCfCommand, AddTextCfCommand, AddTimePeriodCfCommand, AddUniqueValuesCfCommand, ConditionalFormattingClearController, OpenConditionalFormattingOperator, menuSchema as SheetsConditionalFormattingUIMenuSchema, UniverSheetsConditionalFormattingMobileUIPlugin, UniverSheetsConditionalFormattingUIPlugin };
|