@univerjs/sheets-conditional-formatting-ui 0.2.12 → 0.2.13
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 +3 -3
- package/lib/es/index.js +528 -311
- package/lib/types/controllers/cf.painter.controller.d.ts +15 -0
- package/lib/types/mobile-plugin.d.ts +1 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +23 -24
package/lib/es/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getSheetCommandTarget, SheetsSelectionsService, findAllRectangle, creat
|
|
|
8
8
|
import { useObservable, ComponentManager, TextEditor, ILayoutService, useScrollYOverContainer, RangeSelector, ISidebarService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
|
|
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
|
-
import { useHighlightRange, SheetSkeletonManagerService, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, getRepeatRange, ISheetClipboardService, SheetPermissionInterceptorBaseController, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, getCurrentRangeDisable$,
|
|
11
|
+
import { useHighlightRange, SheetSkeletonManagerService, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, virtualizeDiscreteRanges, getRepeatRange, ISheetClipboardService, SheetPermissionInterceptorBaseController, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, IEditorBridgeService, getCurrentRangeDisable$, IFormatPainterService, FormatPainterStatus } from "@univerjs/sheets-ui";
|
|
12
12
|
import { serializeRange } from "@univerjs/engine-formula";
|
|
13
13
|
import cl from "clsx";
|
|
14
14
|
import require$$2$1 from "react-dom";
|
|
@@ -236,12 +236,12 @@ const AddAverageCfCommand = {
|
|
|
236
236
|
type: CommandType.COMMAND,
|
|
237
237
|
id: "sheet.command.clear-range-conditional-rule",
|
|
238
238
|
handler(accessor, params) {
|
|
239
|
-
var
|
|
239
|
+
var _a15;
|
|
240
240
|
if (!params)
|
|
241
241
|
return !1;
|
|
242
242
|
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel), univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), selectionManagerService = accessor.get(SheetsSelectionsService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
243
243
|
if (!target) return !1;
|
|
244
|
-
const { unitId, subUnitId } = target, ranges = ((
|
|
244
|
+
const { unitId, subUnitId } = target, ranges = ((_a15 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a15.map((selection) => selection.range)) || [], allRuleList = conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
245
245
|
if (!(allRuleList != null && allRuleList.length) || !ranges.length)
|
|
246
246
|
return !1;
|
|
247
247
|
const redos = [], undos = [];
|
|
@@ -386,15 +386,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
|
386
386
|
var attrs = __assign({}, node.attrs);
|
|
387
387
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
388
388
|
var defIds = runtimeProps.defIds;
|
|
389
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
|
390
|
-
var key =
|
|
389
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a15) {
|
|
390
|
+
var key = _a15[0], value = _a15[1];
|
|
391
391
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
392
392
|
})), attrs;
|
|
393
393
|
}
|
|
394
394
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
395
395
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
396
|
-
var
|
|
397
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
|
396
|
+
var _a15, defIds = runtimeProps.defIds;
|
|
397
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a15 = node.children) === null || _a15 === void 0) && _a15.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
398
398
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
399
399
|
}) }) : node;
|
|
400
400
|
}
|
|
@@ -490,8 +490,8 @@ var reactGridLayout = { exports: {} }, ReactGridLayout$1 = {}, fastEquals = { ex
|
|
|
490
490
|
}
|
|
491
491
|
__name(sameValueZeroEqual, "sameValueZeroEqual");
|
|
492
492
|
var ARGUMENTS_TAG = "[object Arguments]", BOOLEAN_TAG = "[object Boolean]", DATE_TAG = "[object Date]", REG_EXP_TAG = "[object RegExp]", MAP_TAG = "[object Map]", NUMBER_TAG = "[object Number]", OBJECT_TAG = "[object Object]", SET_TAG = "[object Set]", STRING_TAG = "[object String]", toString2 = Object.prototype.toString;
|
|
493
|
-
function createComparator(
|
|
494
|
-
var areArraysEqual2 =
|
|
493
|
+
function createComparator(_a15) {
|
|
494
|
+
var areArraysEqual2 = _a15.areArraysEqual, areDatesEqual2 = _a15.areDatesEqual, areMapsEqual2 = _a15.areMapsEqual, areObjectsEqual2 = _a15.areObjectsEqual, areRegExpsEqual2 = _a15.areRegExpsEqual, areSetsEqual2 = _a15.areSetsEqual, createIsNestedEqual = _a15.createIsNestedEqual, isEqual = createIsNestedEqual(comparator);
|
|
495
495
|
function comparator(a, b, meta) {
|
|
496
496
|
if (a === b)
|
|
497
497
|
return !0;
|
|
@@ -3478,9 +3478,9 @@ const _ReactGridLayout = class _ReactGridLayout extends React$2.Component {
|
|
|
3478
3478
|
resizing: !1
|
|
3479
3479
|
}), this.onLayoutMaybeChanged(newLayout, oldLayout);
|
|
3480
3480
|
}), _defineProperty$2(this, "onDragOver", (e) => {
|
|
3481
|
-
var
|
|
3481
|
+
var _a15;
|
|
3482
3482
|
if (e.preventDefault(), e.stopPropagation(), isFirefox && // $FlowIgnore can't figure this out
|
|
3483
|
-
!((
|
|
3483
|
+
!((_a15 = e.nativeEvent.target) != null && _a15.classList.contains(layoutClassName$1)))
|
|
3484
3484
|
return !1;
|
|
3485
3485
|
const {
|
|
3486
3486
|
droppingItem,
|
|
@@ -4092,8 +4092,8 @@ var WidthProvider = {}, MapShim = function() {
|
|
|
4092
4092
|
this.__entries__.splice(0);
|
|
4093
4093
|
}, class_1.prototype.forEach = function(callback, ctx) {
|
|
4094
4094
|
ctx === void 0 && (ctx = null);
|
|
4095
|
-
for (var _i = 0,
|
|
4096
|
-
var entry =
|
|
4095
|
+
for (var _i = 0, _a15 = this.__entries__; _i < _a15.length; _i++) {
|
|
4096
|
+
var entry = _a15[_i];
|
|
4097
4097
|
callback.call(ctx, entry[1], entry[0]);
|
|
4098
4098
|
}
|
|
4099
4099
|
}, class_1;
|
|
@@ -4160,8 +4160,8 @@ var REFRESH_DELAY = 20, transitionKeys = ["top", "right", "bottom", "left", "wid
|
|
|
4160
4160
|
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
|
|
4161
4161
|
}, ResizeObserverController2.prototype.disconnect_ = function() {
|
|
4162
4162
|
!isBrowser || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
|
|
4163
|
-
}, ResizeObserverController2.prototype.onTransitionEnd_ = function(
|
|
4164
|
-
var _b =
|
|
4163
|
+
}, ResizeObserverController2.prototype.onTransitionEnd_ = function(_a15) {
|
|
4164
|
+
var _b = _a15.propertyName, propertyName = _b === void 0 ? "" : _b, isReflowProperty = transitionKeys.some(function(key) {
|
|
4165
4165
|
return !!~propertyName.indexOf(key);
|
|
4166
4166
|
});
|
|
4167
4167
|
isReflowProperty && this.refresh();
|
|
@@ -4170,8 +4170,8 @@ var REFRESH_DELAY = 20, transitionKeys = ["top", "right", "bottom", "left", "wid
|
|
|
4170
4170
|
}, ResizeObserverController2.instance_ = null, ResizeObserverController2;
|
|
4171
4171
|
}()
|
|
4172
4172
|
), defineConfigurable = /* @__PURE__ */ __name(function(target, props) {
|
|
4173
|
-
for (var _i = 0,
|
|
4174
|
-
var key =
|
|
4173
|
+
for (var _i = 0, _a15 = Object.keys(props); _i < _a15.length; _i++) {
|
|
4174
|
+
var key = _a15[_i];
|
|
4175
4175
|
Object.defineProperty(target, key, {
|
|
4176
4176
|
value: props[key],
|
|
4177
4177
|
enumerable: !1,
|
|
@@ -4237,8 +4237,8 @@ function getContentRect(target) {
|
|
|
4237
4237
|
return isBrowser ? isSVGGraphicsElement(target) ? getSVGContentRect(target) : getHTMLElementContentRect(target) : emptyRect;
|
|
4238
4238
|
}
|
|
4239
4239
|
__name(getContentRect, "getContentRect");
|
|
4240
|
-
function createReadOnlyRect(
|
|
4241
|
-
var x =
|
|
4240
|
+
function createReadOnlyRect(_a15) {
|
|
4241
|
+
var x = _a15.x, y = _a15.y, width2 = _a15.width, height2 = _a15.height, Constr = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, rect = Object.create(Constr.prototype);
|
|
4242
4242
|
return defineConfigurable(rect, {
|
|
4243
4243
|
x,
|
|
4244
4244
|
y,
|
|
@@ -4344,8 +4344,8 @@ var ResizeObservation = (
|
|
|
4344
4344
|
"disconnect"
|
|
4345
4345
|
].forEach(function(method) {
|
|
4346
4346
|
ResizeObserver.prototype[method] = function() {
|
|
4347
|
-
var
|
|
4348
|
-
return (
|
|
4347
|
+
var _a15;
|
|
4348
|
+
return (_a15 = observers.get(this))[method].apply(_a15, arguments);
|
|
4349
4349
|
};
|
|
4350
4350
|
});
|
|
4351
4351
|
var index = function() {
|
|
@@ -4418,9 +4418,9 @@ function _toPrimitive(input, hint) {
|
|
|
4418
4418
|
__name(_toPrimitive, "_toPrimitive");
|
|
4419
4419
|
const layoutClassName = "react-grid-layout";
|
|
4420
4420
|
function WidthProvideRGL(ComposedComponent) {
|
|
4421
|
-
var
|
|
4421
|
+
var _a15;
|
|
4422
4422
|
var _class;
|
|
4423
|
-
return _class = (
|
|
4423
|
+
return _class = (_a15 = class extends React.Component {
|
|
4424
4424
|
constructor() {
|
|
4425
4425
|
super(...arguments), _defineProperty(this, "state", {
|
|
4426
4426
|
width: 1280
|
|
@@ -4456,7 +4456,7 @@ function WidthProvideRGL(ComposedComponent) {
|
|
|
4456
4456
|
innerRef: this.elementRef
|
|
4457
4457
|
}, rest, this.state));
|
|
4458
4458
|
}
|
|
4459
|
-
}, __name(
|
|
4459
|
+
}, __name(_a15, "WidthProvider"), _a15), _defineProperty(_class, "defaultProps", {
|
|
4460
4460
|
measureBeforeMount: !1
|
|
4461
4461
|
}), _defineProperty(_class, "propTypes", {
|
|
4462
4462
|
// If true, will not render children until mounted. Useful for getting the exact width before
|
|
@@ -4501,7 +4501,7 @@ const GridLayout = /* @__PURE__ */ getDefaultExportFromCjs(reactGridLayoutExport
|
|
|
4501
4501
|
}, cfPreview = "univer-cf-preview", styles$4 = {
|
|
4502
4502
|
cfPreview
|
|
4503
4503
|
}, Preview = /* @__PURE__ */ __name((props) => {
|
|
4504
|
-
var
|
|
4504
|
+
var _a15, _b;
|
|
4505
4505
|
const rule = props.rule;
|
|
4506
4506
|
if (!rule)
|
|
4507
4507
|
return null;
|
|
@@ -4531,7 +4531,7 @@ const GridLayout = /* @__PURE__ */ getDefaultExportFromCjs(reactGridLayoutExport
|
|
|
4531
4531
|
case CFRuleType.iconSet:
|
|
4532
4532
|
return iconSet2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.cfPreview, children: iconSet2.map((base64, index2) => base64 ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { style: { height: "100%" }, src: base64 }, index2) : /* @__PURE__ */ jsxRuntimeExports.jsx(SlashSingle, {}, index2)) });
|
|
4533
4533
|
case CFRuleType.highlightCell: {
|
|
4534
|
-
const { ul, st, it, bl, bg, cl: cl2 } = rule.style, isUnderline = (ul == null ? void 0 : ul.s) === BooleanNumber.TRUE, isStrikethrough = (st == null ? void 0 : st.s) === BooleanNumber.TRUE, isItalic = it === BooleanNumber.TRUE, isBold = bl === BooleanNumber.TRUE, bgColor = (
|
|
4534
|
+
const { ul, st, it, bl, bg, cl: cl2 } = rule.style, isUnderline = (ul == null ? void 0 : ul.s) === BooleanNumber.TRUE, isStrikethrough = (st == null ? void 0 : st.s) === BooleanNumber.TRUE, isItalic = it === BooleanNumber.TRUE, isBold = bl === BooleanNumber.TRUE, bgColor = (_a15 = bg == null ? void 0 : bg.rgb) != null ? _a15 : DEFAULT_BG_COLOR, fontColor = (_b = cl2 == null ? void 0 : cl2.rgb) != null ? _b : DEFAULT_FONT_COLOR, style = {
|
|
4535
4535
|
fontWeight: isBold ? "bold" : void 0,
|
|
4536
4536
|
fontStyle: isItalic ? "italic" : void 0,
|
|
4537
4537
|
textDecoration: `${isUnderline ? "underline" : ""} ${isStrikethrough ? "line-through" : ""}`.replace(/^ /, "") || void 0,
|
|
@@ -4543,11 +4543,11 @@ const GridLayout = /* @__PURE__ */ getDefaultExportFromCjs(reactGridLayoutExport
|
|
|
4543
4543
|
}
|
|
4544
4544
|
return null;
|
|
4545
4545
|
}, "Preview");
|
|
4546
|
-
var __defProp$
|
|
4547
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4546
|
+
var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
4547
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4548
4548
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
4549
|
-
return kind && result && __defProp$
|
|
4550
|
-
}, "__decorateClass$
|
|
4549
|
+
return kind && result && __defProp$c(target, key, result), result;
|
|
4550
|
+
}, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$c"), _a2;
|
|
4551
4551
|
let ConditionalFormattingI18nController = (_a2 = class extends Disposable {
|
|
4552
4552
|
constructor(_localeService) {
|
|
4553
4553
|
super();
|
|
@@ -4585,9 +4585,9 @@ let ConditionalFormattingI18nController = (_a2 = class extends Disposable {
|
|
|
4585
4585
|
return [];
|
|
4586
4586
|
}
|
|
4587
4587
|
}, __name(_a2, "ConditionalFormattingI18nController"), _a2);
|
|
4588
|
-
ConditionalFormattingI18nController = __decorateClass$
|
|
4588
|
+
ConditionalFormattingI18nController = __decorateClass$c([
|
|
4589
4589
|
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingI18nController),
|
|
4590
|
-
__decorateParam$
|
|
4590
|
+
__decorateParam$c(0, Inject(LocaleService))
|
|
4591
4591
|
], ConditionalFormattingI18nController);
|
|
4592
4592
|
const cfRuleList = "univer-cf-rule-list", ruleSelector = "univer-rule-selector", select = "univer-select", selectSelector = "univer-select-selector", selectSelectionItem = "univer-select-selection-item", selectSelectionSearchInput = "univer-select-selection-search-input", btnList$1 = "univer-btn-list", gap = "univer-gap", icon$1 = "univer-icon", disabled = "univer-disabled", ruleItem = "univer-rule-item", ruleDescribe = "univer-rule-describe", ruleType = "univer-rule-type", ruleRange = "univer-rule-range", active = "univer-active", draggableHandle = "univer-draggableHandle", deleteItem = "univer-delete-item", gridLayoutWrap = "univer-grid-layout-wrap", reactGridItem = "univer-react-grid-item", styles$3 = {
|
|
4593
4593
|
cfRuleList,
|
|
@@ -4698,8 +4698,8 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
4698
4698
|
return () => dispose.unsubscribe();
|
|
4699
4699
|
}, [conditionalFormattingRuleModel]), useEffect(() => {
|
|
4700
4700
|
const getWidth = /* @__PURE__ */ __name(() => {
|
|
4701
|
-
var
|
|
4702
|
-
const width2 = Math.max(0, (((
|
|
4701
|
+
var _a15;
|
|
4702
|
+
const width2 = Math.max(0, (((_a15 = layoutContainerRef.current) == null ? void 0 : _a15.getBoundingClientRect().width) || 0) - 8);
|
|
4703
4703
|
return defaultWidth = width2, width2;
|
|
4704
4704
|
}, "getWidth"), subscription = new Observable((subscribe) => {
|
|
4705
4705
|
const targetElement = document.querySelector(".univer-sidebar");
|
|
@@ -4724,17 +4724,17 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
4724
4724
|
};
|
|
4725
4725
|
}, []);
|
|
4726
4726
|
const handleDelete = /* @__PURE__ */ __name((rule) => {
|
|
4727
|
-
var
|
|
4728
|
-
const unitId2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId2 = (
|
|
4727
|
+
var _a15;
|
|
4728
|
+
const unitId2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId2 = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId();
|
|
4729
4729
|
if (!unitId2 || !subUnitId2)
|
|
4730
4730
|
throw new Error("No active sheet found");
|
|
4731
4731
|
commandService.executeCommand(DeleteCfCommand.id, { unitId: unitId2, subUnitId: subUnitId2, cfId: rule.cfId });
|
|
4732
4732
|
}, "handleDelete"), handleDragStart = /* @__PURE__ */ __name((_layout, from) => {
|
|
4733
4733
|
draggingIdSet(from.y);
|
|
4734
4734
|
}, "handleDragStart"), handleDragStop = /* @__PURE__ */ __name((_layout, from, to) => {
|
|
4735
|
-
var
|
|
4735
|
+
var _a15;
|
|
4736
4736
|
draggingIdSet(-1);
|
|
4737
|
-
const unitId2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId2 = (
|
|
4737
|
+
const unitId2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId2 = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId();
|
|
4738
4738
|
if (!unitId2 || !subUnitId2)
|
|
4739
4739
|
throw new Error("No active sheet found");
|
|
4740
4740
|
const getSaveIndex = /* @__PURE__ */ __name((index2) => {
|
|
@@ -4896,8 +4896,8 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
4896
4896
|
width100,
|
|
4897
4897
|
stress
|
|
4898
4898
|
}, createOptionItem$2 = /* @__PURE__ */ __name((text2, localeService) => ({ label: localeService.t(`sheet.cf.valueType.${text2}`), value: text2 }), "createOptionItem$2"), TextInput$1 = /* @__PURE__ */ __name((props) => {
|
|
4899
|
-
var
|
|
4900
|
-
const { type: type2, className, onChange, id, value } = props, univerInstanceService = useDependency(IUniverInstanceService), unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (
|
|
4899
|
+
var _a15;
|
|
4900
|
+
const { type: type2, className, onChange, id, value } = props, univerInstanceService = useDependency(IUniverInstanceService), unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId(), formulaInitValue = useMemo(() => String(value).startsWith("=") ? String(value) : "=", [value]), config = useMemo(() => [CFValueType.max, CFValueType.min, "none"].includes(type2) ? { disabled: !0 } : [CFValueType.percent, CFValueType.percentile].includes(type2) ? {
|
|
4901
4901
|
min: 0,
|
|
4902
4902
|
max: 100
|
|
4903
4903
|
} : {
|
|
@@ -4920,48 +4920,48 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
4920
4920
|
}
|
|
4921
4921
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { className, value: Number(props.value) || 0, onChange: /* @__PURE__ */ __name((v) => props.onChange(v || 0), "onChange"), ...config });
|
|
4922
4922
|
}, "TextInput$1"), ColorScaleStyleEditor = /* @__PURE__ */ __name((props) => {
|
|
4923
|
-
var
|
|
4924
|
-
const { interceptorManager } = props, localeService = useDependency(LocaleService), rule = ((
|
|
4925
|
-
var
|
|
4923
|
+
var _a15;
|
|
4924
|
+
const { interceptorManager } = props, localeService = useDependency(LocaleService), rule = ((_a15 = props.rule) == null ? void 0 : _a15.type) === CFRuleType.colorScale ? props.rule : void 0, commonOptions = [createOptionItem$2(CFValueType.num, localeService), createOptionItem$2(CFValueType.percent, localeService), createOptionItem$2(CFValueType.percentile, localeService), createOptionItem$2(CFValueType.formula, localeService)], minOptions = [createOptionItem$2(CFValueType.min, localeService), ...commonOptions], medianOptions = [createOptionItem$2("none", localeService), ...commonOptions], maxOptions = [createOptionItem$2(CFValueType.max, localeService), ...commonOptions], [minType, minTypeSet] = useState(() => {
|
|
4925
|
+
var _a16;
|
|
4926
4926
|
const defaultV = CFValueType.min;
|
|
4927
|
-
return rule && ((
|
|
4927
|
+
return rule && ((_a16 = rule.config[0]) == null ? void 0 : _a16.value.type) || defaultV;
|
|
4928
4928
|
}), [medianType, medianTypeSet] = useState(() => {
|
|
4929
|
-
var
|
|
4929
|
+
var _a16;
|
|
4930
4930
|
const defaultV = "none";
|
|
4931
|
-
return !rule || rule.config.length !== 3 ? defaultV : ((
|
|
4931
|
+
return !rule || rule.config.length !== 3 ? defaultV : ((_a16 = rule.config[1]) == null ? void 0 : _a16.value.type) || defaultV;
|
|
4932
4932
|
}), [maxType, maxTypeSet] = useState(() => {
|
|
4933
|
-
var
|
|
4933
|
+
var _a16;
|
|
4934
4934
|
const defaultV = CFValueType.max;
|
|
4935
|
-
return rule && ((
|
|
4935
|
+
return rule && ((_a16 = rule.config[rule.config.length - 1]) == null ? void 0 : _a16.value.type) || defaultV;
|
|
4936
4936
|
}), [minValue, minValueSet] = useState(() => {
|
|
4937
4937
|
if (!rule)
|
|
4938
4938
|
return 10;
|
|
4939
4939
|
const valueConfig = rule.config[0];
|
|
4940
4940
|
return (valueConfig == null ? void 0 : valueConfig.value.value) === void 0 ? 10 : valueConfig == null ? void 0 : valueConfig.value.value;
|
|
4941
4941
|
}), [medianValue, medianValueSet] = useState(() => {
|
|
4942
|
-
var
|
|
4942
|
+
var _a16;
|
|
4943
4943
|
if (!rule || rule.config.length !== 3)
|
|
4944
4944
|
return 50;
|
|
4945
|
-
const v = (
|
|
4945
|
+
const v = (_a16 = rule.config[1]) == null ? void 0 : _a16.value.value;
|
|
4946
4946
|
return v === void 0 ? 50 : v;
|
|
4947
4947
|
}), [maxValue, maxValueSet] = useState(() => {
|
|
4948
|
-
var
|
|
4948
|
+
var _a16;
|
|
4949
4949
|
if (!rule)
|
|
4950
4950
|
return 90;
|
|
4951
|
-
const v = (
|
|
4951
|
+
const v = (_a16 = rule.config[rule.config.length - 1]) == null ? void 0 : _a16.value.value;
|
|
4952
4952
|
return v === void 0 ? 90 : v;
|
|
4953
4953
|
}), [minColor, minColorSet] = useState(() => {
|
|
4954
|
-
var
|
|
4954
|
+
var _a16;
|
|
4955
4955
|
const defaultV = "#d0d9fb";
|
|
4956
|
-
return rule && ((
|
|
4956
|
+
return rule && ((_a16 = rule.config[0]) == null ? void 0 : _a16.color) || defaultV;
|
|
4957
4957
|
}), [medianColor, medianColorSet] = useState(() => {
|
|
4958
|
-
var
|
|
4958
|
+
var _a16;
|
|
4959
4959
|
const defaultV = "#7790f3";
|
|
4960
|
-
return !rule || rule.config.length !== 3 ? defaultV : ((
|
|
4960
|
+
return !rule || rule.config.length !== 3 ? defaultV : ((_a16 = rule.config[1]) == null ? void 0 : _a16.color) || defaultV;
|
|
4961
4961
|
}), [maxColor, maxColorSet] = useState(() => {
|
|
4962
|
-
var
|
|
4962
|
+
var _a16;
|
|
4963
4963
|
const defaultV = "#2e55ef";
|
|
4964
|
-
return rule && ((
|
|
4964
|
+
return rule && ((_a16 = rule.config[rule.config.length - 1]) == null ? void 0 : _a16.color) || defaultV;
|
|
4965
4965
|
}), getResult = useMemo(() => (option) => {
|
|
4966
4966
|
const {
|
|
4967
4967
|
minType: minType2,
|
|
@@ -5100,8 +5100,8 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5100
5100
|
] })
|
|
5101
5101
|
] });
|
|
5102
5102
|
}, "ColorScaleStyleEditor"), createOptionItem$1 = /* @__PURE__ */ __name((text2, localeService) => ({ label: localeService.t(`sheet.cf.valueType.${text2}`), value: text2 }), "createOptionItem$1"), InputText = /* @__PURE__ */ __name((props) => {
|
|
5103
|
-
var
|
|
5104
|
-
const { onChange, className, value, type: type2, id, disabled: disabled2 = !1 } = props, univerInstanceService = useDependency(IUniverInstanceService), unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (
|
|
5103
|
+
var _a15;
|
|
5104
|
+
const { onChange, className, value, type: type2, id, disabled: disabled2 = !1 } = props, univerInstanceService = useDependency(IUniverInstanceService), unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId(), _value = useRef(value), config = useMemo(() => [CFValueType.percentile, CFValueType.percent].includes(type2) ? {
|
|
5105
5105
|
max: 100,
|
|
5106
5106
|
min: 0
|
|
5107
5107
|
} : {
|
|
@@ -5139,36 +5139,36 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5139
5139
|
}
|
|
5140
5140
|
);
|
|
5141
5141
|
}, "InputText"), DataBarStyleEditor = /* @__PURE__ */ __name((props) => {
|
|
5142
|
-
var
|
|
5143
|
-
const { interceptorManager } = props, localeService = useDependency(LocaleService), rule = ((
|
|
5144
|
-
var
|
|
5142
|
+
var _a15;
|
|
5143
|
+
const { interceptorManager } = props, localeService = useDependency(LocaleService), rule = ((_a15 = props.rule) == null ? void 0 : _a15.type) === CFRuleType.dataBar ? props.rule : void 0, [isGradient, isGradientSet] = useState(() => {
|
|
5144
|
+
var _a16;
|
|
5145
5145
|
const defaultV = "0";
|
|
5146
|
-
return rule ? (
|
|
5146
|
+
return rule ? (_a16 = rule.config) != null && _a16.isGradient ? "1" : "0" : defaultV;
|
|
5147
5147
|
}), [positiveColor, positiveColorSet] = useState(() => {
|
|
5148
|
-
var
|
|
5149
|
-
return rule ? ((
|
|
5148
|
+
var _a16;
|
|
5149
|
+
return rule ? ((_a16 = rule.config) == null ? void 0 : _a16.positiveColor) || defaultDataBarPositiveColor : defaultDataBarPositiveColor;
|
|
5150
5150
|
}), [nativeColor, nativeColorSet] = useState(() => {
|
|
5151
|
-
var
|
|
5152
|
-
return rule ? ((
|
|
5151
|
+
var _a16;
|
|
5152
|
+
return rule ? ((_a16 = rule.config) == null ? void 0 : _a16.nativeColor) || defaultDataBarNativeColor : defaultDataBarNativeColor;
|
|
5153
5153
|
}), commonOptions = [createOptionItem$1(CFValueType.num, localeService), createOptionItem$1(CFValueType.percent, localeService), createOptionItem$1(CFValueType.percentile, localeService), createOptionItem$1(CFValueType.formula, localeService)], minOptions = [createOptionItem$1(CFValueType.min, localeService), ...commonOptions], maxOptions = [createOptionItem$1(CFValueType.max, localeService), ...commonOptions], [minValueType, minValueTypeSet] = useState(() => {
|
|
5154
|
-
var
|
|
5154
|
+
var _a16;
|
|
5155
5155
|
const defaultV = minOptions[0].value;
|
|
5156
|
-
return rule && ((
|
|
5156
|
+
return rule && ((_a16 = rule.config) == null ? void 0 : _a16.min.type) || defaultV;
|
|
5157
5157
|
}), [maxValueType, maxValueTypeSet] = useState(() => {
|
|
5158
|
-
var
|
|
5158
|
+
var _a16;
|
|
5159
5159
|
const defaultV = maxOptions[0].value;
|
|
5160
|
-
return rule && ((
|
|
5160
|
+
return rule && ((_a16 = rule.config) == null ? void 0 : _a16.max.type) || defaultV;
|
|
5161
5161
|
}), [minValue, minValueSet] = useState(() => {
|
|
5162
|
-
var
|
|
5162
|
+
var _a16;
|
|
5163
5163
|
if (!rule)
|
|
5164
5164
|
return 0;
|
|
5165
|
-
const value = ((
|
|
5165
|
+
const value = ((_a16 = rule.config) == null ? void 0 : _a16.min) || {};
|
|
5166
5166
|
return value.type === CFValueType.formula ? value.value || "=" : value.value || 0;
|
|
5167
5167
|
}), [maxValue, maxValueSet] = useState(() => {
|
|
5168
|
-
var
|
|
5168
|
+
var _a16;
|
|
5169
5169
|
if (!rule)
|
|
5170
5170
|
return 100;
|
|
5171
|
-
const value = ((
|
|
5171
|
+
const value = ((_a16 = rule.config) == null ? void 0 : _a16.max) || {};
|
|
5172
5172
|
return value.type === CFValueType.formula ? value.value || "=" : value.value === void 0 ? 100 : value.value;
|
|
5173
5173
|
}), [isShowValue, isShowValueSet] = useState(() => rule ? rule.isShowValue === void 0 ? !0 : !!rule.isShowValue : !0), getResult = /* @__PURE__ */ __name((option) => ({ config: {
|
|
5174
5174
|
min: { type: option.minValueType, value: option.minValue },
|
|
@@ -5324,13 +5324,13 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5324
5324
|
if (style != null && style.st)
|
|
5325
5325
|
return style.st.s;
|
|
5326
5326
|
}), [fontColor, fontColorSet] = useState(() => {
|
|
5327
|
-
var
|
|
5327
|
+
var _a15;
|
|
5328
5328
|
const defaultV = "#2f56ef";
|
|
5329
|
-
return (
|
|
5329
|
+
return (_a15 = style == null ? void 0 : style.cl) != null && _a15.rgb ? style.cl.rgb : defaultV;
|
|
5330
5330
|
}), [bgColor, bgColorSet] = useState(() => {
|
|
5331
|
-
var
|
|
5331
|
+
var _a15;
|
|
5332
5332
|
const defaultV = "#e8ecfc";
|
|
5333
|
-
return (
|
|
5333
|
+
return (_a15 = style == null ? void 0 : style.bg) != null && _a15.rgb ? style.bg.rgb : defaultV;
|
|
5334
5334
|
}), BoldSingleIcon = componentManager.get("BoldSingle"), ItalicSingleIcon = componentManager.get("ItalicSingle"), UnderlineSingleIcon = componentManager.get("UnderlineSingle"), StrikethroughSingle = componentManager.get("StrikethroughSingle");
|
|
5335
5335
|
return useEffect(() => {
|
|
5336
5336
|
const resultStyle = {
|
|
@@ -5347,8 +5347,8 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5347
5347
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, { color: bgColor, onChange: bgColorSet, iconId: "PaintBucket" })
|
|
5348
5348
|
] });
|
|
5349
5349
|
}, "ConditionalStyleEditor"), RankStyleEditor = /* @__PURE__ */ __name((props) => {
|
|
5350
|
-
var
|
|
5351
|
-
const { onChange, interceptorManager } = props, localeService = useDependency(LocaleService), rule = ((
|
|
5350
|
+
var _a15;
|
|
5351
|
+
const { onChange, interceptorManager } = props, localeService = useDependency(LocaleService), rule = ((_a15 = props.rule) == null ? void 0 : _a15.type) === CFRuleType.highlightCell ? props.rule : void 0, options = [
|
|
5352
5352
|
{ label: localeService.t("sheet.cf.panel.isNotBottom"), value: "isNotBottom" },
|
|
5353
5353
|
{ label: localeService.t("sheet.cf.panel.isBottom"), value: "isBottom" },
|
|
5354
5354
|
{ label: localeService.t("sheet.cf.panel.greaterThanAverage"), value: "greaterThanAverage" },
|
|
@@ -5619,8 +5619,8 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5619
5619
|
];
|
|
5620
5620
|
}
|
|
5621
5621
|
}, "getOperatorOptions"), HighlightCellStyleEditor = /* @__PURE__ */ __name((props) => {
|
|
5622
|
-
var
|
|
5623
|
-
const { interceptorManager, onChange } = props, localeService = useDependency(LocaleService), rule = ((
|
|
5622
|
+
var _a15;
|
|
5623
|
+
const { interceptorManager, onChange } = props, localeService = useDependency(LocaleService), rule = ((_a15 = props.rule) == null ? void 0 : _a15.type) === CFRuleType.highlightCell ? props.rule : void 0, [subType, subTypeSet] = useState(() => {
|
|
5624
5624
|
const defaultV = CFSubRuleType.text;
|
|
5625
5625
|
return rule && rule.subType || defaultV;
|
|
5626
5626
|
}), typeOptions = [
|
|
@@ -5648,11 +5648,11 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5648
5648
|
const defaultV = operatorOptions ? operatorOptions[0].value : void 0;
|
|
5649
5649
|
return rule && rule.operator || defaultV;
|
|
5650
5650
|
}), [value, valueSet] = useState(() => {
|
|
5651
|
-
var
|
|
5651
|
+
var _a16;
|
|
5652
5652
|
const defaultV = "";
|
|
5653
|
-
return rule ? (
|
|
5653
|
+
return rule ? (_a16 = rule.value) != null ? _a16 : createDefaultValue(rule.subType, rule.operator) : defaultV;
|
|
5654
5654
|
}), [style, styleSet] = useState({}), getResult = useMemo(() => (option) => {
|
|
5655
|
-
var
|
|
5655
|
+
var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
5656
5656
|
switch (option.subType || subType) {
|
|
5657
5657
|
case CFSubRuleType.text: {
|
|
5658
5658
|
if ([
|
|
@@ -5665,7 +5665,7 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5665
5665
|
].includes(operator))
|
|
5666
5666
|
return {
|
|
5667
5667
|
type: CFRuleType.highlightCell,
|
|
5668
|
-
subType: (
|
|
5668
|
+
subType: (_a16 = option.subType) != null ? _a16 : subType,
|
|
5669
5669
|
operator: (_b = option.operator) != null ? _b : operator,
|
|
5670
5670
|
style: (_c = option.style) != null ? _c : style,
|
|
5671
5671
|
value: (_d = option.value) != null ? _d : value
|
|
@@ -5740,8 +5740,8 @@ const RuleList = /* @__PURE__ */ __name((props) => {
|
|
|
5740
5740
|
)
|
|
5741
5741
|
] });
|
|
5742
5742
|
}, "HighlightCellStyleEditor"), FormulaStyleEditor = /* @__PURE__ */ __name((props) => {
|
|
5743
|
-
var
|
|
5744
|
-
const { onChange, interceptorManager } = props, localeService = useDependency(LocaleService), workbook = useDependency(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet(), rule = ((
|
|
5743
|
+
var _a15;
|
|
5744
|
+
const { onChange, interceptorManager } = props, localeService = useDependency(LocaleService), workbook = useDependency(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet(), rule = ((_a15 = props.rule) == null ? void 0 : _a15.type) === CFRuleType.highlightCell ? props.rule : void 0, [style, styleSet] = useState({}), [formula, formulaSet] = useState(() => (rule == null ? void 0 : rule.subType) === CFSubRuleType.formula ? rule.value : "="), [formulaError, formulaErrorSet] = useState(""), getResult = /* @__PURE__ */ __name((config) => ({
|
|
5745
5745
|
style: config.style,
|
|
5746
5746
|
value: formula,
|
|
5747
5747
|
type: CFRuleType.highlightCell,
|
|
@@ -6349,8 +6349,8 @@ function get(object, path, defaultValue) {
|
|
|
6349
6349
|
__name(get, "get");
|
|
6350
6350
|
var lodash_get = get;
|
|
6351
6351
|
const get$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_get), getIcon = /* @__PURE__ */ __name((iconType, iconId) => (iconMap[iconType] || [])[Number(iconId)] || "", "getIcon"), TextInput = /* @__PURE__ */ __name((props) => {
|
|
6352
|
-
var
|
|
6353
|
-
const univerInstanceService = useDependency(IUniverInstanceService), unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (
|
|
6352
|
+
var _a15;
|
|
6353
|
+
const univerInstanceService = useDependency(IUniverInstanceService), unitId = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId(), className = useMemo(() => props.error ? styles$1.errorInput : "", [props.error]);
|
|
6354
6354
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.positionRelative, children: props.type !== CFValueType.formula ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6355
6355
|
/* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { className, value: Number(props.value) || 0, onChange: /* @__PURE__ */ __name((v) => props.onChange(v != null ? v : 0), "onChange") }),
|
|
6356
6356
|
props.error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$1.errorText, children: props.error })
|
|
@@ -6483,8 +6483,8 @@ const get$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_get), getIcon = /*
|
|
|
6483
6483
|
] }, index2);
|
|
6484
6484
|
}), [configList, errorMap]);
|
|
6485
6485
|
}, "IconSetRuleEdit"), IconSet = /* @__PURE__ */ __name((props) => {
|
|
6486
|
-
var
|
|
6487
|
-
const { interceptorManager } = props, rule = ((
|
|
6486
|
+
var _a15;
|
|
6487
|
+
const { interceptorManager } = props, rule = ((_a15 = props.rule) == null ? void 0 : _a15.type) === CFRuleType.iconSet ? props.rule : void 0, localeService = useDependency(LocaleService), [errorMap, errorMapSet] = useState({}), [currentIconType, currentIconTypeSet] = useState(() => {
|
|
6488
6488
|
const defaultV = Object.keys(iconMap)[0];
|
|
6489
6489
|
if (rule && rule.config.length) {
|
|
6490
6490
|
const type2 = rule.config[0].iconType;
|
|
@@ -6575,13 +6575,13 @@ const get$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_get), getIcon = /*
|
|
|
6575
6575
|
/* @__PURE__ */ jsxRuntimeExports.jsx(IconSetRuleEdit, { errorMap, onChange: handleChange, configList })
|
|
6576
6576
|
] });
|
|
6577
6577
|
}, "IconSet"), getUnitId = /* @__PURE__ */ __name((univerInstanceService) => univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), "getUnitId"), getSubUnitId = /* @__PURE__ */ __name((univerInstanceService) => {
|
|
6578
|
-
var
|
|
6579
|
-
return (
|
|
6578
|
+
var _a15;
|
|
6579
|
+
return (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId();
|
|
6580
6580
|
}, "getSubUnitId"), RuleEdit = /* @__PURE__ */ __name((props) => {
|
|
6581
|
-
var
|
|
6582
|
-
const localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), univerInstanceService = useDependency(IUniverInstanceService), conditionalFormattingRuleModel = useDependency(ConditionalFormattingRuleModel), selectionManagerService = useDependency(SheetsSelectionsService), unitId = getUnitId(univerInstanceService), subUnitId = getSubUnitId(univerInstanceService), rangeResult = useRef((_b = (
|
|
6583
|
-
var
|
|
6584
|
-
let ranges = (
|
|
6581
|
+
var _a15, _b, _c;
|
|
6582
|
+
const localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), univerInstanceService = useDependency(IUniverInstanceService), conditionalFormattingRuleModel = useDependency(ConditionalFormattingRuleModel), selectionManagerService = useDependency(SheetsSelectionsService), unitId = getUnitId(univerInstanceService), subUnitId = getSubUnitId(univerInstanceService), rangeResult = useRef((_b = (_a15 = props.rule) == null ? void 0 : _a15.ranges) != null ? _b : []), rangeString = useMemo(() => {
|
|
6583
|
+
var _a16, _b2, _c2;
|
|
6584
|
+
let ranges = (_a16 = props.rule) == null ? void 0 : _a16.ranges;
|
|
6585
6585
|
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) => {
|
|
6586
6586
|
const v = serializeRange(range);
|
|
6587
6587
|
return v === "NaN" ? "" : v;
|
|
@@ -6594,8 +6594,8 @@ const get$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_get), getIcon = /*
|
|
|
6594
6594
|
{ label: localeService.t("sheet.cf.ruleType.formula"), value: "5" },
|
|
6595
6595
|
{ label: localeService.t("sheet.cf.ruleType.iconSet"), value: "6" }
|
|
6596
6596
|
], [ruleType2, ruleTypeSet] = useState(() => {
|
|
6597
|
-
var
|
|
6598
|
-
const type2 = (
|
|
6597
|
+
var _a16, _b2;
|
|
6598
|
+
const type2 = (_a16 = props.rule) == null ? void 0 : _a16.rule.type, defaultType = options[0].value;
|
|
6599
6599
|
if (!type2)
|
|
6600
6600
|
return defaultType;
|
|
6601
6601
|
switch (type2) {
|
|
@@ -6707,11 +6707,11 @@ const get$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_get), getIcon = /*
|
|
|
6707
6707
|
}, "handleRuleClick");
|
|
6708
6708
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$5.conditionalFormattingWrap, children: isShowRuleEditor ? /* @__PURE__ */ jsxRuntimeExports.jsx(RuleEdit, { onCancel: handleCancel, rule: currentEditRule }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RuleList, { onClick: handleRuleClick, onCreate: createCfRule }) });
|
|
6709
6709
|
}, "ConditionFormattingPanel");
|
|
6710
|
-
var __defProp$
|
|
6711
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6710
|
+
var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
6711
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6712
6712
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
6713
|
-
return kind && result && __defProp$
|
|
6714
|
-
}, "__decorateClass$
|
|
6713
|
+
return kind && result && __defProp$b(target, key, result), result;
|
|
6714
|
+
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$b");
|
|
6715
6715
|
const CF_PANEL_KEY = "sheet.conditional.formatting.panel";
|
|
6716
6716
|
var _a3;
|
|
6717
6717
|
let ConditionalFormattingPanelController = (_a3 = class extends Disposable {
|
|
@@ -6720,8 +6720,8 @@ let ConditionalFormattingPanelController = (_a3 = class extends Disposable {
|
|
|
6720
6720
|
__publicField(this, "_sidebarDisposable", null);
|
|
6721
6721
|
this._univerInstanceService = _univerInstanceService, this._injector = _injector, this._componentManager = _componentManager, this._sidebarService = _sidebarService, this._localeService = _localeService, this._initPanel(), this.disposeWithMe(
|
|
6722
6722
|
this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((sheet) => {
|
|
6723
|
-
var
|
|
6724
|
-
sheet || (
|
|
6723
|
+
var _a15;
|
|
6724
|
+
sheet || (_a15 = this._sidebarDisposable) == null || _a15.dispose();
|
|
6725
6725
|
})
|
|
6726
6726
|
);
|
|
6727
6727
|
}
|
|
@@ -6741,21 +6741,21 @@ let ConditionalFormattingPanelController = (_a3 = class extends Disposable {
|
|
|
6741
6741
|
this._componentManager.register(CF_PANEL_KEY, ConditionFormattingPanel);
|
|
6742
6742
|
}
|
|
6743
6743
|
}, __name(_a3, "ConditionalFormattingPanelController"), _a3);
|
|
6744
|
-
ConditionalFormattingPanelController = __decorateClass$
|
|
6744
|
+
ConditionalFormattingPanelController = __decorateClass$b([
|
|
6745
6745
|
OnLifecycle(LifecycleStages.Ready, ConditionalFormattingPanelController),
|
|
6746
|
-
__decorateParam$
|
|
6747
|
-
__decorateParam$
|
|
6748
|
-
__decorateParam$
|
|
6749
|
-
__decorateParam$
|
|
6750
|
-
__decorateParam$
|
|
6746
|
+
__decorateParam$b(0, IUniverInstanceService),
|
|
6747
|
+
__decorateParam$b(1, Inject(Injector)),
|
|
6748
|
+
__decorateParam$b(2, Inject(ComponentManager)),
|
|
6749
|
+
__decorateParam$b(3, Inject(ISidebarService)),
|
|
6750
|
+
__decorateParam$b(4, Inject(LocaleService))
|
|
6751
6751
|
], ConditionalFormattingPanelController);
|
|
6752
6752
|
var CF_MENU_OPERATION = /* @__PURE__ */ ((CF_MENU_OPERATION2) => (CF_MENU_OPERATION2[CF_MENU_OPERATION2.createRule = 1] = "createRule", CF_MENU_OPERATION2[CF_MENU_OPERATION2.viewRule = 2] = "viewRule", CF_MENU_OPERATION2[CF_MENU_OPERATION2.highlightCell = 3] = "highlightCell", CF_MENU_OPERATION2[CF_MENU_OPERATION2.rank = 4] = "rank", CF_MENU_OPERATION2[CF_MENU_OPERATION2.formula = 5] = "formula", CF_MENU_OPERATION2[CF_MENU_OPERATION2.colorScale = 6] = "colorScale", CF_MENU_OPERATION2[CF_MENU_OPERATION2.dataBar = 7] = "dataBar", CF_MENU_OPERATION2[CF_MENU_OPERATION2.icon = 8] = "icon", CF_MENU_OPERATION2[CF_MENU_OPERATION2.clearRangeRules = 9] = "clearRangeRules", CF_MENU_OPERATION2[CF_MENU_OPERATION2.clearWorkSheetRules = 10] = "clearWorkSheetRules", CF_MENU_OPERATION2))(CF_MENU_OPERATION || {});
|
|
6753
6753
|
const OpenConditionalFormattingOperator = {
|
|
6754
6754
|
id: "sheet.operation.open.conditional.formatting.panel",
|
|
6755
6755
|
type: CommandType.OPERATION,
|
|
6756
6756
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
6757
|
-
var
|
|
6758
|
-
const conditionalFormattingMenuController = accessor.get(ConditionalFormattingPanelController), selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), ranges = ((
|
|
6757
|
+
var _a15;
|
|
6758
|
+
const conditionalFormattingMenuController = accessor.get(ConditionalFormattingPanelController), selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), ranges = ((_a15 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a15.map((s) => s.range)) || [];
|
|
6759
6759
|
switch (params.value) {
|
|
6760
6760
|
case 3: {
|
|
6761
6761
|
conditionalFormattingMenuController.openPanel({ ...createDefaultRule(), ranges });
|
|
@@ -6843,11 +6843,11 @@ const OpenConditionalFormattingOperator = {
|
|
|
6843
6843
|
return !0;
|
|
6844
6844
|
}, "handler")
|
|
6845
6845
|
};
|
|
6846
|
-
var __defProp$
|
|
6847
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6846
|
+
var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPropertyDescriptor, __decorateClass$a = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
6847
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6848
6848
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
6849
|
-
return kind && result && __defProp$
|
|
6850
|
-
}, "__decorateClass$
|
|
6849
|
+
return kind && result && __defProp$a(target, key, result), result;
|
|
6850
|
+
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$a"), _a4;
|
|
6851
6851
|
let SheetsCfRenderController = (_a4 = class extends Disposable {
|
|
6852
6852
|
constructor(_sheetInterceptorService, _conditionalFormattingService, _univerInstanceService, _renderManagerService, _conditionalFormattingViewModel, _conditionalFormattingRuleModel) {
|
|
6853
6853
|
super();
|
|
@@ -6861,9 +6861,9 @@ let SheetsCfRenderController = (_a4 = class extends Disposable {
|
|
|
6861
6861
|
});
|
|
6862
6862
|
}
|
|
6863
6863
|
markDirtySkeleton() {
|
|
6864
|
-
var
|
|
6864
|
+
var _a15, _b, _c;
|
|
6865
6865
|
const unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId();
|
|
6866
|
-
(
|
|
6866
|
+
(_a15 = this._renderManagerService.getRenderById(unitId)) == null || _a15.with(SheetSkeletonManagerService).reCalculate(), (_c = (_b = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _b.mainComponent) == null || _c.makeDirty();
|
|
6867
6867
|
}
|
|
6868
6868
|
_initSkeleton() {
|
|
6869
6869
|
this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.pipe(bufferTime(16), filter((v) => {
|
|
@@ -6980,20 +6980,20 @@ let SheetsCfRenderController = (_a4 = class extends Disposable {
|
|
|
6980
6980
|
}));
|
|
6981
6981
|
}
|
|
6982
6982
|
}, __name(_a4, "SheetsCfRenderController"), _a4);
|
|
6983
|
-
SheetsCfRenderController = __decorateClass$
|
|
6983
|
+
SheetsCfRenderController = __decorateClass$a([
|
|
6984
6984
|
OnLifecycle(LifecycleStages.Starting, SheetsCfRenderController),
|
|
6985
|
-
__decorateParam$
|
|
6986
|
-
__decorateParam$
|
|
6987
|
-
__decorateParam$
|
|
6988
|
-
__decorateParam$
|
|
6989
|
-
__decorateParam$
|
|
6990
|
-
__decorateParam$
|
|
6985
|
+
__decorateParam$a(0, Inject(SheetInterceptorService)),
|
|
6986
|
+
__decorateParam$a(1, Inject(ConditionalFormattingService)),
|
|
6987
|
+
__decorateParam$a(2, Inject(IUniverInstanceService)),
|
|
6988
|
+
__decorateParam$a(3, Inject(IRenderManagerService)),
|
|
6989
|
+
__decorateParam$a(4, Inject(ConditionalFormattingViewModel)),
|
|
6990
|
+
__decorateParam$a(5, Inject(ConditionalFormattingRuleModel))
|
|
6991
6991
|
], SheetsCfRenderController);
|
|
6992
|
-
var __defProp$
|
|
6993
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6992
|
+
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
6993
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6994
6994
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
6995
|
-
return kind && result && __defProp$
|
|
6996
|
-
}, "__decorateClass$
|
|
6995
|
+
return kind && result && __defProp$9(target, key, result), result;
|
|
6996
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$9"), _a5;
|
|
6997
6997
|
let ConditionalFormattingCopyPasteController = (_a5 = class extends Disposable {
|
|
6998
6998
|
constructor(_sheetClipboardService, _conditionalFormattingRuleModel, _injector, _conditionalFormattingViewModel, _univerInstanceService) {
|
|
6999
6999
|
super();
|
|
@@ -7147,19 +7147,19 @@ let ConditionalFormattingCopyPasteController = (_a5 = class extends Disposable {
|
|
|
7147
7147
|
};
|
|
7148
7148
|
}
|
|
7149
7149
|
}, __name(_a5, "ConditionalFormattingCopyPasteController"), _a5);
|
|
7150
|
-
ConditionalFormattingCopyPasteController = __decorateClass$
|
|
7150
|
+
ConditionalFormattingCopyPasteController = __decorateClass$9([
|
|
7151
7151
|
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingCopyPasteController),
|
|
7152
|
-
__decorateParam$
|
|
7153
|
-
__decorateParam$
|
|
7154
|
-
__decorateParam$
|
|
7155
|
-
__decorateParam$
|
|
7156
|
-
__decorateParam$
|
|
7152
|
+
__decorateParam$9(0, Inject(ISheetClipboardService)),
|
|
7153
|
+
__decorateParam$9(1, Inject(ConditionalFormattingRuleModel)),
|
|
7154
|
+
__decorateParam$9(2, Inject(Injector)),
|
|
7155
|
+
__decorateParam$9(3, Inject(ConditionalFormattingViewModel)),
|
|
7156
|
+
__decorateParam$9(4, Inject(IUniverInstanceService))
|
|
7157
7157
|
], ConditionalFormattingCopyPasteController);
|
|
7158
|
-
var __defProp$
|
|
7159
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7158
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7159
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7160
7160
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7161
|
-
return kind && result && __defProp$
|
|
7162
|
-
}, "__decorateClass$
|
|
7161
|
+
return kind && result && __defProp$8(target, key, result), result;
|
|
7162
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$8"), _a6;
|
|
7163
7163
|
let SheetsCfRefRangeController = (_a6 = class extends Disposable {
|
|
7164
7164
|
constructor(_conditionalFormattingRuleModel, _univerInstanceService, _injector, _refRangeService) {
|
|
7165
7165
|
super(), this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel, this._univerInstanceService = _univerInstanceService, this._injector = _injector, this._refRangeService = _refRangeService, this._initRefRange();
|
|
@@ -7208,18 +7208,18 @@ let SheetsCfRefRangeController = (_a6 = class extends Disposable {
|
|
|
7208
7208
|
}));
|
|
7209
7209
|
}
|
|
7210
7210
|
}, __name(_a6, "SheetsCfRefRangeController"), _a6);
|
|
7211
|
-
SheetsCfRefRangeController = __decorateClass$
|
|
7211
|
+
SheetsCfRefRangeController = __decorateClass$8([
|
|
7212
7212
|
OnLifecycle(LifecycleStages.Rendered, SheetsCfRefRangeController),
|
|
7213
|
-
__decorateParam$
|
|
7214
|
-
__decorateParam$
|
|
7215
|
-
__decorateParam$
|
|
7216
|
-
__decorateParam$
|
|
7213
|
+
__decorateParam$8(0, Inject(ConditionalFormattingRuleModel)),
|
|
7214
|
+
__decorateParam$8(1, Inject(IUniverInstanceService)),
|
|
7215
|
+
__decorateParam$8(2, Inject(Injector)),
|
|
7216
|
+
__decorateParam$8(3, Inject(RefRangeService))
|
|
7217
7217
|
], SheetsCfRefRangeController);
|
|
7218
|
-
var __defProp$
|
|
7219
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7218
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7219
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7220
7220
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7221
|
-
return kind && result && __defProp$
|
|
7222
|
-
}, "__decorateClass$
|
|
7221
|
+
return kind && result && __defProp$7(target, key, result), result;
|
|
7222
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$7"), _a7;
|
|
7223
7223
|
let ConditionalFormattingPermissionController = (_a7 = class extends Disposable {
|
|
7224
7224
|
constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
|
|
7225
7225
|
super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
|
|
@@ -7236,18 +7236,18 @@ let ConditionalFormattingPermissionController = (_a7 = class extends Disposable
|
|
|
7236
7236
|
);
|
|
7237
7237
|
}
|
|
7238
7238
|
}, __name(_a7, "ConditionalFormattingPermissionController"), _a7);
|
|
7239
|
-
ConditionalFormattingPermissionController = __decorateClass$
|
|
7239
|
+
ConditionalFormattingPermissionController = __decorateClass$7([
|
|
7240
7240
|
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingPermissionController),
|
|
7241
|
-
__decorateParam$
|
|
7242
|
-
__decorateParam$
|
|
7243
|
-
__decorateParam$
|
|
7241
|
+
__decorateParam$7(0, Inject(LocaleService)),
|
|
7242
|
+
__decorateParam$7(1, ICommandService),
|
|
7243
|
+
__decorateParam$7(2, Inject(SheetPermissionInterceptorBaseController))
|
|
7244
7244
|
], ConditionalFormattingPermissionController);
|
|
7245
7245
|
const PLUGIN_CONFIG_KEY = "sheets-conditional-formatting-ui.config", defaultPluginConfig = {};
|
|
7246
|
-
var __defProp$
|
|
7247
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7246
|
+
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp$1"), __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7247
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7248
7248
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7249
|
-
return kind && result && __defProp$
|
|
7250
|
-
}, "__decorateClass$
|
|
7249
|
+
return kind && result && __defProp$6(target, key, result), result;
|
|
7250
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$6"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField$1"), _a8;
|
|
7251
7251
|
let UniverSheetsConditionalFormattingMobileUIPlugin = (_a8 = class extends Plugin {
|
|
7252
7252
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
|
7253
7253
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
|
|
@@ -7279,17 +7279,17 @@ let UniverSheetsConditionalFormattingMobileUIPlugin = (_a8 = class extends Plugi
|
|
|
7279
7279
|
}, __name(_a8, "UniverSheetsConditionalFormattingMobileUIPlugin"), _a8);
|
|
7280
7280
|
__publicField$1(UniverSheetsConditionalFormattingMobileUIPlugin, "pluginName", `${SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`);
|
|
7281
7281
|
__publicField$1(UniverSheetsConditionalFormattingMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
7282
|
-
UniverSheetsConditionalFormattingMobileUIPlugin = __decorateClass$
|
|
7282
|
+
UniverSheetsConditionalFormattingMobileUIPlugin = __decorateClass$6([
|
|
7283
7283
|
DependentOn(UniverSheetsConditionalFormattingPlugin),
|
|
7284
|
-
__decorateParam$
|
|
7285
|
-
__decorateParam$
|
|
7286
|
-
__decorateParam$
|
|
7284
|
+
__decorateParam$6(1, Inject(Injector)),
|
|
7285
|
+
__decorateParam$6(2, Inject(ICommandService)),
|
|
7286
|
+
__decorateParam$6(3, IConfigService)
|
|
7287
7287
|
], UniverSheetsConditionalFormattingMobileUIPlugin);
|
|
7288
|
-
var __defProp$
|
|
7289
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7288
|
+
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7289
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7290
7290
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7291
|
-
return kind && result && __defProp$
|
|
7292
|
-
}, "__decorateClass$
|
|
7291
|
+
return kind && result && __defProp$5(target, key, result), result;
|
|
7292
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$5"), _a9;
|
|
7293
7293
|
let ConditionalFormattingAutoFillController = (_a9 = class extends Disposable {
|
|
7294
7294
|
constructor(_injector, _univerInstanceService, _autoFillService, _conditionalFormattingRuleModel, _conditionalFormattingViewModel) {
|
|
7295
7295
|
super(), this._injector = _injector, this._univerInstanceService = _univerInstanceService, this._autoFillService = _autoFillService, this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel, this._conditionalFormattingViewModel = _conditionalFormattingViewModel, this._initAutoFill();
|
|
@@ -7297,8 +7297,8 @@ let ConditionalFormattingAutoFillController = (_a9 = class extends Disposable {
|
|
|
7297
7297
|
// eslint-disable-next-line max-lines-per-function
|
|
7298
7298
|
_initAutoFill() {
|
|
7299
7299
|
const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), loopFunc = /* @__PURE__ */ __name((sourceStartCell, targetStartCell, relativeRange, matrixMap, mapFunc) => {
|
|
7300
|
-
var
|
|
7301
|
-
const unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (
|
|
7300
|
+
var _a15;
|
|
7301
|
+
const unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), subUnitId = (_a15 = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : _a15.getSheetId();
|
|
7302
7302
|
if (!unitId || !subUnitId)
|
|
7303
7303
|
return;
|
|
7304
7304
|
const sourceRange = {
|
|
@@ -7369,8 +7369,8 @@ let ConditionalFormattingAutoFillController = (_a9 = class extends Disposable {
|
|
|
7369
7369
|
});
|
|
7370
7370
|
});
|
|
7371
7371
|
}, "loopFunc"), generalApplyFunc = /* @__PURE__ */ __name((sourceRange, targetRange) => {
|
|
7372
|
-
var
|
|
7373
|
-
const unitId = (
|
|
7372
|
+
var _a15, _b, _c;
|
|
7373
|
+
const unitId = (_a15 = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a15.getUnitId(), subUnitId = (_c = (_b = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _b.getActiveSheet()) == null ? void 0 : _c.getSheetId(), matrixMap = /* @__PURE__ */ new Map(), redos = [], undos = [];
|
|
7374
7374
|
if (!unitId || !subUnitId)
|
|
7375
7375
|
return noopReturnFunc();
|
|
7376
7376
|
const virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]), [vSourceRange, vTargetRange] = virtualRange.ranges, { mapFunc } = virtualRange, sourceStartCell = {
|
|
@@ -7416,14 +7416,139 @@ let ConditionalFormattingAutoFillController = (_a9 = class extends Disposable {
|
|
|
7416
7416
|
this.disposeWithMe(this._autoFillService.addHook(hook));
|
|
7417
7417
|
}
|
|
7418
7418
|
}, __name(_a9, "ConditionalFormattingAutoFillController"), _a9);
|
|
7419
|
-
ConditionalFormattingAutoFillController = __decorateClass$
|
|
7419
|
+
ConditionalFormattingAutoFillController = __decorateClass$5([
|
|
7420
7420
|
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingAutoFillController),
|
|
7421
|
+
__decorateParam$5(0, Inject(Injector)),
|
|
7422
|
+
__decorateParam$5(1, Inject(IUniverInstanceService)),
|
|
7423
|
+
__decorateParam$5(2, Inject(IAutoFillService)),
|
|
7424
|
+
__decorateParam$5(3, Inject(ConditionalFormattingRuleModel)),
|
|
7425
|
+
__decorateParam$5(4, Inject(ConditionalFormattingViewModel))
|
|
7426
|
+
], ConditionalFormattingAutoFillController);
|
|
7427
|
+
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7428
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7429
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7430
|
+
return kind && result && __defProp$4(target, key, result), result;
|
|
7431
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4"), _a10;
|
|
7432
|
+
let ConditionalFormattingClearController = (_a10 = class extends Disposable {
|
|
7433
|
+
constructor(_injector, _univerInstanceService, _sheetInterceptorService, _selectionManagerService, _conditionalFormattingRuleModel) {
|
|
7434
|
+
super(), this._injector = _injector, this._univerInstanceService = _univerInstanceService, this._sheetInterceptorService = _sheetInterceptorService, this._selectionManagerService = _selectionManagerService, this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel, this._init();
|
|
7435
|
+
}
|
|
7436
|
+
_init() {
|
|
7437
|
+
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
7438
|
+
getMutations: /* @__PURE__ */ __name((commandInfo) => {
|
|
7439
|
+
var _a15;
|
|
7440
|
+
const redos = [], undos = [], defaultV = { redos, undos };
|
|
7441
|
+
if ([ClearSelectionFormatCommand.id, ClearSelectionAllCommand.id].includes(commandInfo.id)) {
|
|
7442
|
+
const ranges = (_a15 = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : _a15.map((s) => s.range);
|
|
7443
|
+
if (!ranges)
|
|
7444
|
+
return defaultV;
|
|
7445
|
+
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet();
|
|
7446
|
+
if (!worksheet)
|
|
7447
|
+
return defaultV;
|
|
7448
|
+
const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
7449
|
+
if (!allRules || !allRules.length)
|
|
7450
|
+
return defaultV;
|
|
7451
|
+
const { redos: interceptRedos, undos: interceptUndos } = generateClearCfMutations(this._injector, allRules, ranges, unitId, subUnitId);
|
|
7452
|
+
redos.push(...interceptRedos), undos.push(...interceptUndos);
|
|
7453
|
+
}
|
|
7454
|
+
return defaultV;
|
|
7455
|
+
}, "getMutations")
|
|
7456
|
+
})), this.disposeWithMe(this._sheetInterceptorService.interceptRanges({
|
|
7457
|
+
getMutations: /* @__PURE__ */ __name(({ unitId, subUnitId, ranges }) => {
|
|
7458
|
+
const redos = [], undos = [], emptyInterceptorArr = { redos, undos };
|
|
7459
|
+
if (!ranges || !ranges.length)
|
|
7460
|
+
return emptyInterceptorArr;
|
|
7461
|
+
const allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
7462
|
+
if (!allRules || !allRules.length)
|
|
7463
|
+
return emptyInterceptorArr;
|
|
7464
|
+
const { redos: interceptRedos, undos: interceptUndos } = generateClearCfMutations(this._injector, allRules, ranges, unitId, subUnitId);
|
|
7465
|
+
return redos.push(...interceptRedos), undos.push(...interceptUndos), emptyInterceptorArr;
|
|
7466
|
+
}, "getMutations")
|
|
7467
|
+
}));
|
|
7468
|
+
}
|
|
7469
|
+
}, __name(_a10, "ConditionalFormattingClearController"), _a10);
|
|
7470
|
+
ConditionalFormattingClearController = __decorateClass$4([
|
|
7471
|
+
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingClearController),
|
|
7421
7472
|
__decorateParam$4(0, Inject(Injector)),
|
|
7422
7473
|
__decorateParam$4(1, Inject(IUniverInstanceService)),
|
|
7423
|
-
__decorateParam$4(2, Inject(
|
|
7424
|
-
__decorateParam$4(3, Inject(
|
|
7425
|
-
__decorateParam$4(4, Inject(
|
|
7426
|
-
],
|
|
7474
|
+
__decorateParam$4(2, Inject(SheetInterceptorService)),
|
|
7475
|
+
__decorateParam$4(3, Inject(SheetsSelectionsService)),
|
|
7476
|
+
__decorateParam$4(4, Inject(ConditionalFormattingRuleModel))
|
|
7477
|
+
], ConditionalFormattingClearController);
|
|
7478
|
+
function generateClearCfMutations(injector, allRules, ranges, unitId, subUnitId) {
|
|
7479
|
+
const redos = [], undos = [];
|
|
7480
|
+
return allRules.filter((rule) => ranges.some((range) => rule.ranges.some((ruleRange2) => Rectangle.getIntersects(ruleRange2, range)))).forEach((rule) => {
|
|
7481
|
+
const mergeRanges = new RangeMergeUtil().add(...rule.ranges).subtract(...ranges).merge();
|
|
7482
|
+
if (mergeRanges.length) {
|
|
7483
|
+
const redo = {
|
|
7484
|
+
id: SetConditionalRuleMutation.id,
|
|
7485
|
+
params: {
|
|
7486
|
+
unitId,
|
|
7487
|
+
subUnitId,
|
|
7488
|
+
rule: { ...rule, ranges: mergeRanges }
|
|
7489
|
+
}
|
|
7490
|
+
}, undo = setConditionalRuleMutationUndoFactory(injector, redo.params);
|
|
7491
|
+
redos.push(redo), undos.push(...undo);
|
|
7492
|
+
} else {
|
|
7493
|
+
const redo = {
|
|
7494
|
+
id: DeleteConditionalRuleMutation.id,
|
|
7495
|
+
params: {
|
|
7496
|
+
unitId,
|
|
7497
|
+
subUnitId,
|
|
7498
|
+
cfId: rule.cfId
|
|
7499
|
+
}
|
|
7500
|
+
}, undo = DeleteConditionalRuleMutationUndoFactory(injector, redo.params);
|
|
7501
|
+
redos.push(redo), undos.push(...undo);
|
|
7502
|
+
}
|
|
7503
|
+
}), { redos, undos };
|
|
7504
|
+
}
|
|
7505
|
+
__name(generateClearCfMutations, "generateClearCfMutations");
|
|
7506
|
+
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7507
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7508
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7509
|
+
return kind && result && __defProp$3(target, key, result), result;
|
|
7510
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$3"), _a11;
|
|
7511
|
+
let ConditionalFormattingEditorController = (_a11 = class extends Disposable {
|
|
7512
|
+
constructor(_editorBridgeService, _conditionalFormattingService) {
|
|
7513
|
+
super(), this._editorBridgeService = _editorBridgeService, this._conditionalFormattingService = _conditionalFormattingService, this._initInterceptorEditorEnd();
|
|
7514
|
+
}
|
|
7515
|
+
/**
|
|
7516
|
+
* Process the values after edit
|
|
7517
|
+
* @private
|
|
7518
|
+
* @memberof NumfmtService
|
|
7519
|
+
*/
|
|
7520
|
+
_initInterceptorEditorEnd() {
|
|
7521
|
+
this.disposeWithMe(
|
|
7522
|
+
toDisposable(
|
|
7523
|
+
this._editorBridgeService.interceptor.intercept(
|
|
7524
|
+
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
|
|
7525
|
+
{
|
|
7526
|
+
handler: /* @__PURE__ */ __name((value, context, next) => {
|
|
7527
|
+
const result = this._conditionalFormattingService.composeStyle(context.unitId, context.subUnitId, context.row, context.col);
|
|
7528
|
+
if (result != null && result.style && (value != null && value.p)) {
|
|
7529
|
+
const keys = Object.keys(result == null ? void 0 : result.style);
|
|
7530
|
+
if (keys.length > 0) {
|
|
7531
|
+
const v = getStringFromDataStream(value.p), s = { ...(typeof value.s == "string" ? context.workbook.getStyles().get(value.s) : value.s) || {} };
|
|
7532
|
+
keys.forEach((key) => {
|
|
7533
|
+
delete s[key];
|
|
7534
|
+
});
|
|
7535
|
+
const cellData = { ...value, s: { ...s }, v };
|
|
7536
|
+
return delete cellData.p, next(cellData);
|
|
7537
|
+
}
|
|
7538
|
+
}
|
|
7539
|
+
return next(value);
|
|
7540
|
+
}, "handler")
|
|
7541
|
+
}
|
|
7542
|
+
)
|
|
7543
|
+
)
|
|
7544
|
+
);
|
|
7545
|
+
}
|
|
7546
|
+
}, __name(_a11, "ConditionalFormattingEditorController"), _a11);
|
|
7547
|
+
ConditionalFormattingEditorController = __decorateClass$3([
|
|
7548
|
+
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingEditorController),
|
|
7549
|
+
__decorateParam$3(0, Inject(IEditorBridgeService)),
|
|
7550
|
+
__decorateParam$3(1, Inject(ConditionalFormattingService))
|
|
7551
|
+
], ConditionalFormattingEditorController);
|
|
7427
7552
|
const commandList = [
|
|
7428
7553
|
SetWorksheetActiveOperation.id,
|
|
7429
7554
|
AddConditionalRuleMutation.id,
|
|
@@ -7477,15 +7602,15 @@ const commandList = [
|
|
|
7477
7602
|
selectionManagerService.selectionMoveEnd$,
|
|
7478
7603
|
new Observable((commandSubscribe) => {
|
|
7479
7604
|
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
7480
|
-
var
|
|
7481
|
-
const { id, params } = commandInfo, unitId = (
|
|
7605
|
+
var _a15;
|
|
7606
|
+
const { id, params } = commandInfo, unitId = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a15.getUnitId();
|
|
7482
7607
|
commandList.includes(id) && params.unitId === unitId && commandSubscribe.next(null);
|
|
7483
7608
|
});
|
|
7484
7609
|
return () => disposable.dispose();
|
|
7485
7610
|
})
|
|
7486
7611
|
).pipe(debounceTime$1(16)).subscribe(() => {
|
|
7487
|
-
var
|
|
7488
|
-
const ranges = ((
|
|
7612
|
+
var _a15;
|
|
7613
|
+
const ranges = ((_a15 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a15.map((selection) => selection.range)) || [], workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
7489
7614
|
if (!workbook) return;
|
|
7490
7615
|
const worksheet = workbook.getActiveSheet();
|
|
7491
7616
|
if (!worksheet) return;
|
|
@@ -7494,8 +7619,8 @@ const commandList = [
|
|
|
7494
7619
|
})), clearSheetEnable$ = new Observable(
|
|
7495
7620
|
(subscriber) => new Observable((commandSubscribe) => {
|
|
7496
7621
|
const disposable = commandService.onCommandExecuted((commandInfo) => {
|
|
7497
|
-
var
|
|
7498
|
-
const { id, params } = commandInfo, unitId = (
|
|
7622
|
+
var _a15;
|
|
7623
|
+
const { id, params } = commandInfo, unitId = (_a15 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a15.getUnitId();
|
|
7499
7624
|
commandList.includes(id) && params.unitId === unitId && commandSubscribe.next(null);
|
|
7500
7625
|
});
|
|
7501
7626
|
return () => disposable.dispose();
|
|
@@ -7536,158 +7661,250 @@ const commandList = [
|
|
|
7536
7661
|
}
|
|
7537
7662
|
}
|
|
7538
7663
|
};
|
|
7539
|
-
var __defProp$
|
|
7540
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7664
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7665
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7541
7666
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7542
|
-
return kind && result && __defProp$
|
|
7543
|
-
}, "__decorateClass$
|
|
7544
|
-
let ConditionalFormattingMenuController = (
|
|
7667
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
7668
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$2"), _a12;
|
|
7669
|
+
let ConditionalFormattingMenuController = (_a12 = class extends Disposable {
|
|
7545
7670
|
constructor(_injector, _menuManagerService) {
|
|
7546
7671
|
super();
|
|
7547
7672
|
__publicField(this, "_sidebarDisposable", null);
|
|
7548
7673
|
this._injector = _injector, this._menuManagerService = _menuManagerService, this._menuManagerService.mergeMenu(menuSchema);
|
|
7549
7674
|
}
|
|
7550
|
-
}, __name(
|
|
7551
|
-
ConditionalFormattingMenuController = __decorateClass$
|
|
7675
|
+
}, __name(_a12, "ConditionalFormattingMenuController"), _a12);
|
|
7676
|
+
ConditionalFormattingMenuController = __decorateClass$2([
|
|
7552
7677
|
OnLifecycle(LifecycleStages.Ready, ConditionalFormattingMenuController),
|
|
7553
|
-
__decorateParam$
|
|
7554
|
-
__decorateParam$
|
|
7678
|
+
__decorateParam$2(0, Inject(Injector)),
|
|
7679
|
+
__decorateParam$2(1, IMenuManagerService)
|
|
7555
7680
|
], ConditionalFormattingMenuController);
|
|
7556
|
-
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7557
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7558
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7559
|
-
return kind && result && __defProp$2(target, key, result), result;
|
|
7560
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$2"), _a11;
|
|
7561
|
-
let ConditionalFormattingEditorController = (_a11 = class extends Disposable {
|
|
7562
|
-
constructor(_editorBridgeService, _conditionalFormattingService) {
|
|
7563
|
-
super(), this._editorBridgeService = _editorBridgeService, this._conditionalFormattingService = _conditionalFormattingService, this._initInterceptorEditorEnd();
|
|
7564
|
-
}
|
|
7565
|
-
/**
|
|
7566
|
-
* Process the values after edit
|
|
7567
|
-
* @private
|
|
7568
|
-
* @memberof NumfmtService
|
|
7569
|
-
*/
|
|
7570
|
-
_initInterceptorEditorEnd() {
|
|
7571
|
-
this.disposeWithMe(
|
|
7572
|
-
toDisposable(
|
|
7573
|
-
this._editorBridgeService.interceptor.intercept(
|
|
7574
|
-
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT,
|
|
7575
|
-
{
|
|
7576
|
-
handler: /* @__PURE__ */ __name((value, context, next) => {
|
|
7577
|
-
const result = this._conditionalFormattingService.composeStyle(context.unitId, context.subUnitId, context.row, context.col);
|
|
7578
|
-
if (result != null && result.style && (value != null && value.p)) {
|
|
7579
|
-
const keys = Object.keys(result == null ? void 0 : result.style);
|
|
7580
|
-
if (keys.length > 0) {
|
|
7581
|
-
const v = getStringFromDataStream(value.p), s = { ...(typeof value.s == "string" ? context.workbook.getStyles().get(value.s) : value.s) || {} };
|
|
7582
|
-
keys.forEach((key) => {
|
|
7583
|
-
delete s[key];
|
|
7584
|
-
});
|
|
7585
|
-
const cellData = { ...value, s: { ...s }, v };
|
|
7586
|
-
return delete cellData.p, next(cellData);
|
|
7587
|
-
}
|
|
7588
|
-
}
|
|
7589
|
-
return next(value);
|
|
7590
|
-
}, "handler")
|
|
7591
|
-
}
|
|
7592
|
-
)
|
|
7593
|
-
)
|
|
7594
|
-
);
|
|
7595
|
-
}
|
|
7596
|
-
}, __name(_a11, "ConditionalFormattingEditorController"), _a11);
|
|
7597
|
-
ConditionalFormattingEditorController = __decorateClass$2([
|
|
7598
|
-
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingEditorController),
|
|
7599
|
-
__decorateParam$2(0, Inject(IEditorBridgeService)),
|
|
7600
|
-
__decorateParam$2(1, Inject(ConditionalFormattingService))
|
|
7601
|
-
], ConditionalFormattingEditorController);
|
|
7602
7681
|
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7603
7682
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7604
7683
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7605
7684
|
return kind && result && __defProp$1(target, key, result), result;
|
|
7606
|
-
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$1")
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7685
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$1");
|
|
7686
|
+
const repeatByRange = /* @__PURE__ */ __name((sourceRange, targetRange) => {
|
|
7687
|
+
const getRowLength = /* @__PURE__ */ __name((range) => range.endRow - range.startRow + 1, "getRowLength"), getColLength = /* @__PURE__ */ __name((range) => range.endColumn - range.startColumn + 1, "getColLength"), rowMod = getRowLength(targetRange) % getRowLength(sourceRange), colMod = getColLength(targetRange) % getColLength(sourceRange), repeatRow = Math.floor(getRowLength(targetRange) / getRowLength(sourceRange)), repeatCol = Math.floor(getColLength(targetRange) / getColLength(sourceRange)), repeatList = [], repeatRelativeRange = {
|
|
7688
|
+
startRow: 0,
|
|
7689
|
+
endRow: getRowLength(sourceRange) - 1,
|
|
7690
|
+
startColumn: 0,
|
|
7691
|
+
endColumn: getColLength(sourceRange) - 1
|
|
7692
|
+
};
|
|
7693
|
+
if (getRowLength(targetRange) === 1 && getColLength(targetRange) === 1) {
|
|
7694
|
+
const startRange = {
|
|
7695
|
+
startRow: targetRange.startRow,
|
|
7696
|
+
endRow: targetRange.startRow,
|
|
7697
|
+
startColumn: targetRange.startColumn,
|
|
7698
|
+
endColumn: targetRange.startColumn
|
|
7699
|
+
};
|
|
7700
|
+
return repeatList.push({ repeatRelativeRange, startRange }), repeatList;
|
|
7701
|
+
}
|
|
7702
|
+
for (let countRow = 0; countRow < repeatRow + (rowMod ? 0.1 : 0); countRow++)
|
|
7703
|
+
for (let countCol = 0; countCol < repeatCol + (colMod ? 0.1 : 0); countCol++) {
|
|
7704
|
+
const row = getRowLength(sourceRange) * countRow, col = getColLength(sourceRange) * countCol, startRange = {
|
|
7705
|
+
startRow: row + targetRange.startRow,
|
|
7706
|
+
endRow: row + targetRange.startRow,
|
|
7707
|
+
startColumn: col + targetRange.startColumn,
|
|
7708
|
+
endColumn: col + targetRange.startColumn
|
|
7709
|
+
};
|
|
7710
|
+
let _repeatRelativeRange = repeatRelativeRange;
|
|
7711
|
+
countRow === repeatRow && rowMod && (_repeatRelativeRange = { ..._repeatRelativeRange }, _repeatRelativeRange.endRow = _repeatRelativeRange.endRow - (getRowLength(sourceRange) - rowMod)), countCol === repeatCol && colMod && (_repeatRelativeRange = { ..._repeatRelativeRange }, _repeatRelativeRange.endColumn = _repeatRelativeRange.endColumn - (getColLength(sourceRange) - colMod)), repeatList.push({ repeatRelativeRange: _repeatRelativeRange, startRange });
|
|
7712
|
+
}
|
|
7713
|
+
return repeatList;
|
|
7714
|
+
}, "repeatByRange");
|
|
7715
|
+
var _a13;
|
|
7716
|
+
let ConditionalFormattingPainterController = (_a13 = class extends Disposable {
|
|
7717
|
+
constructor(_injector, _univerInstanceService, _formatPainterService, _sheetsSelectionsService, _conditionalFormattingRuleModel, _conditionalFormattingViewModel) {
|
|
7718
|
+
super();
|
|
7719
|
+
__publicField(this, "_painterConfig", null);
|
|
7720
|
+
this._injector = _injector, this._univerInstanceService = _univerInstanceService, this._formatPainterService = _formatPainterService, this._sheetsSelectionsService = _sheetsSelectionsService, this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel, this._conditionalFormattingViewModel = _conditionalFormattingViewModel, this._initFormattingPainter();
|
|
7610
7721
|
}
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7722
|
+
// eslint-disable-next-line max-lines-per-function
|
|
7723
|
+
_initFormattingPainter() {
|
|
7724
|
+
const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), loopFunc = /* @__PURE__ */ __name((sourceStartCell, targetStartCell, relativeRange, matrixMap, config) => {
|
|
7725
|
+
const { unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._painterConfig, { targetUnitId, targetSubUnitId } = config, sourceRange = {
|
|
7726
|
+
startRow: sourceStartCell.row,
|
|
7727
|
+
startColumn: sourceStartCell.col,
|
|
7728
|
+
endColumn: sourceStartCell.col,
|
|
7729
|
+
endRow: sourceStartCell.row
|
|
7730
|
+
}, targetRange = {
|
|
7731
|
+
startRow: targetStartCell.row,
|
|
7732
|
+
startColumn: targetStartCell.col,
|
|
7733
|
+
endColumn: targetStartCell.col,
|
|
7734
|
+
endRow: targetStartCell.row
|
|
7735
|
+
};
|
|
7736
|
+
Range.foreach(relativeRange, (row, col) => {
|
|
7737
|
+
const sourcePositionRange = Rectangle.getPositionRange(
|
|
7738
|
+
{
|
|
7739
|
+
startRow: row,
|
|
7740
|
+
startColumn: col,
|
|
7741
|
+
endColumn: col,
|
|
7742
|
+
endRow: row
|
|
7743
|
+
},
|
|
7744
|
+
sourceRange
|
|
7745
|
+
), targetPositionRange = Rectangle.getPositionRange(
|
|
7746
|
+
{
|
|
7747
|
+
startRow: row,
|
|
7748
|
+
startColumn: col,
|
|
7749
|
+
endColumn: col,
|
|
7750
|
+
endRow: row
|
|
7751
|
+
},
|
|
7752
|
+
targetRange
|
|
7753
|
+
), sourceCellCf = this._conditionalFormattingViewModel.getCellCf(
|
|
7754
|
+
sourceUnitId,
|
|
7755
|
+
sourceSubUnitId,
|
|
7756
|
+
sourcePositionRange.startRow,
|
|
7757
|
+
sourcePositionRange.startColumn
|
|
7758
|
+
), targetCellCf = this._conditionalFormattingViewModel.getCellCf(
|
|
7759
|
+
targetUnitId,
|
|
7760
|
+
targetSubUnitId,
|
|
7761
|
+
targetPositionRange.startRow,
|
|
7762
|
+
targetPositionRange.startColumn
|
|
7763
|
+
);
|
|
7764
|
+
targetCellCf && targetCellCf.cfList.forEach((cf) => {
|
|
7765
|
+
let matrix = matrixMap.get(cf.cfId);
|
|
7766
|
+
if (!matrixMap.get(cf.cfId)) {
|
|
7767
|
+
const rule = this._conditionalFormattingRuleModel.getRule(targetUnitId, targetSubUnitId, cf.cfId);
|
|
7768
|
+
if (!rule)
|
|
7769
|
+
return;
|
|
7770
|
+
matrix = new ObjectMatrix(), rule.ranges.forEach((range) => {
|
|
7771
|
+
Range.foreach(range, (row2, col2) => {
|
|
7772
|
+
matrix.setValue(row2, col2, 1);
|
|
7773
|
+
});
|
|
7774
|
+
}), matrixMap.set(cf.cfId, matrix);
|
|
7775
|
+
}
|
|
7776
|
+
matrix.realDeleteValue(targetPositionRange.startRow, targetPositionRange.startColumn);
|
|
7777
|
+
}), sourceCellCf && sourceCellCf.cfList.forEach((cf) => {
|
|
7778
|
+
const matrix = matrixMap.get(cf.cfId);
|
|
7779
|
+
matrix && matrix.setValue(targetPositionRange.startRow, targetPositionRange.startColumn, 1);
|
|
7780
|
+
});
|
|
7781
|
+
});
|
|
7782
|
+
}, "loopFunc"), generalApplyFunc = /* @__PURE__ */ __name((targetUnitId, targetSubUnitId, targetRange) => {
|
|
7783
|
+
var _a15;
|
|
7784
|
+
const { range: sourceRange, unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._painterConfig, isSkipSheet = targetUnitId !== sourceUnitId || sourceSubUnitId !== targetSubUnitId, matrixMap = /* @__PURE__ */ new Map(), redos = [], undos = [];
|
|
7785
|
+
if (!targetUnitId || !targetSubUnitId || !sourceUnitId || !sourceSubUnitId)
|
|
7786
|
+
return noopReturnFunc();
|
|
7787
|
+
const ruleList = (_a15 = this._conditionalFormattingRuleModel.getSubunitRules(sourceUnitId, sourceSubUnitId)) != null ? _a15 : [];
|
|
7788
|
+
ruleList == null || ruleList.forEach((rule) => {
|
|
7789
|
+
const { ranges, cfId } = rule;
|
|
7790
|
+
if (ranges.some((range) => Rectangle.intersects(sourceRange, range))) {
|
|
7791
|
+
const matrix = new ObjectMatrix();
|
|
7792
|
+
isSkipSheet || ranges.forEach((range) => {
|
|
7793
|
+
Range.foreach(range, (row, col) => {
|
|
7794
|
+
matrix.setValue(row, col, 1);
|
|
7795
|
+
});
|
|
7796
|
+
}), matrixMap.set(cfId, matrix);
|
|
7628
7797
|
}
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
if (
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7798
|
+
});
|
|
7799
|
+
const sourceStartCell = {
|
|
7800
|
+
row: sourceRange.startRow,
|
|
7801
|
+
col: sourceRange.startColumn
|
|
7802
|
+
};
|
|
7803
|
+
return repeatByRange(sourceRange, targetRange).forEach((repeat) => {
|
|
7804
|
+
loopFunc(sourceStartCell, { row: repeat.startRange.startRow, col: repeat.startRange.startColumn }, repeat.repeatRelativeRange, matrixMap, { targetUnitId, targetSubUnitId });
|
|
7805
|
+
}), matrixMap.forEach((item2, cfId) => {
|
|
7806
|
+
if (isSkipSheet) {
|
|
7807
|
+
const rule = this._conditionalFormattingRuleModel.getRule(targetUnitId, targetSubUnitId, cfId), ranges = findAllRectangle(createTopMatrixFromMatrix(item2));
|
|
7808
|
+
if (rule)
|
|
7809
|
+
if (ranges.length) {
|
|
7810
|
+
const params = {
|
|
7811
|
+
unitId: targetUnitId,
|
|
7812
|
+
subUnitId: targetSubUnitId,
|
|
7813
|
+
rule: { ...rule, ranges }
|
|
7814
|
+
};
|
|
7815
|
+
redos.push({ id: SetConditionalRuleMutation.id, params }), undos.push(...setConditionalRuleMutationUndoFactory(this._injector, params));
|
|
7816
|
+
} else {
|
|
7817
|
+
const params = {
|
|
7818
|
+
unitId: targetUnitId,
|
|
7819
|
+
subUnitId: targetSubUnitId,
|
|
7820
|
+
cfId: rule.cfId
|
|
7821
|
+
};
|
|
7822
|
+
redos.push({ id: DeleteConditionalRuleMutation.id, params }), undos.push(...DeleteConditionalRuleMutationUndoFactory(this._injector, params));
|
|
7823
|
+
}
|
|
7824
|
+
else if (ranges.length) {
|
|
7825
|
+
const sourceRule = this._conditionalFormattingRuleModel.getRule(sourceUnitId, sourceSubUnitId, cfId);
|
|
7826
|
+
if (sourceRule) {
|
|
7827
|
+
const params = {
|
|
7828
|
+
unitId: targetUnitId,
|
|
7829
|
+
subUnitId: targetSubUnitId,
|
|
7830
|
+
rule: {
|
|
7831
|
+
...Tools.deepClone(sourceRule),
|
|
7832
|
+
cfId: this._conditionalFormattingRuleModel.createCfId(targetUnitId, targetSubUnitId),
|
|
7833
|
+
ranges
|
|
7834
|
+
}
|
|
7835
|
+
};
|
|
7836
|
+
redos.push({ id: AddConditionalRuleMutation.id, params }), undos.push(AddConditionalRuleMutationUndoFactory(this._injector, params));
|
|
7837
|
+
}
|
|
7838
|
+
}
|
|
7839
|
+
} else {
|
|
7840
|
+
const rule = this._conditionalFormattingRuleModel.getRule(sourceUnitId, sourceSubUnitId, cfId);
|
|
7841
|
+
if (!rule)
|
|
7842
|
+
return;
|
|
7843
|
+
const ranges = findAllRectangle(createTopMatrixFromMatrix(item2));
|
|
7844
|
+
if (ranges.length) {
|
|
7845
|
+
const params = {
|
|
7846
|
+
unitId: sourceUnitId,
|
|
7847
|
+
subUnitId: sourceSubUnitId,
|
|
7848
|
+
rule: { ...rule, ranges }
|
|
7849
|
+
};
|
|
7850
|
+
redos.push({ id: SetConditionalRuleMutation.id, params }), undos.push(...setConditionalRuleMutationUndoFactory(this._injector, params));
|
|
7851
|
+
} else {
|
|
7852
|
+
const params = {
|
|
7853
|
+
unitId: sourceUnitId,
|
|
7854
|
+
subUnitId: sourceSubUnitId,
|
|
7855
|
+
cfId: rule.cfId
|
|
7856
|
+
};
|
|
7857
|
+
redos.push({ id: DeleteConditionalRuleMutation.id, params }), undos.push(...DeleteConditionalRuleMutationUndoFactory(this._injector, params));
|
|
7858
|
+
}
|
|
7859
|
+
}
|
|
7860
|
+
}), {
|
|
7861
|
+
undos,
|
|
7862
|
+
redos
|
|
7863
|
+
};
|
|
7864
|
+
}, "generalApplyFunc"), hook = {
|
|
7865
|
+
id: SHEET_CONDITIONAL_FORMATTING_PLUGIN,
|
|
7866
|
+
onStatusChange: /* @__PURE__ */ __name((status) => {
|
|
7867
|
+
var _a15, _b, _c;
|
|
7868
|
+
switch (status) {
|
|
7869
|
+
case FormatPainterStatus.INFINITE:
|
|
7870
|
+
case FormatPainterStatus.ONCE: {
|
|
7871
|
+
const unitId = (_a15 = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a15.getUnitId(), subUnitId = (_c = (_b = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _b.getActiveSheet()) == null ? void 0 : _c.getSheetId(), selection = this._sheetsSelectionsService.getCurrentLastSelection(), range = selection == null ? void 0 : selection.range;
|
|
7872
|
+
unitId && subUnitId && range && (this._painterConfig = { unitId, subUnitId, range });
|
|
7873
|
+
break;
|
|
7874
|
+
}
|
|
7875
|
+
case FormatPainterStatus.OFF: {
|
|
7876
|
+
this._painterConfig = null;
|
|
7877
|
+
break;
|
|
7878
|
+
}
|
|
7879
|
+
}
|
|
7880
|
+
}, "onStatusChange"),
|
|
7881
|
+
onApply: /* @__PURE__ */ __name((unitId, subUnitId, targetRange) => this._painterConfig ? generalApplyFunc(unitId, subUnitId, targetRange) : {
|
|
7882
|
+
redos: [],
|
|
7883
|
+
undos: []
|
|
7884
|
+
}, "onApply")
|
|
7885
|
+
};
|
|
7886
|
+
this._formatPainterService.addHook(hook);
|
|
7643
7887
|
}
|
|
7644
|
-
}, __name(
|
|
7645
|
-
|
|
7646
|
-
OnLifecycle(LifecycleStages.Rendered,
|
|
7888
|
+
}, __name(_a13, "ConditionalFormattingPainterController"), _a13);
|
|
7889
|
+
ConditionalFormattingPainterController = __decorateClass$1([
|
|
7890
|
+
OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingPainterController),
|
|
7647
7891
|
__decorateParam$1(0, Inject(Injector)),
|
|
7648
7892
|
__decorateParam$1(1, Inject(IUniverInstanceService)),
|
|
7649
|
-
__decorateParam$1(2, Inject(
|
|
7893
|
+
__decorateParam$1(2, Inject(IFormatPainterService)),
|
|
7650
7894
|
__decorateParam$1(3, Inject(SheetsSelectionsService)),
|
|
7651
|
-
__decorateParam$1(4, Inject(ConditionalFormattingRuleModel))
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
const redos = [], undos = [];
|
|
7655
|
-
return allRules.filter((rule) => ranges.some((range) => rule.ranges.some((ruleRange2) => Rectangle.getIntersects(ruleRange2, range)))).forEach((rule) => {
|
|
7656
|
-
const mergeRanges = new RangeMergeUtil().add(...rule.ranges).subtract(...ranges).merge();
|
|
7657
|
-
if (mergeRanges.length) {
|
|
7658
|
-
const redo = {
|
|
7659
|
-
id: SetConditionalRuleMutation.id,
|
|
7660
|
-
params: {
|
|
7661
|
-
unitId,
|
|
7662
|
-
subUnitId,
|
|
7663
|
-
rule: { ...rule, ranges: mergeRanges }
|
|
7664
|
-
}
|
|
7665
|
-
}, undo = setConditionalRuleMutationUndoFactory(injector, redo.params);
|
|
7666
|
-
redos.push(redo), undos.push(...undo);
|
|
7667
|
-
} else {
|
|
7668
|
-
const redo = {
|
|
7669
|
-
id: DeleteConditionalRuleMutation.id,
|
|
7670
|
-
params: {
|
|
7671
|
-
unitId,
|
|
7672
|
-
subUnitId,
|
|
7673
|
-
cfId: rule.cfId
|
|
7674
|
-
}
|
|
7675
|
-
}, undo = DeleteConditionalRuleMutationUndoFactory(injector, redo.params);
|
|
7676
|
-
redos.push(redo), undos.push(...undo);
|
|
7677
|
-
}
|
|
7678
|
-
}), { redos, undos };
|
|
7679
|
-
}
|
|
7680
|
-
__name(generateClearCfMutations, "generateClearCfMutations");
|
|
7895
|
+
__decorateParam$1(4, Inject(ConditionalFormattingRuleModel)),
|
|
7896
|
+
__decorateParam$1(5, Inject(ConditionalFormattingViewModel))
|
|
7897
|
+
], ConditionalFormattingPainterController);
|
|
7681
7898
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
7682
7899
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7683
7900
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
7684
7901
|
return kind && result && __defProp2(target, key, result), result;
|
|
7685
|
-
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"),
|
|
7686
|
-
let UniverSheetsConditionalFormattingUIPlugin = (
|
|
7902
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a14;
|
|
7903
|
+
let UniverSheetsConditionalFormattingUIPlugin = (_a14 = class extends Plugin {
|
|
7687
7904
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
|
7688
7905
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
|
|
7689
7906
|
const { menu, ...rest } = this._config;
|
|
7690
|
-
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._initCommand(), this._injector.add([SheetsCfRenderController]), this._injector.add([SheetsCfRefRangeController]), this._injector.add([ConditionalFormattingCopyPasteController]), this._injector.add([ConditionalFormattingAutoFillController]), this._injector.add([ConditionalFormattingPermissionController]), this._injector.add([ConditionalFormattingPanelController]), this._injector.add([ConditionalFormattingMenuController]), this._injector.add([ConditionalFormattingI18nController]), this._injector.add([ConditionalFormattingEditorController]), this._injector.add([ConditionalFormattingClearController]);
|
|
7907
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._initCommand(), this._injector.add([SheetsCfRenderController]), this._injector.add([SheetsCfRefRangeController]), this._injector.add([ConditionalFormattingCopyPasteController]), this._injector.add([ConditionalFormattingAutoFillController]), this._injector.add([ConditionalFormattingPermissionController]), this._injector.add([ConditionalFormattingPanelController]), this._injector.add([ConditionalFormattingMenuController]), this._injector.add([ConditionalFormattingI18nController]), this._injector.add([ConditionalFormattingEditorController]), this._injector.add([ConditionalFormattingClearController]), this._injector.add([ConditionalFormattingPainterController]);
|
|
7691
7908
|
}
|
|
7692
7909
|
_initCommand() {
|
|
7693
7910
|
[
|
|
@@ -7711,7 +7928,7 @@ let UniverSheetsConditionalFormattingUIPlugin = (_a13 = class extends Plugin {
|
|
|
7711
7928
|
this._commandService.registerCommand(m2);
|
|
7712
7929
|
});
|
|
7713
7930
|
}
|
|
7714
|
-
}, __name(
|
|
7931
|
+
}, __name(_a14, "UniverSheetsConditionalFormattingUIPlugin"), _a14);
|
|
7715
7932
|
__publicField2(UniverSheetsConditionalFormattingUIPlugin, "pluginName", `${SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`);
|
|
7716
7933
|
__publicField2(UniverSheetsConditionalFormattingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
7717
7934
|
UniverSheetsConditionalFormattingUIPlugin = __decorateClass([
|