@univerjs/sheets-conditional-formatting-ui 0.4.0-alpha.1 → 0.4.0-experimental.20241017-da434a2
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 +2 -2
- package/lib/es/index.js +34 -15
- package/lib/locale/en-US.json +2 -1
- package/lib/locale/fa-IR.json +2 -1
- package/lib/locale/ru-RU.json +2 -1
- package/lib/locale/vi-VN.json +2 -1
- package/lib/locale/zh-CN.json +1 -0
- package/lib/locale/zh-TW.json +1 -0
- package/lib/types/components/panel/rule-edit/index.d.ts +1 -1
- package/lib/types/locale/zh-CN.d.ts +1 -0
- package/lib/umd/index.js +2 -2
- package/package.json +13 -12
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -9,10 +9,11 @@ import { useObservable, ComponentManager, ILayoutService, useScrollYOverContaine
|
|
|
9
9
|
import require$$0, { forwardRef, useRef, createElement, useMemo, useState, useEffect } from "react";
|
|
10
10
|
import { Select, Tooltip, Dropdown, ColorPicker as ColorPicker$1, InputNumber, RadioGroup, Radio, Checkbox, Input, Button } from "@univerjs/design";
|
|
11
11
|
import { useHighlightRange, SheetSkeletonManagerService, ISheetClipboardService, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, getRepeatRange, SheetPermissionInterceptorBaseController, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, IEditorBridgeService, getCurrentRangeDisable$, IFormatPainterService, FormatPainterStatus } from "@univerjs/sheets-ui";
|
|
12
|
-
import { serializeRange } from "@univerjs/engine-formula";
|
|
12
|
+
import { serializeRange, deserializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
13
13
|
import require$$2$1 from "react-dom";
|
|
14
14
|
import { Observable, debounceTime, merge } from "rxjs";
|
|
15
|
-
import {
|
|
15
|
+
import { RangeSelector } from "@univerjs/sheets-formula-ui";
|
|
16
|
+
import { TextEditor } from "@univerjs/docs-ui";
|
|
16
17
|
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
17
18
|
import { bufferTime, filter, debounceTime as debounceTime$1 } from "rxjs/operators";
|
|
18
19
|
const AddAverageCfCommand = {
|
|
@@ -6068,7 +6069,10 @@ const cfStyleEdit = "univer-cf-style-edit", buttonItem = "univer-button-item", i
|
|
|
6068
6069
|
return (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId();
|
|
6069
6070
|
}, "getSubUnitId"), RuleEdit = /* @__PURE__ */ __name((props) => {
|
|
6070
6071
|
var _a15, _b, _c;
|
|
6071
|
-
const localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), univerInstanceService = useDependency(IUniverInstanceService), conditionalFormattingRuleModel = useDependency(ConditionalFormattingRuleModel), selectionManagerService = useDependency(SheetsSelectionsService), unitId = getUnitId(univerInstanceService), subUnitId = getSubUnitId(univerInstanceService),
|
|
6072
|
+
const localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), univerInstanceService = useDependency(IUniverInstanceService), conditionalFormattingRuleModel = useDependency(ConditionalFormattingRuleModel), selectionManagerService = useDependency(SheetsSelectionsService), unitId = getUnitId(univerInstanceService), subUnitId = getSubUnitId(univerInstanceService), [isFocusRangeSelector, isFocusRangeSelectorSet] = useState(() => {
|
|
6073
|
+
const { rule } = props;
|
|
6074
|
+
return (rule == null ? void 0 : rule.rule.type) === CFRuleType.highlightCell ? rule.rule.subType !== CFSubRuleType.formula : !0;
|
|
6075
|
+
}), rangeSelectorActionsRef = useRef({}), [errorText2, errorTextSet] = useState(void 0), rangeResult = useRef((_b = (_a15 = props.rule) == null ? void 0 : _a15.ranges) != null ? _b : []), rangeString = useMemo(() => {
|
|
6072
6076
|
var _a16, _b2, _c2;
|
|
6073
6077
|
let ranges = (_a16 = props.rule) == null ? void 0 : _a16.ranges;
|
|
6074
6078
|
return ranges != null && ranges.length || (ranges = (_c2 = (_b2 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b2.map((s) => s.range)) != null ? _c2 : []), rangeResult.current = ranges, ranges != null && ranges.length ? ranges.map((range) => {
|
|
@@ -6142,9 +6146,12 @@ const cfStyleEdit = "univer-cf-style-edit", buttonItem = "univer-button-item", i
|
|
|
6142
6146
|
}, []);
|
|
6143
6147
|
const onStyleChange = /* @__PURE__ */ __name((config) => {
|
|
6144
6148
|
result.current = config;
|
|
6145
|
-
}, "onStyleChange"), onRangeSelectorChange = /* @__PURE__ */ __name((
|
|
6146
|
-
|
|
6149
|
+
}, "onStyleChange"), onRangeSelectorChange = /* @__PURE__ */ __name((rangeString2) => {
|
|
6150
|
+
const result2 = rangeString2.split(",").map(deserializeRangeWithSheet).map((item2) => item2.range);
|
|
6151
|
+
rangeResult.current = result2;
|
|
6147
6152
|
}, "onRangeSelectorChange"), handleSubmit = /* @__PURE__ */ __name(() => {
|
|
6153
|
+
if (errorText2)
|
|
6154
|
+
return;
|
|
6148
6155
|
const ranges = (/* @__PURE__ */ __name(() => {
|
|
6149
6156
|
const worksheet = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
|
|
6150
6157
|
if (!worksheet)
|
|
@@ -6163,19 +6170,26 @@ const cfStyleEdit = "univer-cf-style-edit", buttonItem = "univer-button-item", i
|
|
|
6163
6170
|
}
|
|
6164
6171
|
}, "handleSubmit"), handleCancel = /* @__PURE__ */ __name(() => {
|
|
6165
6172
|
props.onCancel();
|
|
6166
|
-
}, "handleCancel")
|
|
6167
|
-
|
|
6173
|
+
}, "handleCancel"), handleVerify = /* @__PURE__ */ __name((v, rangeText) => {
|
|
6174
|
+
v ? rangeText.length < 1 ? errorTextSet(localeService.t("sheet.cf.errorMessage.rangeError")) : errorTextSet(void 0) : errorTextSet(localeService.t("sheet.cf.errorMessage.rangeError"));
|
|
6175
|
+
}, "handleVerify"), handlePanelClick = /* @__PURE__ */ __name((e2) => {
|
|
6176
|
+
var _a16;
|
|
6177
|
+
const handleOutClick = (_a16 = rangeSelectorActionsRef.current) == null ? void 0 : _a16.handleOutClick;
|
|
6178
|
+
handleOutClick && handleOutClick(e2, isFocusRangeSelectorSet);
|
|
6179
|
+
}, "handlePanelClick");
|
|
6180
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.cfRuleStyleEditor, onClick: handlePanelClick, children: [
|
|
6168
6181
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$5.title, children: localeService.t("sheet.cf.panel.range") }),
|
|
6169
6182
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${styles$5.mTBase}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6170
6183
|
RangeSelector,
|
|
6171
6184
|
{
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6185
|
+
unitId,
|
|
6186
|
+
errorText: errorText2,
|
|
6187
|
+
subUnitId,
|
|
6188
|
+
initValue: rangeString,
|
|
6189
|
+
onChange: onRangeSelectorChange,
|
|
6190
|
+
onVerify: handleVerify,
|
|
6191
|
+
isFocus: isFocusRangeSelector,
|
|
6192
|
+
actions: rangeSelectorActionsRef.current
|
|
6179
6193
|
}
|
|
6180
6194
|
) }),
|
|
6181
6195
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$5.title, children: localeService.t("sheet.cf.panel.styleType") }),
|
|
@@ -6212,10 +6226,15 @@ let ConditionalFormattingPanelController = (_a3 = class extends Disposable {
|
|
|
6212
6226
|
var _a15;
|
|
6213
6227
|
sheet || (_a15 = this._sidebarDisposable) == null || _a15.dispose();
|
|
6214
6228
|
})
|
|
6215
|
-
)
|
|
6229
|
+
), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((info) => {
|
|
6230
|
+
info.id === CF_PANEL_KEY && (info.visible || setTimeout(() => {
|
|
6231
|
+
this._sidebarService.sidebarOptions$.next({ visible: !1 });
|
|
6232
|
+
}));
|
|
6233
|
+
}));
|
|
6216
6234
|
}
|
|
6217
6235
|
openPanel(rule) {
|
|
6218
6236
|
const props = {
|
|
6237
|
+
id: CF_PANEL_KEY,
|
|
6219
6238
|
header: { title: this._localeService.t("sheet.cf.title") },
|
|
6220
6239
|
children: {
|
|
6221
6240
|
label: CF_PANEL_KEY,
|
package/lib/locale/en-US.json
CHANGED
package/lib/locale/fa-IR.json
CHANGED
package/lib/locale/ru-RU.json
CHANGED
package/lib/locale/vi-VN.json
CHANGED
package/lib/locale/zh-CN.json
CHANGED
package/lib/locale/zh-TW.json
CHANGED