@univerjs/sheets-conditional-formatting-ui 1.2.0 → 1.3.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/index.js +34 -13
- package/lib/cjs/locale/ar-SA.js +1 -0
- package/lib/cjs/locale/ca-ES.js +1 -0
- package/lib/cjs/locale/de-DE.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/es-ES.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/cjs/locale/id-ID.js +1 -0
- package/lib/cjs/locale/it-IT.js +1 -0
- package/lib/cjs/locale/ja-JP.js +1 -0
- package/lib/cjs/locale/ko-KR.js +1 -0
- package/lib/cjs/locale/pl-PL.js +1 -0
- package/lib/cjs/locale/pt-BR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/sk-SK.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-HK.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +34 -13
- package/lib/es/locale/ar-SA.js +1 -0
- package/lib/es/locale/ca-ES.js +1 -0
- package/lib/es/locale/de-DE.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/es-ES.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/id-ID.js +1 -0
- package/lib/es/locale/it-IT.js +1 -0
- package/lib/es/locale/ja-JP.js +1 -0
- package/lib/es/locale/ko-KR.js +1 -0
- package/lib/es/locale/pl-PL.js +1 -0
- package/lib/es/locale/pt-BR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/sk-SK.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-HK.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.css +4 -0
- package/lib/index.js +34 -13
- package/lib/locale/ar-SA.js +1 -0
- package/lib/locale/ca-ES.js +1 -0
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/es-ES.js +1 -0
- package/lib/locale/fa-IR.js +1 -0
- package/lib/locale/fr-FR.js +1 -0
- package/lib/locale/id-ID.js +1 -0
- package/lib/locale/it-IT.js +1 -0
- package/lib/locale/ja-JP.js +1 -0
- package/lib/locale/ko-KR.js +1 -0
- package/lib/locale/pl-PL.js +1 -0
- package/lib/locale/pt-BR.js +1 -0
- package/lib/locale/ru-RU.js +1 -0
- package/lib/locale/sk-SK.js +1 -0
- package/lib/locale/vi-VN.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-HK.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/types/locale/en-US.d.ts +1 -0
- package/lib/types/views/panel/RuleEdit.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +12 -12
package/lib/index.js
CHANGED
|
@@ -1006,7 +1006,7 @@ const menuSchema = {
|
|
|
1006
1006
|
//#endregion
|
|
1007
1007
|
//#region package.json
|
|
1008
1008
|
var name = "@univerjs/sheets-conditional-formatting-ui";
|
|
1009
|
-
var version = "1.
|
|
1009
|
+
var version = "1.3.0";
|
|
1010
1010
|
|
|
1011
1011
|
//#endregion
|
|
1012
1012
|
//#region src/config/config.ts
|
|
@@ -3995,7 +3995,7 @@ const getSubUnitId = (univerInstanceService) => {
|
|
|
3995
3995
|
return (_getActiveSheet = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) === null || _getActiveSheet === void 0 ? void 0 : _getActiveSheet.getSheetId();
|
|
3996
3996
|
};
|
|
3997
3997
|
const RuleEdit = (props) => {
|
|
3998
|
-
var _props$rule, _props$
|
|
3998
|
+
var _props$rule, _props$rule2, _props$rule6;
|
|
3999
3999
|
const { SelectComponent = Select, DropdownComponent, ColorPickerComponent, RangeSelectorComponent = RangeSelector, FormulaEditorComponent = FormulaEditor } = props;
|
|
4000
4000
|
const localeService = useDependency(LocaleService);
|
|
4001
4001
|
const commandService = useDependency(ICommandService);
|
|
@@ -4005,11 +4005,12 @@ const RuleEdit = (props) => {
|
|
|
4005
4005
|
const unitId = getUnitId(univerInstanceService);
|
|
4006
4006
|
const subUnitId = getSubUnitId(univerInstanceService);
|
|
4007
4007
|
const [errorText, setErrorText] = useState(void 0);
|
|
4008
|
-
const
|
|
4008
|
+
const [stopIfTrue, setStopIfTrue] = useState(!!((_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.stopIfTrue));
|
|
4009
|
+
const rangeResult = useRef(((_props$rule2 = props.rule) === null || _props$rule2 === void 0 ? void 0 : _props$rule2.ranges) ?? []);
|
|
4009
4010
|
const rangeSelectorTouched = useRef(false);
|
|
4010
4011
|
const rangeString = useMemo(() => {
|
|
4011
|
-
var _props$
|
|
4012
|
-
let ranges = (_props$
|
|
4012
|
+
var _props$rule3;
|
|
4013
|
+
let ranges = (_props$rule3 = props.rule) === null || _props$rule3 === void 0 ? void 0 : _props$rule3.ranges;
|
|
4013
4014
|
if (!(ranges === null || ranges === void 0 ? void 0 : ranges.length)) {
|
|
4014
4015
|
var _selectionManagerServ;
|
|
4015
4016
|
ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range)) ?? [];
|
|
@@ -4048,14 +4049,14 @@ const RuleEdit = (props) => {
|
|
|
4048
4049
|
}
|
|
4049
4050
|
];
|
|
4050
4051
|
const [ruleType, setRuleType] = useState(() => {
|
|
4051
|
-
var _props$
|
|
4052
|
-
const type = (_props$
|
|
4052
|
+
var _props$rule4;
|
|
4053
|
+
const type = (_props$rule4 = props.rule) === null || _props$rule4 === void 0 ? void 0 : _props$rule4.rule.type;
|
|
4053
4054
|
const defaultType = options[0].value;
|
|
4054
4055
|
if (!type) return defaultType;
|
|
4055
4056
|
switch (type) {
|
|
4056
4057
|
case CFRuleType.highlightCell:
|
|
4057
|
-
var _props$
|
|
4058
|
-
switch ((_props$
|
|
4058
|
+
var _props$rule5;
|
|
4059
|
+
switch ((_props$rule5 = props.rule) === null || _props$rule5 === void 0 ? void 0 : _props$rule5.rule.subType) {
|
|
4059
4060
|
case CFSubRuleType.number:
|
|
4060
4061
|
case CFSubRuleType.text:
|
|
4061
4062
|
case CFSubRuleType.duplicateValues:
|
|
@@ -4090,6 +4091,7 @@ const RuleEdit = (props) => {
|
|
|
4090
4091
|
default: return HighlightCellStyleEditor;
|
|
4091
4092
|
}
|
|
4092
4093
|
}, [ruleType]);
|
|
4094
|
+
const supportsStopIfTrue = StyleEditor === HighlightCellStyleEditor || StyleEditor === RankStyleEditor || StyleEditor === FormulaStyleEditor;
|
|
4093
4095
|
useEffect(() => {
|
|
4094
4096
|
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
4095
4097
|
if (commandInfo.id === RemoveSheetMutation.id) {
|
|
@@ -4131,7 +4133,8 @@ const RuleEdit = (props) => {
|
|
|
4131
4133
|
rule = {
|
|
4132
4134
|
...props.rule,
|
|
4133
4135
|
ranges,
|
|
4134
|
-
rule: result
|
|
4136
|
+
rule: result,
|
|
4137
|
+
stopIfTrue: result.type === CFRuleType.highlightCell && stopIfTrue
|
|
4135
4138
|
};
|
|
4136
4139
|
commandService.executeCommand(SetCfCommand.id, {
|
|
4137
4140
|
unitId,
|
|
@@ -4144,7 +4147,7 @@ const RuleEdit = (props) => {
|
|
|
4144
4147
|
cfId: conditionalFormattingRuleModel.createCfId(unitId, subUnitId),
|
|
4145
4148
|
ranges,
|
|
4146
4149
|
rule: result,
|
|
4147
|
-
stopIfTrue:
|
|
4150
|
+
stopIfTrue: result.type === CFRuleType.highlightCell && stopIfTrue
|
|
4148
4151
|
};
|
|
4149
4152
|
commandService.executeCommand(AddCfCommand.id, {
|
|
4150
4153
|
unitId,
|
|
@@ -4199,13 +4202,21 @@ const RuleEdit = (props) => {
|
|
|
4199
4202
|
}),
|
|
4200
4203
|
/* @__PURE__ */ jsx(StyleEditor, {
|
|
4201
4204
|
interceptorManager,
|
|
4202
|
-
rule: (_props$
|
|
4205
|
+
rule: (_props$rule6 = props.rule) === null || _props$rule6 === void 0 ? void 0 : _props$rule6.rule,
|
|
4203
4206
|
onChange: onStyleChange,
|
|
4204
4207
|
SelectComponent,
|
|
4205
4208
|
DropdownComponent,
|
|
4206
4209
|
ColorPickerComponent,
|
|
4207
4210
|
FormulaEditorComponent
|
|
4208
4211
|
}),
|
|
4212
|
+
supportsStopIfTrue && /* @__PURE__ */ jsx("div", {
|
|
4213
|
+
className: "univer-mt-4",
|
|
4214
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
4215
|
+
checked: stopIfTrue,
|
|
4216
|
+
onChange: (checked) => setStopIfTrue(!!checked),
|
|
4217
|
+
children: localeService.t("sheets-conditional-formatting-ui.panel.stopIfTrue")
|
|
4218
|
+
})
|
|
4219
|
+
}),
|
|
4209
4220
|
/* @__PURE__ */ jsxs("div", {
|
|
4210
4221
|
className: "univer-mt-4 univer-flex univer-justify-end univer-gap-2",
|
|
4211
4222
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
@@ -4437,7 +4448,7 @@ function RuleList(props) {
|
|
|
4437
4448
|
onDragStop: handleDragStop,
|
|
4438
4449
|
onDragStart: handleDragStart,
|
|
4439
4450
|
itemRender: (rule) => /* @__PURE__ */ jsxs("div", {
|
|
4440
|
-
className: clsx("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 rtl:univer-pl-8 rtl:univer-pr-5 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 dark:!univer-bg-gray-700": draggingId === rule.cfId }),
|
|
4451
|
+
className: clsx("univer-group univer-relative univer-flex univer-flex-wrap univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 rtl:univer-pl-8 rtl:univer-pr-5 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 dark:!univer-bg-gray-700": draggingId === rule.cfId }),
|
|
4441
4452
|
onMouseMove: () => {
|
|
4442
4453
|
rule.ranges !== currentRuleRanges && setCurrentRuleRanges(rule.ranges);
|
|
4443
4454
|
},
|
|
@@ -4462,6 +4473,16 @@ function RuleList(props) {
|
|
|
4462
4473
|
})]
|
|
4463
4474
|
}),
|
|
4464
4475
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(ConditionalFormattingRulePreview, { rule: rule.rule }) }),
|
|
4476
|
+
rule.rule.type === CFRuleType.highlightCell && /* @__PURE__ */ jsx("div", {
|
|
4477
|
+
className: "univer-pointer-events-none univer-mt-2 univer-w-full",
|
|
4478
|
+
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
4479
|
+
className: "univer-max-w-full",
|
|
4480
|
+
contentClassName: "univer-min-w-0",
|
|
4481
|
+
checked: !!rule.stopIfTrue,
|
|
4482
|
+
disabled: true,
|
|
4483
|
+
children: localeService.t("sheets-conditional-formatting-ui.panel.stopIfTrue")
|
|
4484
|
+
})
|
|
4485
|
+
}),
|
|
4465
4486
|
/* @__PURE__ */ jsx("div", {
|
|
4466
4487
|
className: clsx("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200 rtl:univer-left-1 rtl:univer-right-auto", { "univer-flex univer-items-center univer-justify-center": draggingId === rule.cfId }),
|
|
4467
4488
|
onClick: (e) => {
|
package/lib/locale/ar-SA.js
CHANGED
package/lib/locale/ca-ES.js
CHANGED
package/lib/locale/de-DE.js
CHANGED
package/lib/locale/en-US.js
CHANGED
package/lib/locale/es-ES.js
CHANGED
package/lib/locale/fa-IR.js
CHANGED
package/lib/locale/fr-FR.js
CHANGED
package/lib/locale/id-ID.js
CHANGED
package/lib/locale/it-IT.js
CHANGED
package/lib/locale/ja-JP.js
CHANGED
package/lib/locale/ko-KR.js
CHANGED
package/lib/locale/pl-PL.js
CHANGED
package/lib/locale/pt-BR.js
CHANGED
package/lib/locale/ru-RU.js
CHANGED
package/lib/locale/sk-SK.js
CHANGED
package/lib/locale/vi-VN.js
CHANGED
package/lib/locale/zh-CN.js
CHANGED
package/lib/locale/zh-HK.js
CHANGED
package/lib/locale/zh-TW.js
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
import type { IDropdownProps, ISelectProps } from '@univerjs/design';
|
|
17
17
|
import type { IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
|
|
18
18
|
import type { ComponentType } from 'react';
|
|
19
|
-
import type { IConditionalColorPickerProps } from '../ColorPicker';
|
|
20
19
|
import { FormulaEditor, RangeSelector } from '@univerjs/sheets-formula-ui';
|
|
20
|
+
import type { IConditionalColorPickerProps } from '../ColorPicker';
|
|
21
21
|
export interface IRuleEditProps {
|
|
22
22
|
rule?: IConditionFormattingRule;
|
|
23
23
|
onCancel: () => void;
|