@univerjs/sheets-conditional-formatting-ui 1.0.0-alpha.3 → 1.0.0-alpha.5
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/cjs/index.js
CHANGED
|
@@ -82,8 +82,11 @@ const AddDataBarConditionalRuleCommand = {
|
|
|
82
82
|
type: _univerjs_core.CommandType.COMMAND,
|
|
83
83
|
id: "sheet.command.add-data-bar-conditional-rule",
|
|
84
84
|
handler(accessor, params) {
|
|
85
|
+
var _params$ranges;
|
|
85
86
|
if (!params) return false;
|
|
86
|
-
const {
|
|
87
|
+
const { min, max, nativeColor, positiveColor, isGradient, stopIfTrue, isShowValue } = params;
|
|
88
|
+
const ranges = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
|
|
89
|
+
if (!ranges.length) return false;
|
|
87
90
|
const conditionalFormattingRuleModel = accessor.get(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel);
|
|
88
91
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
|
|
89
92
|
if (!target) return false;
|
|
@@ -144,6 +147,37 @@ const AddDuplicateValuesCfCommand = {
|
|
|
144
147
|
}
|
|
145
148
|
};
|
|
146
149
|
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/commands/commands/add-icon-set-cf.command.ts
|
|
152
|
+
const AddIconSetConditionalRuleCommand = {
|
|
153
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
154
|
+
id: "sheet.command.add-icon-set-conditional-rule",
|
|
155
|
+
handler(accessor, params) {
|
|
156
|
+
var _params$ranges;
|
|
157
|
+
if (!params) return false;
|
|
158
|
+
const ranges = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
|
|
159
|
+
if (!ranges.length) return false;
|
|
160
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
|
|
161
|
+
if (!target) return false;
|
|
162
|
+
const { unitId, subUnitId } = target;
|
|
163
|
+
const rule = {
|
|
164
|
+
ranges,
|
|
165
|
+
cfId: accessor.get(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel).createCfId(unitId, subUnitId),
|
|
166
|
+
stopIfTrue: !!params.stopIfTrue,
|
|
167
|
+
rule: {
|
|
168
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.iconSet,
|
|
169
|
+
config: params.config,
|
|
170
|
+
isShowValue: params.isShowValue
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
return accessor.get(_univerjs_core.ICommandService).executeCommand(_univerjs_sheets_conditional_formatting.AddConditionalRuleMutation.id, {
|
|
174
|
+
unitId,
|
|
175
|
+
subUnitId,
|
|
176
|
+
rule
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
147
181
|
//#endregion
|
|
148
182
|
//#region src/commands/commands/add-number-cf.command.ts
|
|
149
183
|
const AddNumberCfCommand = {
|
|
@@ -394,11 +428,9 @@ function __decorate(decorators, target, key, desc) {
|
|
|
394
428
|
//#region src/controllers/cf.panel.controller.ts
|
|
395
429
|
const CF_PANEL_KEY$1 = "sheet.conditional.formatting.panel";
|
|
396
430
|
let ConditionalFormattingPanelController = class ConditionalFormattingPanelController extends _univerjs_core.Disposable {
|
|
397
|
-
constructor(_univerInstanceService,
|
|
431
|
+
constructor(_univerInstanceService, _sidebarService, _localeService) {
|
|
398
432
|
super();
|
|
399
433
|
this._univerInstanceService = _univerInstanceService;
|
|
400
|
-
this._injector = _injector;
|
|
401
|
-
this._componentManager = _componentManager;
|
|
402
434
|
this._sidebarService = _sidebarService;
|
|
403
435
|
this._localeService = _localeService;
|
|
404
436
|
_defineProperty(this, "_sidebarDisposable", null);
|
|
@@ -430,10 +462,8 @@ let ConditionalFormattingPanelController = class ConditionalFormattingPanelContr
|
|
|
430
462
|
};
|
|
431
463
|
ConditionalFormattingPanelController = __decorate([
|
|
432
464
|
__decorateParam(0, _univerjs_core.IUniverInstanceService),
|
|
433
|
-
__decorateParam(1, (0, _univerjs_core.Inject)(
|
|
434
|
-
__decorateParam(2, (0, _univerjs_core.Inject)(
|
|
435
|
-
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_ui.ISidebarService)),
|
|
436
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
|
|
465
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.ISidebarService)),
|
|
466
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
|
|
437
467
|
], ConditionalFormattingPanelController);
|
|
438
468
|
|
|
439
469
|
//#endregion
|
|
@@ -800,17 +830,155 @@ function FactoryManageConditionalFormattingRule(accessor) {
|
|
|
800
830
|
};
|
|
801
831
|
}
|
|
802
832
|
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/menu/quick-insert.menu.ts
|
|
835
|
+
const DATA_BAR_PARAMS = {
|
|
836
|
+
min: { type: _univerjs_sheets_conditional_formatting.CFValueType.min },
|
|
837
|
+
max: { type: _univerjs_sheets_conditional_formatting.CFValueType.max },
|
|
838
|
+
nativeColor: _univerjs_sheets_conditional_formatting.defaultDataBarNativeColor,
|
|
839
|
+
positiveColor: _univerjs_sheets_conditional_formatting.defaultDataBarPositiveColor,
|
|
840
|
+
isGradient: false,
|
|
841
|
+
isShowValue: true
|
|
842
|
+
};
|
|
843
|
+
function createIconSetParams(iconType) {
|
|
844
|
+
return {
|
|
845
|
+
config: [
|
|
846
|
+
{
|
|
847
|
+
iconType,
|
|
848
|
+
iconId: "0",
|
|
849
|
+
operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThanOrEqual,
|
|
850
|
+
value: {
|
|
851
|
+
type: _univerjs_sheets_conditional_formatting.CFValueType.percent,
|
|
852
|
+
value: 67
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
iconType,
|
|
857
|
+
iconId: "1",
|
|
858
|
+
operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThanOrEqual,
|
|
859
|
+
value: {
|
|
860
|
+
type: _univerjs_sheets_conditional_formatting.CFValueType.percent,
|
|
861
|
+
value: 33
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
iconType,
|
|
866
|
+
iconId: "2",
|
|
867
|
+
operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.lessThanOrEqual,
|
|
868
|
+
value: {
|
|
869
|
+
type: _univerjs_sheets_conditional_formatting.CFValueType.percent,
|
|
870
|
+
value: Number.MAX_SAFE_INTEGER
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
],
|
|
874
|
+
isShowValue: true
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
function getQuickConditionalFormattingMenuState(accessor) {
|
|
878
|
+
return {
|
|
879
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
|
|
880
|
+
disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
|
|
881
|
+
workbookTypes: [_univerjs_sheets.WorkbookEditablePermission],
|
|
882
|
+
worksheetTypes: [_univerjs_sheets.WorksheetSetCellStylePermission, _univerjs_sheets.WorksheetEditPermission],
|
|
883
|
+
rangeTypes: [_univerjs_sheets.RangeProtectionPermissionEditPoint]
|
|
884
|
+
})
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
function quickDataBarMenuFactory(accessor) {
|
|
888
|
+
return {
|
|
889
|
+
id: AddDataBarConditionalRuleCommand.id,
|
|
890
|
+
type: _univerjs_ui.MenuItemType.BUTTON_SELECTOR,
|
|
891
|
+
icon: "DataBarIcon",
|
|
892
|
+
tooltip: "sheets-conditional-formatting-ui.ruleType.dataBar",
|
|
893
|
+
params: DATA_BAR_PARAMS,
|
|
894
|
+
selectionsCommandId: AddDataBarConditionalRuleCommand.id,
|
|
895
|
+
selections: [
|
|
896
|
+
{
|
|
897
|
+
label: "sheets-conditional-formatting-ui.ruleType.dataBar",
|
|
898
|
+
value: _univerjs_sheets_conditional_formatting.CFRuleType.dataBar,
|
|
899
|
+
params: DATA_BAR_PARAMS
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
id: OpenConditionalFormattingOperator.id,
|
|
903
|
+
label: "sheets-conditional-formatting-ui.menu.createConditionalFormatting",
|
|
904
|
+
value: 7,
|
|
905
|
+
params: { value: 7 }
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
id: _univerjs_sheets_conditional_formatting.ClearRangeCfCommand.id,
|
|
909
|
+
label: "sheets-conditional-formatting-ui.menu.clearRangeRules",
|
|
910
|
+
value: _univerjs_sheets_conditional_formatting.CFRuleType.dataBar,
|
|
911
|
+
params: { types: [_univerjs_sheets_conditional_formatting.CFRuleType.dataBar] }
|
|
912
|
+
}
|
|
913
|
+
],
|
|
914
|
+
...getQuickConditionalFormattingMenuState(accessor)
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
function quickIconSetMenuFactory(accessor) {
|
|
918
|
+
const ratingParams = createIconSetParams(_univerjs_sheets_conditional_formatting.IIconSetType.threeStars);
|
|
919
|
+
return {
|
|
920
|
+
id: AddIconSetConditionalRuleCommand.id,
|
|
921
|
+
type: _univerjs_ui.MenuItemType.BUTTON_SELECTOR,
|
|
922
|
+
icon: "RatingIcon",
|
|
923
|
+
tooltip: "sheets-conditional-formatting-ui.ruleType.iconSet",
|
|
924
|
+
params: ratingParams,
|
|
925
|
+
selectionsCommandId: AddIconSetConditionalRuleCommand.id,
|
|
926
|
+
selections: [
|
|
927
|
+
{
|
|
928
|
+
label: "sheets-conditional-formatting-ui.iconSet.rank",
|
|
929
|
+
value: _univerjs_sheets_conditional_formatting.IIconSetType.threeStars,
|
|
930
|
+
params: ratingParams
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
label: "sheets-conditional-formatting-ui.iconSet.shape",
|
|
934
|
+
value: _univerjs_sheets_conditional_formatting.IIconSetType.threeTrafficLights1,
|
|
935
|
+
params: createIconSetParams(_univerjs_sheets_conditional_formatting.IIconSetType.threeTrafficLights1)
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
label: "sheets-conditional-formatting-ui.iconSet.direction",
|
|
939
|
+
value: _univerjs_sheets_conditional_formatting.IIconSetType.threeArrows,
|
|
940
|
+
params: createIconSetParams(_univerjs_sheets_conditional_formatting.IIconSetType.threeArrows)
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
id: OpenConditionalFormattingOperator.id,
|
|
944
|
+
label: "sheets-conditional-formatting-ui.menu.createConditionalFormatting",
|
|
945
|
+
value: 8,
|
|
946
|
+
params: { value: 8 }
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
id: _univerjs_sheets_conditional_formatting.ClearRangeCfCommand.id,
|
|
950
|
+
label: "sheets-conditional-formatting-ui.menu.clearRangeRules",
|
|
951
|
+
value: _univerjs_sheets_conditional_formatting.CFRuleType.iconSet,
|
|
952
|
+
params: { types: [_univerjs_sheets_conditional_formatting.CFRuleType.iconSet] }
|
|
953
|
+
}
|
|
954
|
+
],
|
|
955
|
+
...getQuickConditionalFormattingMenuState(accessor)
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
|
|
803
959
|
//#endregion
|
|
804
960
|
//#region src/menu/schema.ts
|
|
805
|
-
const menuSchema = {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
961
|
+
const menuSchema = {
|
|
962
|
+
[_univerjs_ui.RibbonInsertGroup.CELL]: {
|
|
963
|
+
[AddDataBarConditionalRuleCommand.id]: {
|
|
964
|
+
order: 3,
|
|
965
|
+
menuItemFactory: quickDataBarMenuFactory
|
|
966
|
+
},
|
|
967
|
+
[AddIconSetConditionalRuleCommand.id]: {
|
|
968
|
+
order: 4,
|
|
969
|
+
menuItemFactory: quickIconSetMenuFactory
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
[_univerjs_ui.RibbonDataGroup.RULES]: { [OpenConditionalFormattingOperator.id]: {
|
|
973
|
+
order: 1,
|
|
974
|
+
menuItemFactory: FactoryManageConditionalFormattingRule
|
|
975
|
+
} }
|
|
976
|
+
};
|
|
809
977
|
|
|
810
978
|
//#endregion
|
|
811
979
|
//#region package.json
|
|
812
980
|
var name = "@univerjs/sheets-conditional-formatting-ui";
|
|
813
|
-
var version = "1.0.0-alpha.
|
|
981
|
+
var version = "1.0.0-alpha.5";
|
|
814
982
|
|
|
815
983
|
//#endregion
|
|
816
984
|
//#region src/config/config.ts
|
|
@@ -1463,6 +1631,7 @@ let UniverSheetsConditionalFormattingMobileUIPlugin = class UniverSheetsConditio
|
|
|
1463
1631
|
AddAverageCfCommand,
|
|
1464
1632
|
AddColorScaleConditionalRuleCommand,
|
|
1465
1633
|
AddDataBarConditionalRuleCommand,
|
|
1634
|
+
AddIconSetConditionalRuleCommand,
|
|
1466
1635
|
AddDuplicateValuesCfCommand,
|
|
1467
1636
|
AddNumberCfCommand,
|
|
1468
1637
|
AddRankCfCommand,
|
|
@@ -2093,11 +2262,10 @@ const ColorPicker = (props) => {
|
|
|
2093
2262
|
|
|
2094
2263
|
//#endregion
|
|
2095
2264
|
//#region src/views/Preview.tsx
|
|
2096
|
-
|
|
2097
|
-
const rule = props
|
|
2098
|
-
if (!rule) return null;
|
|
2265
|
+
function Preview(props) {
|
|
2266
|
+
const { rule } = props;
|
|
2099
2267
|
const colorList = (0, react.useMemo)(() => {
|
|
2100
|
-
if (rule.type === _univerjs_sheets_conditional_formatting.CFRuleType.colorScale) {
|
|
2268
|
+
if ((rule === null || rule === void 0 ? void 0 : rule.type) === _univerjs_sheets_conditional_formatting.CFRuleType.colorScale) {
|
|
2101
2269
|
const config = rule.config.map((c, index) => ({
|
|
2102
2270
|
color: new _univerjs_core.ColorKit(c.color),
|
|
2103
2271
|
value: index
|
|
@@ -2108,11 +2276,12 @@ const Preview = (props) => {
|
|
|
2108
2276
|
return null;
|
|
2109
2277
|
}, [rule]);
|
|
2110
2278
|
const iconSet = (0, react.useMemo)(() => {
|
|
2111
|
-
if (rule.type === _univerjs_sheets_conditional_formatting.CFRuleType.iconSet) return rule.config.map((item) => {
|
|
2279
|
+
if ((rule === null || rule === void 0 ? void 0 : rule.type) === _univerjs_sheets_conditional_formatting.CFRuleType.iconSet) return rule.config.map((item) => {
|
|
2112
2280
|
const iconList = _univerjs_sheets_conditional_formatting.iconMap[item.iconType];
|
|
2113
2281
|
return iconList && iconList[Number(item.iconId)];
|
|
2114
2282
|
});
|
|
2115
2283
|
}, [rule]);
|
|
2284
|
+
if (!rule) return null;
|
|
2116
2285
|
const previewClassName = "univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";
|
|
2117
2286
|
switch (rule.type) {
|
|
2118
2287
|
case _univerjs_sheets_conditional_formatting.CFRuleType.dataBar: {
|
|
@@ -2178,7 +2347,7 @@ const Preview = (props) => {
|
|
|
2178
2347
|
});
|
|
2179
2348
|
}
|
|
2180
2349
|
}
|
|
2181
|
-
}
|
|
2350
|
+
}
|
|
2182
2351
|
|
|
2183
2352
|
//#endregion
|
|
2184
2353
|
//#region src/views/panel/rule-edit/styles.ts
|
|
@@ -3238,6 +3407,12 @@ const WrapperError = (props) => {
|
|
|
3238
3407
|
|
|
3239
3408
|
//#endregion
|
|
3240
3409
|
//#region src/views/panel/rule-edit/HighlightCell.tsx
|
|
3410
|
+
const textOperators = new Set(Object.values(_univerjs_sheets_conditional_formatting.CFTextOperator));
|
|
3411
|
+
const numberOperators = new Set(Object.values(_univerjs_sheets_conditional_formatting.CFNumberOperator));
|
|
3412
|
+
const timePeriodOperators = new Set(Object.values(_univerjs_sheets_conditional_formatting.CFTimePeriodOperator));
|
|
3413
|
+
const isTextOperator = (value) => typeof value === "string" && textOperators.has(value);
|
|
3414
|
+
const isNumberOperator = (value) => typeof value === "string" && numberOperators.has(value);
|
|
3415
|
+
const isTimePeriodOperator = (value) => typeof value === "string" && timePeriodOperators.has(value);
|
|
3241
3416
|
const createOptionItem = (text) => ({
|
|
3242
3417
|
label: `sheets-conditional-formatting-ui.operator.${text}`,
|
|
3243
3418
|
value: text
|
|
@@ -3479,81 +3654,66 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3479
3654
|
var _operatorOptions$;
|
|
3480
3655
|
const defaultV = (_operatorOptions$ = operatorOptions[0]) === null || _operatorOptions$ === void 0 ? void 0 : _operatorOptions$.value;
|
|
3481
3656
|
if (!rule) return defaultV;
|
|
3482
|
-
return rule.operator
|
|
3657
|
+
return "operator" in rule ? rule.operator : defaultV;
|
|
3483
3658
|
});
|
|
3484
3659
|
const [value, setValue] = (0, react.useState)(() => {
|
|
3485
|
-
var _value2;
|
|
3486
3660
|
const defaultV = "";
|
|
3487
3661
|
if (!rule) return defaultV;
|
|
3488
|
-
|
|
3662
|
+
if ("value" in rule && rule.value !== void 0) return rule.value;
|
|
3663
|
+
return "operator" in rule ? (0, _univerjs_sheets_conditional_formatting.createDefaultValue)(rule.subType, rule.operator) : defaultV;
|
|
3489
3664
|
});
|
|
3490
3665
|
const [style, setStyle] = (0, react.useState)({});
|
|
3491
3666
|
const getResult = (0, react.useMemo)(() => (option) => {
|
|
3492
|
-
var _option$
|
|
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
|
-
|
|
3521
|
-
case _univerjs_sheets_conditional_formatting.CFSubRuleType.number:
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
_univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThan,
|
|
3526
|
-
_univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThanOrEqual,
|
|
3527
|
-
_univerjs_sheets_conditional_formatting.CFNumberOperator.lessThan,
|
|
3528
|
-
_univerjs_sheets_conditional_formatting.CFNumberOperator.lessThanOrEqual
|
|
3529
|
-
].includes(operator)) {
|
|
3530
|
-
var _option$subType3, _option$operator2, _option$style3, _option$value2;
|
|
3531
|
-
return {
|
|
3532
|
-
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3533
|
-
subType: (_option$subType3 = option.subType) !== null && _option$subType3 !== void 0 ? _option$subType3 : subType,
|
|
3534
|
-
operator: (_option$operator2 = option.operator) !== null && _option$operator2 !== void 0 ? _option$operator2 : operator,
|
|
3535
|
-
style: (_option$style3 = option.style) !== null && _option$style3 !== void 0 ? _option$style3 : style,
|
|
3536
|
-
value: (_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : value
|
|
3537
|
-
};
|
|
3538
|
-
}
|
|
3539
|
-
if ([_univerjs_sheets_conditional_formatting.CFNumberOperator.between, _univerjs_sheets_conditional_formatting.CFNumberOperator.notBetween].includes(operator)) {
|
|
3540
|
-
var _option$subType4, _option$operator3, _option$style4, _option$value3;
|
|
3667
|
+
var _option$subType, _option$operator, _option$value, _option$style;
|
|
3668
|
+
const nextSubType = (_option$subType = option.subType) !== null && _option$subType !== void 0 ? _option$subType : subType;
|
|
3669
|
+
const nextOperator = (_option$operator = option.operator) !== null && _option$operator !== void 0 ? _option$operator : operator;
|
|
3670
|
+
const nextValue = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : value;
|
|
3671
|
+
const nextStyle = (_option$style = option.style) !== null && _option$style !== void 0 ? _option$style : style;
|
|
3672
|
+
switch (nextSubType) {
|
|
3673
|
+
case _univerjs_sheets_conditional_formatting.CFSubRuleType.duplicateValues: return {
|
|
3674
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3675
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.duplicateValues,
|
|
3676
|
+
style: nextStyle
|
|
3677
|
+
};
|
|
3678
|
+
case _univerjs_sheets_conditional_formatting.CFSubRuleType.uniqueValues: return {
|
|
3679
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3680
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.uniqueValues,
|
|
3681
|
+
style: nextStyle
|
|
3682
|
+
};
|
|
3683
|
+
case _univerjs_sheets_conditional_formatting.CFSubRuleType.text: return {
|
|
3684
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3685
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.text,
|
|
3686
|
+
operator: isTextOperator(nextOperator) ? nextOperator : _univerjs_sheets_conditional_formatting.CFTextOperator.containsText,
|
|
3687
|
+
style: nextStyle,
|
|
3688
|
+
value: typeof nextValue === "string" ? nextValue : void 0
|
|
3689
|
+
};
|
|
3690
|
+
case _univerjs_sheets_conditional_formatting.CFSubRuleType.timePeriod: return {
|
|
3691
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3692
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.timePeriod,
|
|
3693
|
+
operator: isTimePeriodOperator(nextOperator) ? nextOperator : _univerjs_sheets_conditional_formatting.CFTimePeriodOperator.today,
|
|
3694
|
+
style: nextStyle
|
|
3695
|
+
};
|
|
3696
|
+
case _univerjs_sheets_conditional_formatting.CFSubRuleType.number: {
|
|
3697
|
+
const numberOperator = isNumberOperator(nextOperator) ? nextOperator : _univerjs_sheets_conditional_formatting.CFNumberOperator.equal;
|
|
3698
|
+
if (numberOperator === _univerjs_sheets_conditional_formatting.CFNumberOperator.between || numberOperator === _univerjs_sheets_conditional_formatting.CFNumberOperator.notBetween) {
|
|
3699
|
+
const range = Array.isArray(nextValue) ? nextValue : [0, 100];
|
|
3541
3700
|
return {
|
|
3542
3701
|
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3543
|
-
subType:
|
|
3544
|
-
operator:
|
|
3545
|
-
style:
|
|
3546
|
-
value:
|
|
3702
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.number,
|
|
3703
|
+
operator: numberOperator,
|
|
3704
|
+
style: nextStyle,
|
|
3705
|
+
value: range
|
|
3547
3706
|
};
|
|
3548
3707
|
}
|
|
3549
|
-
|
|
3708
|
+
return {
|
|
3709
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3710
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.number,
|
|
3711
|
+
operator: numberOperator,
|
|
3712
|
+
style: nextStyle,
|
|
3713
|
+
value: typeof nextValue === "number" ? nextValue : void 0
|
|
3714
|
+
};
|
|
3715
|
+
}
|
|
3550
3716
|
}
|
|
3551
|
-
return {
|
|
3552
|
-
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
3553
|
-
subType: (_option$subType5 = option.subType) !== null && _option$subType5 !== void 0 ? _option$subType5 : subType,
|
|
3554
|
-
operator: (_option$operator4 = option.operator) !== null && _option$operator4 !== void 0 ? _option$operator4 : operator,
|
|
3555
|
-
style: (_option$style5 = option.style) !== null && _option$style5 !== void 0 ? _option$style5 : style
|
|
3556
|
-
};
|
|
3557
3717
|
}, [
|
|
3558
3718
|
subType,
|
|
3559
3719
|
operator,
|
|
@@ -3569,8 +3729,9 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3569
3729
|
if (!typeOptions.some((item) => item.value === subType)) setSubType(typeOptions[0].value);
|
|
3570
3730
|
}, [typeOptions]);
|
|
3571
3731
|
const onTypeChange = (v) => {
|
|
3572
|
-
var _operatorList$;
|
|
3573
|
-
const _subType = v;
|
|
3732
|
+
var _typeOptions$find, _operatorList$;
|
|
3733
|
+
const _subType = (_typeOptions$find = typeOptions.find((item) => item.value === v)) === null || _typeOptions$find === void 0 ? void 0 : _typeOptions$find.value;
|
|
3734
|
+
if (!_subType) return;
|
|
3574
3735
|
const _operator = (_operatorList$ = getOperatorOptions(_subType).map((option) => ({
|
|
3575
3736
|
...option,
|
|
3576
3737
|
label: localeService.t(option.label)
|
|
@@ -3584,7 +3745,9 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3584
3745
|
}));
|
|
3585
3746
|
};
|
|
3586
3747
|
const onOperatorChange = (v) => {
|
|
3587
|
-
|
|
3748
|
+
var _operatorOptions$find;
|
|
3749
|
+
const _operator = (_operatorOptions$find = operatorOptions.find((item) => item.value === v)) === null || _operatorOptions$find === void 0 ? void 0 : _operatorOptions$find.value;
|
|
3750
|
+
if (!_operator) return;
|
|
3588
3751
|
setOperator(_operator);
|
|
3589
3752
|
onChange(getResult({ operator: _operator }));
|
|
3590
3753
|
};
|
|
@@ -3592,9 +3755,6 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3592
3755
|
setValue(value);
|
|
3593
3756
|
onChange(getResult({ value }));
|
|
3594
3757
|
};
|
|
3595
|
-
const inputRenderKey = (0, react.useMemo)(() => {
|
|
3596
|
-
return `${subType}_${operator}_${Math.random()}`;
|
|
3597
|
-
}, [subType, operator]);
|
|
3598
3758
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
3599
3759
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3600
3760
|
className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
|
|
@@ -3621,7 +3781,7 @@ const HighlightCellStyleEditor = (props) => {
|
|
|
3621
3781
|
operator,
|
|
3622
3782
|
rule,
|
|
3623
3783
|
onChange: onInputChange
|
|
3624
|
-
},
|
|
3784
|
+
}, `${subType}_${operator}`),
|
|
3625
3785
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3626
3786
|
className: previewClassName,
|
|
3627
3787
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Preview, { rule: getResult({}) })
|
|
@@ -3689,34 +3849,34 @@ const createDefaultConfigItem = (iconType, index, list) => ({
|
|
|
3689
3849
|
iconType,
|
|
3690
3850
|
iconId: String(index)
|
|
3691
3851
|
});
|
|
3692
|
-
const IconGroupList = (
|
|
3693
|
-
const { onClick } = props;
|
|
3852
|
+
const IconGroupList = (props) => {
|
|
3853
|
+
const { iconType, onClick } = props;
|
|
3694
3854
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
3695
|
-
const direction = (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection());
|
|
3696
|
-
const handleClick = (iconType) => {
|
|
3697
|
-
onClick(iconType);
|
|
3698
|
-
};
|
|
3699
3855
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3700
|
-
|
|
3701
|
-
dir: direction,
|
|
3856
|
+
dir: (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection()),
|
|
3702
3857
|
className: "univer-w-80",
|
|
3703
|
-
children: _univerjs_sheets_conditional_formatting.iconGroup.map((group
|
|
3858
|
+
children: _univerjs_sheets_conditional_formatting.iconGroup.map((group) => {
|
|
3704
3859
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3705
|
-
className: "univer-mb-
|
|
3860
|
+
className: "univer-mb-4 last:univer-mb-0",
|
|
3706
3861
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3707
|
-
className: "univer-mb-1 univer-text-
|
|
3862
|
+
className: "univer-mb-2 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400",
|
|
3708
3863
|
children: localeService.t(group.title)
|
|
3709
3864
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3710
|
-
className: "univer-
|
|
3711
|
-
children: group.group.map((groupItem) => {
|
|
3712
|
-
|
|
3713
|
-
|
|
3865
|
+
className: "univer-grid univer-grid-cols-2 univer-gap-1",
|
|
3866
|
+
children: group.group.map((groupItem, groupItemIndex) => {
|
|
3867
|
+
const selected = groupItem.name === iconType;
|
|
3868
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3869
|
+
type: "button",
|
|
3870
|
+
"aria-label": `${localeService.t(group.title)} ${groupItemIndex + 1}`,
|
|
3871
|
+
"aria-pressed": selected,
|
|
3872
|
+
className: (0, _univerjs_design.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"),
|
|
3714
3873
|
onClick: () => {
|
|
3715
|
-
|
|
3874
|
+
onClick(groupItem.name);
|
|
3716
3875
|
},
|
|
3717
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
3718
|
-
className: "univer-flex univer-
|
|
3876
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3877
|
+
className: "univer-flex univer-items-center univer-gap-0.5",
|
|
3719
3878
|
children: groupItem.list.map((base64, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
3879
|
+
alt: "",
|
|
3720
3880
|
className: "univer-size-5",
|
|
3721
3881
|
src: base64,
|
|
3722
3882
|
draggable: false
|
|
@@ -3725,10 +3885,10 @@ const IconGroupList = (0, react.forwardRef)((props, ref) => {
|
|
|
3725
3885
|
}, groupItem.name);
|
|
3726
3886
|
})
|
|
3727
3887
|
})]
|
|
3728
|
-
},
|
|
3888
|
+
}, group.title);
|
|
3729
3889
|
})
|
|
3730
3890
|
});
|
|
3731
|
-
}
|
|
3891
|
+
};
|
|
3732
3892
|
const IconItemList = (props) => {
|
|
3733
3893
|
const { onClick } = props;
|
|
3734
3894
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
@@ -3880,7 +4040,7 @@ const IconSetRuleEdit = (props) => {
|
|
|
3880
4040
|
src: icon,
|
|
3881
4041
|
className: "univer-size-4",
|
|
3882
4042
|
draggable: false
|
|
3883
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SlashDoubleIcon, {
|
|
4043
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SlashDoubleIcon, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
|
|
3884
4044
|
})
|
|
3885
4045
|
})
|
|
3886
4046
|
}), !isEnd ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
@@ -4066,9 +4226,6 @@ const IconSet = (props) => {
|
|
|
4066
4226
|
});
|
|
4067
4227
|
setConfigList([...configList]);
|
|
4068
4228
|
};
|
|
4069
|
-
const layoutService = (0, _univerjs_ui.useDependency)(_univerjs_ui.ILayoutService);
|
|
4070
|
-
const [iconGroupListEl, setIconGroupListEl] = (0, react.useState)();
|
|
4071
|
-
(0, _univerjs_ui.useScrollYOverContainer)(iconGroupListEl, layoutService.rootContainerElement);
|
|
4072
4229
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4073
4230
|
"data-u-comp": "cf-icon-set-editor",
|
|
4074
4231
|
dir: direction,
|
|
@@ -4082,11 +4239,8 @@ const IconSet = (props) => {
|
|
|
4082
4239
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
4083
4240
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4084
4241
|
dir: direction,
|
|
4085
|
-
className: "univer-rounded-lg univer-p-
|
|
4242
|
+
className: "univer-rounded-lg univer-p-3",
|
|
4086
4243
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconGroupList, {
|
|
4087
|
-
ref: (el) => {
|
|
4088
|
-
!iconGroupListEl && el && setIconGroupListEl(el);
|
|
4089
|
-
},
|
|
4090
4244
|
iconType: currentIconType,
|
|
4091
4245
|
onClick: handleClickIconList
|
|
4092
4246
|
})
|
|
@@ -4189,34 +4343,36 @@ const RankStyleEditor = (props) => {
|
|
|
4189
4343
|
const [style, setStyle] = (0, react.useState)({});
|
|
4190
4344
|
const getResult = (config) => {
|
|
4191
4345
|
const { type, isPercent, value, style } = config;
|
|
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
|
-
|
|
4219
|
-
|
|
4346
|
+
switch (type) {
|
|
4347
|
+
case "isNotBottom": return {
|
|
4348
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
4349
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.rank,
|
|
4350
|
+
isPercent,
|
|
4351
|
+
isBottom: false,
|
|
4352
|
+
value,
|
|
4353
|
+
style
|
|
4354
|
+
};
|
|
4355
|
+
case "isBottom": return {
|
|
4356
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
4357
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.rank,
|
|
4358
|
+
isPercent,
|
|
4359
|
+
isBottom: true,
|
|
4360
|
+
value,
|
|
4361
|
+
style
|
|
4362
|
+
};
|
|
4363
|
+
case "greaterThanAverage": return {
|
|
4364
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
4365
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.average,
|
|
4366
|
+
operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThan,
|
|
4367
|
+
style
|
|
4368
|
+
};
|
|
4369
|
+
case "lessThanAverage": return {
|
|
4370
|
+
type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
|
|
4371
|
+
subType: _univerjs_sheets_conditional_formatting.CFSubRuleType.average,
|
|
4372
|
+
operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.lessThan,
|
|
4373
|
+
style
|
|
4374
|
+
};
|
|
4375
|
+
}
|
|
4220
4376
|
};
|
|
4221
4377
|
(0, react.useEffect)(() => {
|
|
4222
4378
|
return interceptorManager.intercept(interceptorManager.getInterceptPoints().submit, { handler() {
|
|
@@ -4247,13 +4403,17 @@ const RankStyleEditor = (props) => {
|
|
|
4247
4403
|
value: type,
|
|
4248
4404
|
options,
|
|
4249
4405
|
onChange: (v) => {
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4406
|
+
var _options$find;
|
|
4407
|
+
const nextType = (_options$find = options.find((option) => option.value === v)) === null || _options$find === void 0 ? void 0 : _options$find.value;
|
|
4408
|
+
if (nextType) {
|
|
4409
|
+
setType(nextType);
|
|
4410
|
+
_onChange({
|
|
4411
|
+
type: nextType,
|
|
4412
|
+
isPercent,
|
|
4413
|
+
value,
|
|
4414
|
+
style
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4257
4417
|
}
|
|
4258
4418
|
}),
|
|
4259
4419
|
["isNotBottom", "isBottom"].includes(type) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -4579,7 +4739,7 @@ const getRuleDescribe = (rule, localeService) => {
|
|
|
4579
4739
|
}
|
|
4580
4740
|
}
|
|
4581
4741
|
};
|
|
4582
|
-
|
|
4742
|
+
function RuleList(props) {
|
|
4583
4743
|
const { onClick } = props;
|
|
4584
4744
|
const conditionalFormattingRuleModel = (0, _univerjs_ui.useDependency)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel);
|
|
4585
4745
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
@@ -4590,12 +4750,9 @@ const RuleList = (props) => {
|
|
|
4590
4750
|
const conditionalFormattingI18nController = (0, _univerjs_ui.useDependency)(ConditionalFormattingI18nController);
|
|
4591
4751
|
const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
4592
4752
|
const unitId = workbook.getUnitId();
|
|
4593
|
-
const
|
|
4594
|
-
if (!worksheet) throw new Error("No active sheet found");
|
|
4595
|
-
const subUnitId = worksheet.getSheetId();
|
|
4753
|
+
const subUnitId = workbook.getActiveSheet().getSheetId();
|
|
4596
4754
|
const [currentRuleRanges, setCurrentRuleRanges] = (0, react.useState)([]);
|
|
4597
4755
|
const [selectValue, setSelectValue] = (0, react.useState)("2");
|
|
4598
|
-
const [fetchRuleListId, setFetchRuleListId] = (0, react.useState)(0);
|
|
4599
4756
|
const [draggingId, setDraggingId] = (0, react.useState)("");
|
|
4600
4757
|
const selectOption = [{
|
|
4601
4758
|
label: localeService.t("sheets-conditional-formatting-ui.panel.workSheet"),
|
|
@@ -4617,25 +4774,8 @@ const RuleList = (props) => {
|
|
|
4617
4774
|
} else if (selectValue === "2") return [...ruleList];
|
|
4618
4775
|
return [];
|
|
4619
4776
|
};
|
|
4620
|
-
const
|
|
4621
|
-
|
|
4622
|
-
(0, react.useEffect)(() => {
|
|
4623
|
-
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
4624
|
-
if (commandInfo.id === _univerjs_sheets.SetWorksheetActiveOperation.id) setFetchRuleListId(Math.random());
|
|
4625
|
-
});
|
|
4626
|
-
return () => disposable.dispose();
|
|
4627
|
-
});
|
|
4628
|
-
(0, react.useEffect)(() => {
|
|
4629
|
-
setRuleList(getRuleList);
|
|
4630
|
-
}, [
|
|
4631
|
-
selectValue,
|
|
4632
|
-
fetchRuleListId,
|
|
4633
|
-
unitId,
|
|
4634
|
-
subUnitId
|
|
4635
|
-
]);
|
|
4636
|
-
(0, react.useEffect)(() => {
|
|
4637
|
-
if (selectValue === "2") return;
|
|
4638
|
-
const subscription = new rxjs.Observable((commandSubscribe) => {
|
|
4777
|
+
const ruleList = (0, _univerjs_ui.useObservable)(() => {
|
|
4778
|
+
const commandEvent$ = new rxjs.Observable((subscriber) => {
|
|
4639
4779
|
const commandList = [
|
|
4640
4780
|
_univerjs_sheets.SetSelectionsOperation.id,
|
|
4641
4781
|
_univerjs_sheets_conditional_formatting.AddConditionalRuleMutation.id,
|
|
@@ -4644,29 +4784,25 @@ const RuleList = (props) => {
|
|
|
4644
4784
|
_univerjs_sheets_conditional_formatting.MoveConditionalRuleMutation.id
|
|
4645
4785
|
];
|
|
4646
4786
|
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4787
|
+
var _commandInfo$params;
|
|
4788
|
+
if (commandInfo.id === _univerjs_sheets.SetWorksheetActiveOperation.id) {
|
|
4789
|
+
subscriber.next("immediate");
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
const commandUnitId = (_commandInfo$params = commandInfo.params) === null || _commandInfo$params === void 0 ? void 0 : _commandInfo$params.unitId;
|
|
4793
|
+
if (selectValue === "1" && commandList.includes(commandInfo.id) && commandUnitId === unitId) subscriber.next("debounced");
|
|
4650
4794
|
});
|
|
4651
4795
|
return () => disposable.dispose();
|
|
4652
|
-
}).pipe((0, rxjs.
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
};
|
|
4658
|
-
}, [
|
|
4659
|
-
univerInstanceService,
|
|
4796
|
+
}).pipe((0, rxjs.share)());
|
|
4797
|
+
return (0, rxjs.merge)(conditionalFormattingRuleModel.$ruleChange, commandEvent$.pipe((0, rxjs.filter)((event) => event === "immediate")), commandEvent$.pipe((0, rxjs.filter)((event) => event === "debounced"), (0, rxjs.debounceTime)(16))).pipe((0, rxjs.map)(getRuleList), (0, rxjs.startWith)(getRuleList()));
|
|
4798
|
+
}, [], false, [
|
|
4799
|
+
commandService,
|
|
4800
|
+
conditionalFormattingRuleModel,
|
|
4660
4801
|
selectValue,
|
|
4661
|
-
|
|
4662
|
-
|
|
4802
|
+
subUnitId,
|
|
4803
|
+
unitId
|
|
4663
4804
|
]);
|
|
4664
|
-
(0,
|
|
4665
|
-
const dispose = conditionalFormattingRuleModel.$ruleChange.subscribe(() => {
|
|
4666
|
-
setFetchRuleListId(Math.random());
|
|
4667
|
-
});
|
|
4668
|
-
return () => dispose.unsubscribe();
|
|
4669
|
-
}, [conditionalFormattingRuleModel]);
|
|
4805
|
+
(0, _univerjs_sheets_ui.useHighlightRange)(currentRuleRanges);
|
|
4670
4806
|
const handleDelete = (rule) => {
|
|
4671
4807
|
var _getActiveSheet;
|
|
4672
4808
|
const unitId = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getUnitId();
|
|
@@ -4818,7 +4954,7 @@ const RuleList = (props) => {
|
|
|
4818
4954
|
]
|
|
4819
4955
|
})
|
|
4820
4956
|
}) })] });
|
|
4821
|
-
}
|
|
4957
|
+
}
|
|
4822
4958
|
|
|
4823
4959
|
//#endregion
|
|
4824
4960
|
//#region src/views/ConditionFormattingPanel.tsx
|
|
@@ -4878,7 +5014,11 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
4878
5014
|
this.disposeWithMe(this._componentManager.register(CF_PANEL_KEY, ConditionFormattingPanel));
|
|
4879
5015
|
}
|
|
4880
5016
|
_registerIcons() {
|
|
4881
|
-
this.disposeWithMe(this._iconManager.register({
|
|
5017
|
+
this.disposeWithMe(this._iconManager.register({
|
|
5018
|
+
ConditionsDoubleIcon: _univerjs_icons.ConditionsDoubleIcon,
|
|
5019
|
+
DataBarIcon: _univerjs_icons.DataBarIcon,
|
|
5020
|
+
RatingIcon: _univerjs_icons.RatingIcon
|
|
5021
|
+
}));
|
|
4882
5022
|
}
|
|
4883
5023
|
};
|
|
4884
5024
|
ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.IconManager))], ComponentsController);
|
|
@@ -4962,6 +5102,7 @@ let UniverSheetsConditionalFormattingUIPlugin = class UniverSheetsConditionalFor
|
|
|
4962
5102
|
AddAverageCfCommand,
|
|
4963
5103
|
AddColorScaleConditionalRuleCommand,
|
|
4964
5104
|
AddDataBarConditionalRuleCommand,
|
|
5105
|
+
AddIconSetConditionalRuleCommand,
|
|
4965
5106
|
AddDuplicateValuesCfCommand,
|
|
4966
5107
|
AddNumberCfCommand,
|
|
4967
5108
|
AddRankCfCommand,
|
|
@@ -4990,6 +5131,7 @@ exports.AddAverageCfCommand = AddAverageCfCommand;
|
|
|
4990
5131
|
exports.AddColorScaleConditionalRuleCommand = AddColorScaleConditionalRuleCommand;
|
|
4991
5132
|
exports.AddDataBarConditionalRuleCommand = AddDataBarConditionalRuleCommand;
|
|
4992
5133
|
exports.AddDuplicateValuesCfCommand = AddDuplicateValuesCfCommand;
|
|
5134
|
+
exports.AddIconSetConditionalRuleCommand = AddIconSetConditionalRuleCommand;
|
|
4993
5135
|
exports.AddNumberCfCommand = AddNumberCfCommand;
|
|
4994
5136
|
exports.AddRankCfCommand = AddRankCfCommand;
|
|
4995
5137
|
exports.AddTextCfCommand = AddTextCfCommand;
|