@univerjs/sheets-conditional-formatting 0.24.0 → 0.25.0-insiders.20260608-e4336f7
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/facade.js +142 -73
- package/lib/cjs/index.js +263 -166
- package/lib/cjs/locale/ar-SA.js +11 -0
- package/lib/cjs/locale/ca-ES.js +11 -0
- package/lib/cjs/locale/de-DE.js +11 -0
- package/lib/cjs/locale/en-US.js +26 -0
- package/lib/cjs/locale/es-ES.js +11 -0
- package/lib/cjs/locale/fa-IR.js +11 -0
- package/lib/cjs/locale/fr-FR.js +11 -0
- package/lib/cjs/locale/id-ID.js +11 -0
- package/lib/cjs/locale/it-IT.js +11 -0
- package/lib/cjs/locale/ja-JP.js +11 -0
- package/lib/cjs/locale/ko-KR.js +11 -0
- package/lib/cjs/locale/pl-PL.js +11 -0
- package/lib/cjs/locale/pt-BR.js +11 -0
- package/lib/cjs/locale/ru-RU.js +11 -0
- package/lib/cjs/locale/sk-SK.js +11 -0
- package/lib/cjs/locale/vi-VN.js +11 -0
- package/lib/cjs/locale/zh-CN.js +11 -0
- package/lib/cjs/locale/zh-HK.js +11 -0
- package/lib/cjs/locale/zh-TW.js +11 -0
- package/lib/es/facade.js +142 -73
- package/lib/es/index.js +252 -168
- package/lib/es/locale/ar-SA.js +10 -0
- package/lib/es/locale/ca-ES.js +10 -0
- package/lib/es/locale/de-DE.js +10 -0
- package/lib/es/locale/en-US.js +25 -0
- package/lib/es/locale/es-ES.js +10 -0
- package/lib/es/locale/fa-IR.js +10 -0
- package/lib/es/locale/fr-FR.js +10 -0
- package/lib/es/locale/id-ID.js +10 -0
- package/lib/es/locale/it-IT.js +10 -0
- package/lib/es/locale/ja-JP.js +10 -0
- package/lib/es/locale/ko-KR.js +10 -0
- package/lib/es/locale/pl-PL.js +10 -0
- package/lib/es/locale/pt-BR.js +10 -0
- package/lib/es/locale/ru-RU.js +10 -0
- package/lib/es/locale/sk-SK.js +10 -0
- package/lib/es/locale/vi-VN.js +10 -0
- package/lib/es/locale/zh-CN.js +10 -0
- package/lib/es/locale/zh-HK.js +10 -0
- package/lib/es/locale/zh-TW.js +10 -0
- package/lib/facade.js +142 -73
- package/lib/index.js +252 -168
- package/lib/locale/ar-SA.js +10 -0
- package/lib/locale/ca-ES.js +10 -0
- package/lib/locale/de-DE.js +10 -0
- package/lib/locale/en-US.js +25 -0
- package/lib/locale/es-ES.js +10 -0
- package/lib/locale/fa-IR.js +10 -0
- package/lib/locale/fr-FR.js +10 -0
- package/lib/locale/id-ID.js +10 -0
- package/lib/locale/it-IT.js +10 -0
- package/lib/locale/ja-JP.js +10 -0
- package/lib/locale/ko-KR.js +10 -0
- package/lib/locale/pl-PL.js +10 -0
- package/lib/locale/pt-BR.js +10 -0
- package/lib/locale/ru-RU.js +10 -0
- package/lib/locale/sk-SK.js +10 -0
- package/lib/locale/vi-VN.js +10 -0
- package/lib/locale/zh-CN.js +10 -0
- package/lib/locale/zh-HK.js +10 -0
- package/lib/locale/zh-TW.js +10 -0
- package/lib/types/facade/f-conditional-formatting-builder.d.ts +138 -69
- package/lib/types/facade/f-range.d.ts +6 -3
- package/lib/types/facade/f-worksheet.d.ts +14 -7
- package/lib/types/index.d.ts +3 -0
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/ca-ES.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +26 -0
- package/lib/types/locale/es-ES.d.ts +18 -0
- package/lib/types/locale/fa-IR.d.ts +18 -0
- package/lib/types/locale/fr-FR.d.ts +18 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/ja-JP.d.ts +18 -0
- package/lib/types/locale/ko-KR.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/ru-RU.d.ts +18 -0
- package/lib/types/locale/sk-SK.d.ts +18 -0
- package/lib/types/locale/vi-VN.d.ts +18 -0
- package/lib/types/locale/zh-CN.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/locale/zh-TW.d.ts +18 -0
- package/lib/types/models/conditional-formatting-range-index-model.d.ts +32 -0
- package/lib/types/models/conditional-formatting-view-model.d.ts +3 -2
- package/lib/types/services/conditional-formatting-range-transform.service.d.ts +27 -0
- package/lib/types/services/conditional-formatting-style-composer.service.d.ts +31 -0
- package/lib/types/services/conditional-formatting.service.d.ts +7 -7
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +14 -9
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -221,7 +221,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
221
221
|
const createCfId = () => `${(0, _univerjs_core.generateRandomId)(8)}`;
|
|
222
222
|
|
|
223
223
|
//#endregion
|
|
224
|
-
//#region \0@oxc-project+runtime@0.
|
|
224
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
225
225
|
function _typeof(o) {
|
|
226
226
|
"@babel/helpers - typeof";
|
|
227
227
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -232,7 +232,7 @@ function _typeof(o) {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
//#endregion
|
|
235
|
-
//#region \0@oxc-project+runtime@0.
|
|
235
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
236
236
|
function toPrimitive(t, r) {
|
|
237
237
|
if ("object" != _typeof(t) || !t) return t;
|
|
238
238
|
var e = t[Symbol.toPrimitive];
|
|
@@ -245,14 +245,14 @@ function toPrimitive(t, r) {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
//#endregion
|
|
248
|
-
//#region \0@oxc-project+runtime@0.
|
|
248
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
249
249
|
function toPropertyKey(t) {
|
|
250
250
|
var i = toPrimitive(t, "string");
|
|
251
251
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
//#endregion
|
|
255
|
-
//#region \0@oxc-project+runtime@0.
|
|
255
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
256
256
|
function _defineProperty(e, r, t) {
|
|
257
257
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
258
258
|
value: t,
|
|
@@ -512,6 +512,146 @@ const AddCfCommand = {
|
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
|
|
517
|
+
function __decorateParam(paramIndex, decorator) {
|
|
518
|
+
return function(target, key) {
|
|
519
|
+
decorator(target, key, paramIndex);
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
//#endregion
|
|
524
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
|
|
525
|
+
function __decorate(decorators, target, key, desc) {
|
|
526
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
527
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
528
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
529
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/models/conditional-formatting-range-index-model.ts
|
|
534
|
+
let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndexModel extends _univerjs_core.Disposable {
|
|
535
|
+
constructor(_conditionalFormattingRuleModel) {
|
|
536
|
+
super();
|
|
537
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
538
|
+
_defineProperty(this, "_rTreeManager", new _univerjs_core.RTree());
|
|
539
|
+
this.rebuild();
|
|
540
|
+
this._initRuleListener();
|
|
541
|
+
}
|
|
542
|
+
getRuleIdsByCell(unitId, subUnitId, row, col) {
|
|
543
|
+
return this.getRuleIdsByRanges(unitId, subUnitId, [{
|
|
544
|
+
startRow: row,
|
|
545
|
+
endRow: row,
|
|
546
|
+
startColumn: col,
|
|
547
|
+
endColumn: col
|
|
548
|
+
}]);
|
|
549
|
+
}
|
|
550
|
+
getRuleIdsByRanges(unitId, subUnitId, ranges) {
|
|
551
|
+
if (!ranges.length) return /* @__PURE__ */ new Set();
|
|
552
|
+
const ids = this._rTreeManager.bulkSearch(ranges.map((range) => ({
|
|
553
|
+
unitId,
|
|
554
|
+
sheetId: subUnitId,
|
|
555
|
+
range
|
|
556
|
+
})));
|
|
557
|
+
return new Set(Array.from(ids).map((id) => String(id)));
|
|
558
|
+
}
|
|
559
|
+
getRulesByRanges(unitId, subUnitId, ranges) {
|
|
560
|
+
var _this$_conditionalFor;
|
|
561
|
+
const ids = this.getRuleIdsByRanges(unitId, subUnitId, ranges);
|
|
562
|
+
return ((_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId)) !== null && _this$_conditionalFor !== void 0 ? _this$_conditionalFor : []).filter((rule) => ids.has(rule.cfId));
|
|
563
|
+
}
|
|
564
|
+
dispose() {
|
|
565
|
+
this.clear();
|
|
566
|
+
super.dispose();
|
|
567
|
+
}
|
|
568
|
+
clear() {
|
|
569
|
+
this._rTreeManager.clear();
|
|
570
|
+
}
|
|
571
|
+
rebuild() {
|
|
572
|
+
this.clear();
|
|
573
|
+
this._conditionalFormattingRuleModel.getAll().forEach((subUnitMap, unitId) => {
|
|
574
|
+
subUnitMap.forEach((rules, subUnitId) => {
|
|
575
|
+
rules.forEach((rule) => {
|
|
576
|
+
this._insert(unitId, subUnitId, rule.cfId, rule.ranges);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
_initRuleListener() {
|
|
582
|
+
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
|
|
583
|
+
const { unitId, subUnitId, rule } = e;
|
|
584
|
+
const { cfId, ranges } = rule;
|
|
585
|
+
switch (e.type) {
|
|
586
|
+
case "add":
|
|
587
|
+
this._insert(unitId, subUnitId, cfId, ranges);
|
|
588
|
+
break;
|
|
589
|
+
case "delete":
|
|
590
|
+
this._remove(unitId, subUnitId, cfId, ranges);
|
|
591
|
+
break;
|
|
592
|
+
case "set": {
|
|
593
|
+
const oldRule = e.oldRule;
|
|
594
|
+
this._remove(unitId, subUnitId, oldRule.cfId, oldRule.ranges);
|
|
595
|
+
this._insert(unitId, subUnitId, cfId, ranges);
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}));
|
|
600
|
+
}
|
|
601
|
+
_insert(unitId, subUnitId, cfId, ranges) {
|
|
602
|
+
this._rTreeManager.bulkInsert(ranges.map((range) => ({
|
|
603
|
+
unitId,
|
|
604
|
+
sheetId: subUnitId,
|
|
605
|
+
id: cfId,
|
|
606
|
+
range
|
|
607
|
+
})));
|
|
608
|
+
}
|
|
609
|
+
_remove(unitId, subUnitId, cfId, ranges) {
|
|
610
|
+
this._rTreeManager.bulkRemove(ranges.map((range) => ({
|
|
611
|
+
unitId,
|
|
612
|
+
sheetId: subUnitId,
|
|
613
|
+
id: cfId,
|
|
614
|
+
range
|
|
615
|
+
})));
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
ConditionalFormattingRangeIndexModel = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ConditionalFormattingRuleModel))], ConditionalFormattingRangeIndexModel);
|
|
619
|
+
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/services/conditional-formatting-range-transform.service.ts
|
|
622
|
+
var ConditionalFormattingRangeTransformService = class {
|
|
623
|
+
subtractRanges(sourceRanges, rangesToSubtract) {
|
|
624
|
+
return _univerjs_core.Rectangle.mergeRanges(_univerjs_core.Rectangle.subtractMulti(sourceRanges, rangesToSubtract));
|
|
625
|
+
}
|
|
626
|
+
addRanges(sourceRanges, rangesToAdd) {
|
|
627
|
+
return _univerjs_core.Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]);
|
|
628
|
+
}
|
|
629
|
+
applyRangeDelta(sourceRanges, rangesToSubtract, rangesToAdd) {
|
|
630
|
+
const ranges = rangesToSubtract.length ? this.subtractRanges(sourceRanges, rangesToSubtract) : sourceRanges;
|
|
631
|
+
return rangesToAdd.length ? this.addRanges(ranges, rangesToAdd) : ranges;
|
|
632
|
+
}
|
|
633
|
+
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
634
|
+
const fragments = [];
|
|
635
|
+
sourceRanges.forEach((range) => {
|
|
636
|
+
const intersect = _univerjs_core.Rectangle.getIntersects(range, sourceRange);
|
|
637
|
+
if (!intersect) return;
|
|
638
|
+
fragments.push(this.translateRange(intersect, {
|
|
639
|
+
row: targetAnchor.row - sourceRange.startRow,
|
|
640
|
+
col: targetAnchor.col - sourceRange.startColumn
|
|
641
|
+
}));
|
|
642
|
+
});
|
|
643
|
+
return _univerjs_core.Rectangle.mergeRanges(fragments);
|
|
644
|
+
}
|
|
645
|
+
translateRange(range, offset) {
|
|
646
|
+
return {
|
|
647
|
+
startRow: range.startRow + offset.row,
|
|
648
|
+
endRow: range.endRow + offset.row,
|
|
649
|
+
startColumn: range.startColumn + offset.col,
|
|
650
|
+
endColumn: range.endColumn + offset.col
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
|
|
515
655
|
//#endregion
|
|
516
656
|
//#region src/commands/mutations/set-conditional-rule.mutation.ts
|
|
517
657
|
const SetConditionalRuleMutation = {
|
|
@@ -548,9 +688,10 @@ const ClearRangeCfCommand = {
|
|
|
548
688
|
type: _univerjs_core.CommandType.COMMAND,
|
|
549
689
|
id: "sheet.command.clear-range-conditional-rule",
|
|
550
690
|
handler(accessor, params) {
|
|
551
|
-
var _selectionManagerServ;
|
|
691
|
+
var _ref, _params$ranges, _selectionManagerServ;
|
|
552
692
|
if (!params) return false;
|
|
553
|
-
const
|
|
693
|
+
const conditionalFormattingRangeIndexModel = accessor.get(ConditionalFormattingRangeIndexModel);
|
|
694
|
+
const conditionalFormattingRangeTransformService = accessor.get(ConditionalFormattingRangeTransformService);
|
|
554
695
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
555
696
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
556
697
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
@@ -558,24 +699,13 @@ const ClearRangeCfCommand = {
|
|
|
558
699
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService, params);
|
|
559
700
|
if (!target) return false;
|
|
560
701
|
const { unitId, subUnitId } = target;
|
|
561
|
-
const ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((selection) => selection.range))
|
|
562
|
-
const allRuleList =
|
|
702
|
+
const ranges = (_ref = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : (_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((selection) => selection.range)) !== null && _ref !== void 0 ? _ref : [];
|
|
703
|
+
const allRuleList = conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges);
|
|
563
704
|
if (!(allRuleList === null || allRuleList === void 0 ? void 0 : allRuleList.length) || !ranges.length) return false;
|
|
564
705
|
const redos = [];
|
|
565
706
|
const undos = [];
|
|
566
707
|
allRuleList.forEach((oldRule) => {
|
|
567
|
-
const
|
|
568
|
-
oldRule.ranges.forEach((range) => {
|
|
569
|
-
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
570
|
-
matrix.setValue(row, col, 1);
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
ranges.forEach((range) => {
|
|
574
|
-
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
575
|
-
matrix.realDeleteValue(row, col);
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
const newRanges = (0, _univerjs_sheets.findAllRectangle)((0, _univerjs_sheets.createTopMatrixFromMatrix)(matrix));
|
|
708
|
+
const newRanges = conditionalFormattingRangeTransformService.subtractRanges(oldRule.ranges, ranges);
|
|
579
709
|
if (newRanges.length) {
|
|
580
710
|
const params = {
|
|
581
711
|
unitId,
|
|
@@ -750,23 +880,6 @@ const SetCfCommand = {
|
|
|
750
880
|
}
|
|
751
881
|
};
|
|
752
882
|
|
|
753
|
-
//#endregion
|
|
754
|
-
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
755
|
-
function __decorateParam(paramIndex, decorator) {
|
|
756
|
-
return function(target, key) {
|
|
757
|
-
decorator(target, key, paramIndex);
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
//#endregion
|
|
762
|
-
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
763
|
-
function __decorate(decorators, target, key, desc) {
|
|
764
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
765
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
766
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
767
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
883
|
//#endregion
|
|
771
884
|
//#region src/services/conditional-formatting-formula.service.ts
|
|
772
885
|
let ConditionalFormattingFormulaService = class ConditionalFormattingFormulaService extends _univerjs_core.Disposable {
|
|
@@ -1671,14 +1784,14 @@ var IconSetCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1671
1784
|
//#region src/models/conditional-formatting-view-model.ts
|
|
1672
1785
|
const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH = 1e3 * 3 * 3;
|
|
1673
1786
|
let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extends _univerjs_core.Disposable {
|
|
1674
|
-
constructor(_injector, _conditionalFormattingRuleModel, _conditionalFormattingFormulaService, _univerInstanceService) {
|
|
1787
|
+
constructor(_injector, _conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService, _univerInstanceService) {
|
|
1675
1788
|
super();
|
|
1676
1789
|
this._injector = _injector;
|
|
1677
1790
|
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
1791
|
+
this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
|
|
1678
1792
|
this._conditionalFormattingFormulaService = _conditionalFormattingFormulaService;
|
|
1679
1793
|
this._univerInstanceService = _univerInstanceService;
|
|
1680
1794
|
_defineProperty(this, "_calculateUnitManagers", /* @__PURE__ */ new Map());
|
|
1681
|
-
_defineProperty(this, "_rTreeManager", new _univerjs_core.RTree());
|
|
1682
1795
|
_defineProperty(this, "_cellCache", new _univerjs_core.LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
|
|
1683
1796
|
_defineProperty(this, "_markDirty$", new rxjs.Subject());
|
|
1684
1797
|
_defineProperty(this, "markDirty$", this._markDirty$.asObservable());
|
|
@@ -1746,16 +1859,7 @@ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extend
|
|
|
1746
1859
|
var _this$_conditionalFor;
|
|
1747
1860
|
const subunitRules = (_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId)) !== null && _this$_conditionalFor !== void 0 ? _this$_conditionalFor : [];
|
|
1748
1861
|
const _calculateUnitManagers = this._ensureCalculateUnitManager(unitId, subUnitId);
|
|
1749
|
-
const list = this.
|
|
1750
|
-
unitId,
|
|
1751
|
-
sheetId: subUnitId,
|
|
1752
|
-
range: {
|
|
1753
|
-
startColumn: col,
|
|
1754
|
-
endColumn: col,
|
|
1755
|
-
startRow: row,
|
|
1756
|
-
endRow: row
|
|
1757
|
-
}
|
|
1758
|
-
}]);
|
|
1862
|
+
const list = this._conditionalFormattingRangeIndexModel.getRuleIdsByCell(unitId, subUnitId, row, col);
|
|
1759
1863
|
const rules = subunitRules.filter((rule) => list.has(rule.cfId));
|
|
1760
1864
|
if (!rules.length) return [];
|
|
1761
1865
|
return rules.map((rule) => {
|
|
@@ -1777,7 +1881,6 @@ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extend
|
|
|
1777
1881
|
clearCache() {
|
|
1778
1882
|
this._calculateUnitManagers.clear();
|
|
1779
1883
|
this._cellCache.clear();
|
|
1780
|
-
this._rTreeManager.clear();
|
|
1781
1884
|
}
|
|
1782
1885
|
_handleCustomFormulasSeparately() {
|
|
1783
1886
|
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
|
|
@@ -1796,40 +1899,16 @@ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extend
|
|
|
1796
1899
|
this.markRuleDirty(unitId, subUnitId, cfId);
|
|
1797
1900
|
switch (e.type) {
|
|
1798
1901
|
case "add": {
|
|
1799
|
-
this._rTreeManager.bulkInsert(ranges.map((r) => ({
|
|
1800
|
-
unitId,
|
|
1801
|
-
sheetId: subUnitId,
|
|
1802
|
-
id: cfId,
|
|
1803
|
-
range: r
|
|
1804
|
-
})));
|
|
1805
1902
|
const instance = this._createRuleCalculateUnitInstance(unitId, subUnitId, rule);
|
|
1806
1903
|
if (!instance) return;
|
|
1807
1904
|
calculateUnitManager.set(rule.cfId, instance);
|
|
1808
1905
|
break;
|
|
1809
1906
|
}
|
|
1810
1907
|
case "delete":
|
|
1811
|
-
this._rTreeManager.bulkRemove(ranges.map((r) => ({
|
|
1812
|
-
unitId,
|
|
1813
|
-
sheetId: subUnitId,
|
|
1814
|
-
id: cfId,
|
|
1815
|
-
range: r
|
|
1816
|
-
})));
|
|
1817
1908
|
calculateUnitManager.delete(rule.cfId);
|
|
1818
1909
|
break;
|
|
1819
1910
|
case "set": {
|
|
1820
1911
|
const oldRule = e.oldRule;
|
|
1821
|
-
this._rTreeManager.bulkRemove(oldRule.ranges.map((r) => ({
|
|
1822
|
-
unitId,
|
|
1823
|
-
sheetId: subUnitId,
|
|
1824
|
-
id: oldRule.cfId,
|
|
1825
|
-
range: r
|
|
1826
|
-
})));
|
|
1827
|
-
this._rTreeManager.bulkInsert(ranges.map((r) => ({
|
|
1828
|
-
unitId,
|
|
1829
|
-
sheetId: subUnitId,
|
|
1830
|
-
id: cfId,
|
|
1831
|
-
range: r
|
|
1832
|
-
})));
|
|
1833
1912
|
if (oldRule.rule.type !== rule.rule.type) {
|
|
1834
1913
|
const instance = this._createRuleCalculateUnitInstance(unitId, subUnitId, rule);
|
|
1835
1914
|
if (!instance) return;
|
|
@@ -1896,8 +1975,9 @@ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extend
|
|
|
1896
1975
|
ConditionalFormattingViewModel = __decorate([
|
|
1897
1976
|
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
1898
1977
|
__decorateParam(1, (0, _univerjs_core.Inject)(ConditionalFormattingRuleModel)),
|
|
1899
|
-
__decorateParam(2, (0, _univerjs_core.Inject)(
|
|
1900
|
-
__decorateParam(3, _univerjs_core.
|
|
1978
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(ConditionalFormattingRangeIndexModel)),
|
|
1979
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(ConditionalFormattingFormulaService)),
|
|
1980
|
+
__decorateParam(4, _univerjs_core.IUniverInstanceService)
|
|
1901
1981
|
], ConditionalFormattingViewModel);
|
|
1902
1982
|
|
|
1903
1983
|
//#endregion
|
|
@@ -2255,7 +2335,7 @@ let IIconSetType = /* @__PURE__ */ function(IIconSetType) {
|
|
|
2255
2335
|
}({});
|
|
2256
2336
|
const iconGroup = [
|
|
2257
2337
|
{
|
|
2258
|
-
title: "
|
|
2338
|
+
title: "sheets-conditional-formatting.iconSet.direction",
|
|
2259
2339
|
group: [
|
|
2260
2340
|
{
|
|
2261
2341
|
name: "3Arrows",
|
|
@@ -2322,7 +2402,7 @@ const iconGroup = [
|
|
|
2322
2402
|
]
|
|
2323
2403
|
},
|
|
2324
2404
|
{
|
|
2325
|
-
title: "
|
|
2405
|
+
title: "sheets-conditional-formatting.iconSet.shape",
|
|
2326
2406
|
group: [
|
|
2327
2407
|
{
|
|
2328
2408
|
name: "3TrafficLights1",
|
|
@@ -2369,7 +2449,7 @@ const iconGroup = [
|
|
|
2369
2449
|
]
|
|
2370
2450
|
},
|
|
2371
2451
|
{
|
|
2372
|
-
title: "
|
|
2452
|
+
title: "sheets-conditional-formatting.iconSet.mark",
|
|
2373
2453
|
group: [
|
|
2374
2454
|
{
|
|
2375
2455
|
name: "3Symbols",
|
|
@@ -2398,7 +2478,7 @@ const iconGroup = [
|
|
|
2398
2478
|
]
|
|
2399
2479
|
},
|
|
2400
2480
|
{
|
|
2401
|
-
title: "
|
|
2481
|
+
title: "sheets-conditional-formatting.iconSet.rank",
|
|
2402
2482
|
group: [
|
|
2403
2483
|
{
|
|
2404
2484
|
name: "4Rating",
|
|
@@ -2473,7 +2553,7 @@ for (const key in iconMap) {
|
|
|
2473
2553
|
//#endregion
|
|
2474
2554
|
//#region package.json
|
|
2475
2555
|
var name = "@univerjs/sheets-conditional-formatting";
|
|
2476
|
-
var version = "0.
|
|
2556
|
+
var version = "0.25.0-insiders.20260608-e4336f7";
|
|
2477
2557
|
|
|
2478
2558
|
//#endregion
|
|
2479
2559
|
//#region src/config/config.ts
|
|
@@ -2497,10 +2577,34 @@ const configSymbol = Symbol(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY);
|
|
|
2497
2577
|
const defaultPluginConfig = {};
|
|
2498
2578
|
|
|
2499
2579
|
//#endregion
|
|
2500
|
-
//#region src/services/conditional-formatting.service.ts
|
|
2501
|
-
let
|
|
2502
|
-
|
|
2503
|
-
|
|
2580
|
+
//#region src/services/conditional-formatting-style-composer.service.ts
|
|
2581
|
+
let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleComposer {
|
|
2582
|
+
constructor(_conditionalFormattingRuleModel, _conditionalFormattingViewModel) {
|
|
2583
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
2584
|
+
this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
|
|
2585
|
+
}
|
|
2586
|
+
composeStyle(unitId, subUnitId, row, col) {
|
|
2587
|
+
const cellCfs = this._conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
|
|
2588
|
+
if (!(cellCfs === null || cellCfs === void 0 ? void 0 : cellCfs.length)) return null;
|
|
2589
|
+
const matchedRules = [];
|
|
2590
|
+
let stopIfTrueIndex = -1;
|
|
2591
|
+
for (const cacheItem of cellCfs) {
|
|
2592
|
+
const rule = this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cacheItem.cfId);
|
|
2593
|
+
if (!rule) continue;
|
|
2594
|
+
matchedRules.push({
|
|
2595
|
+
rule,
|
|
2596
|
+
cacheItem
|
|
2597
|
+
});
|
|
2598
|
+
if (stopIfTrueIndex === -1 && rule.stopIfTrue && this._isRuleMatched(rule, cacheItem.result)) stopIfTrueIndex = matchedRules.length - 1;
|
|
2599
|
+
}
|
|
2600
|
+
if (!matchedRules.length) return null;
|
|
2601
|
+
const effectiveRules = stopIfTrueIndex > -1 ? matchedRules.slice(0, stopIfTrueIndex + 1) : matchedRules;
|
|
2602
|
+
const result = {};
|
|
2603
|
+
for (let i = effectiveRules.length - 1; i >= 0; i--) {
|
|
2604
|
+
const { rule, cacheItem } = effectiveRules[i];
|
|
2605
|
+
this._mergeComposeResult(result, rule, cacheItem.result);
|
|
2606
|
+
}
|
|
2607
|
+
return result;
|
|
2504
2608
|
}
|
|
2505
2609
|
_mergeComposeResult(result, rule, ruleResult) {
|
|
2506
2610
|
const type = rule.rule.type;
|
|
@@ -2531,9 +2635,24 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2531
2635
|
}
|
|
2532
2636
|
}
|
|
2533
2637
|
}
|
|
2534
|
-
|
|
2638
|
+
_isRuleMatched(rule, ruleResult) {
|
|
2639
|
+
if (rule.rule.type === "highlightCell") return !!ruleResult && typeof ruleResult === "object" && Object.keys(ruleResult).length > 0;
|
|
2640
|
+
return !!ruleResult;
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
ConditionalFormattingStyleComposer = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ConditionalFormattingRuleModel)), __decorateParam(1, (0, _univerjs_core.Inject)(ConditionalFormattingViewModel))], ConditionalFormattingStyleComposer);
|
|
2644
|
+
|
|
2645
|
+
//#endregion
|
|
2646
|
+
//#region src/services/conditional-formatting.service.ts
|
|
2647
|
+
let ConditionalFormattingService = class ConditionalFormattingService extends _univerjs_core.Disposable {
|
|
2648
|
+
get _conditionalFormattingViewModelV2() {
|
|
2649
|
+
return this._injector.get(ConditionalFormattingViewModel);
|
|
2650
|
+
}
|
|
2651
|
+
constructor(_conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingStyleComposer, _injector, _univerInstanceService, _resourceManagerService, _sheetInterceptorService, _commandService) {
|
|
2535
2652
|
super();
|
|
2536
2653
|
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
2654
|
+
this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
|
|
2655
|
+
this._conditionalFormattingStyleComposer = _conditionalFormattingStyleComposer;
|
|
2537
2656
|
this._injector = _injector;
|
|
2538
2657
|
this._univerInstanceService = _univerInstanceService;
|
|
2539
2658
|
this._resourceManagerService = _resourceManagerService;
|
|
@@ -2544,31 +2663,7 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2544
2663
|
this._initSheetChange();
|
|
2545
2664
|
}
|
|
2546
2665
|
composeStyle(unitId, subUnitId, row, col) {
|
|
2547
|
-
|
|
2548
|
-
if (!(cellCfs === null || cellCfs === void 0 ? void 0 : cellCfs.length)) return null;
|
|
2549
|
-
const matchedRules = [];
|
|
2550
|
-
let stopIfTrueIndex = -1;
|
|
2551
|
-
for (const cacheItem of cellCfs) {
|
|
2552
|
-
const rule = this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cacheItem.cfId);
|
|
2553
|
-
if (!rule) continue;
|
|
2554
|
-
matchedRules.push({
|
|
2555
|
-
rule,
|
|
2556
|
-
cacheItem
|
|
2557
|
-
});
|
|
2558
|
-
if (stopIfTrueIndex === -1 && rule.stopIfTrue && this._isRuleMatched(rule, cacheItem.result)) stopIfTrueIndex = matchedRules.length - 1;
|
|
2559
|
-
}
|
|
2560
|
-
if (!matchedRules.length) return null;
|
|
2561
|
-
const effectiveRules = stopIfTrueIndex > -1 ? matchedRules.slice(0, stopIfTrueIndex + 1) : matchedRules;
|
|
2562
|
-
const result = {};
|
|
2563
|
-
for (let i = effectiveRules.length - 1; i >= 0; i--) {
|
|
2564
|
-
const { rule, cacheItem } = effectiveRules[i];
|
|
2565
|
-
this._mergeComposeResult(result, rule, cacheItem.result);
|
|
2566
|
-
}
|
|
2567
|
-
return result;
|
|
2568
|
-
}
|
|
2569
|
-
_isRuleMatched(rule, ruleResult) {
|
|
2570
|
-
if (rule.rule.type === "highlightCell") return !!ruleResult && typeof ruleResult === "object" && Object.keys(ruleResult).length > 0;
|
|
2571
|
-
return !!ruleResult;
|
|
2666
|
+
return this._conditionalFormattingStyleComposer.composeStyle(unitId, subUnitId, row, col);
|
|
2572
2667
|
}
|
|
2573
2668
|
_initSnapshot() {
|
|
2574
2669
|
const toJson = (unitID) => {
|
|
@@ -2597,6 +2692,7 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2597
2692
|
parseJson: (json) => parseJson(json),
|
|
2598
2693
|
onUnLoad: (unitID) => {
|
|
2599
2694
|
this._conditionalFormattingRuleModel.deleteUnitId(unitID);
|
|
2695
|
+
this._conditionalFormattingRangeIndexModel.rebuild();
|
|
2600
2696
|
if ((0, _univerjs_core.isInternalEditorID)(unitID)) return;
|
|
2601
2697
|
this._conditionalFormattingViewModelV2.clearCache();
|
|
2602
2698
|
},
|
|
@@ -2686,29 +2782,24 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2686
2782
|
}
|
|
2687
2783
|
_initCellChange() {
|
|
2688
2784
|
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
const ruleItem = this._conditionalFormattingViewModelV2.getCellCfs(unitId, subUnitId, row, col);
|
|
2693
|
-
ruleItem === null || ruleItem === void 0 || ruleItem.forEach((item) => ruleIds.add(item.cfId));
|
|
2785
|
+
const markRulesDirtyByRanges = (unitId, subUnitId, ranges) => {
|
|
2786
|
+
this._conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges).forEach((rule) => {
|
|
2787
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2694
2788
|
});
|
|
2695
|
-
const rules = [];
|
|
2696
|
-
for (const cfId of ruleIds) {
|
|
2697
|
-
const rule = this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cfId);
|
|
2698
|
-
if (rule) rules.push(rule);
|
|
2699
|
-
}
|
|
2700
|
-
return rules;
|
|
2701
2789
|
};
|
|
2702
2790
|
switch (commandInfo.id) {
|
|
2703
2791
|
case _univerjs_sheets.SetRangeValuesMutation.id: {
|
|
2704
2792
|
const { subUnitId, unitId, cellValue } = commandInfo.params;
|
|
2705
|
-
const
|
|
2793
|
+
const ranges = [];
|
|
2706
2794
|
new _univerjs_core.ObjectMatrix(cellValue).forValue((row, col, value) => {
|
|
2707
|
-
if (value && Object.keys(value).some((key) => ["p", "v"].includes(key)))
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2795
|
+
if (value && Object.keys(value).some((key) => ["p", "v"].includes(key))) ranges.push({
|
|
2796
|
+
startRow: row,
|
|
2797
|
+
endRow: row,
|
|
2798
|
+
startColumn: col,
|
|
2799
|
+
endColumn: col
|
|
2800
|
+
});
|
|
2711
2801
|
});
|
|
2802
|
+
markRulesDirtyByRanges(unitId, subUnitId, ranges);
|
|
2712
2803
|
break;
|
|
2713
2804
|
}
|
|
2714
2805
|
case _univerjs_sheets.InsertColMutation.id:
|
|
@@ -2718,14 +2809,10 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2718
2809
|
if (!target) return;
|
|
2719
2810
|
const { worksheet, unitId, subUnitId } = target;
|
|
2720
2811
|
const { range } = params;
|
|
2721
|
-
|
|
2812
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2722
2813
|
...range,
|
|
2723
2814
|
endColumn: worksheet.getColumnCount() - 1
|
|
2724
|
-
};
|
|
2725
|
-
const allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
2726
|
-
if (allRules) allRules.filter((rule) => rule.ranges.some((ruleRange) => _univerjs_core.Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
|
|
2727
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2728
|
-
});
|
|
2815
|
+
}]);
|
|
2729
2816
|
break;
|
|
2730
2817
|
}
|
|
2731
2818
|
case _univerjs_sheets.RemoveRowMutation.id:
|
|
@@ -2735,14 +2822,10 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2735
2822
|
if (!target) return;
|
|
2736
2823
|
const { worksheet, unitId, subUnitId } = target;
|
|
2737
2824
|
const { range } = params;
|
|
2738
|
-
|
|
2825
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2739
2826
|
...range,
|
|
2740
2827
|
endRow: worksheet.getRowCount() - 1
|
|
2741
|
-
};
|
|
2742
|
-
const allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
2743
|
-
if (allRules) allRules.filter((rule) => rule.ranges.some((ruleRange) => _univerjs_core.Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
|
|
2744
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2745
|
-
});
|
|
2828
|
+
}]);
|
|
2746
2829
|
break;
|
|
2747
2830
|
}
|
|
2748
2831
|
case _univerjs_sheets.MoveRowsMutation.id: {
|
|
@@ -2751,16 +2834,12 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2751
2834
|
if (!target) return;
|
|
2752
2835
|
const { worksheet, unitId, subUnitId } = target;
|
|
2753
2836
|
const { sourceRange, targetRange } = params;
|
|
2754
|
-
|
|
2837
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2755
2838
|
startRow: Math.min(sourceRange.startRow, targetRange.startRow),
|
|
2756
2839
|
endRow: worksheet.getRowCount() - 1,
|
|
2757
2840
|
startColumn: 0,
|
|
2758
2841
|
endColumn: worksheet.getColumnCount() - 1
|
|
2759
|
-
};
|
|
2760
|
-
const allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
2761
|
-
if (allRules) allRules.filter((rule) => rule.ranges.some((ruleRange) => _univerjs_core.Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
|
|
2762
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2763
|
-
});
|
|
2842
|
+
}]);
|
|
2764
2843
|
break;
|
|
2765
2844
|
}
|
|
2766
2845
|
case _univerjs_sheets.MoveColsMutation.id: {
|
|
@@ -2769,28 +2848,27 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2769
2848
|
if (!target) return;
|
|
2770
2849
|
const { worksheet, unitId, subUnitId } = target;
|
|
2771
2850
|
const { sourceRange, targetRange } = params;
|
|
2772
|
-
|
|
2851
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2773
2852
|
startRow: 0,
|
|
2774
2853
|
endRow: worksheet.getRowCount() - 1,
|
|
2775
2854
|
startColumn: Math.min(sourceRange.startColumn, targetRange.startColumn),
|
|
2776
2855
|
endColumn: worksheet.getColumnCount() - 1
|
|
2777
|
-
};
|
|
2778
|
-
const allRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
2779
|
-
if (allRules) allRules.filter((rule) => rule.ranges.some((ruleRange) => _univerjs_core.Rectangle.intersects(ruleRange, effectRange))).forEach((rule) => {
|
|
2780
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2781
|
-
});
|
|
2856
|
+
}]);
|
|
2782
2857
|
break;
|
|
2783
2858
|
}
|
|
2784
2859
|
case _univerjs_sheets.MoveRangeMutation.id: {
|
|
2785
2860
|
const { unitId, to, from } = commandInfo.params;
|
|
2786
2861
|
const handleSubUnit = (value) => {
|
|
2787
|
-
const
|
|
2862
|
+
const ranges = [];
|
|
2788
2863
|
new _univerjs_core.ObjectMatrix(value.value).forValue((row, col) => {
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2864
|
+
ranges.push({
|
|
2865
|
+
startRow: row,
|
|
2866
|
+
endRow: row,
|
|
2867
|
+
startColumn: col,
|
|
2868
|
+
endColumn: col
|
|
2869
|
+
});
|
|
2793
2870
|
});
|
|
2871
|
+
markRulesDirtyByRanges(unitId, value.subUnitId, ranges);
|
|
2794
2872
|
};
|
|
2795
2873
|
handleSubUnit(to);
|
|
2796
2874
|
handleSubUnit(from);
|
|
@@ -2798,10 +2876,7 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2798
2876
|
}
|
|
2799
2877
|
case _univerjs_sheets.ReorderRangeMutation.id: {
|
|
2800
2878
|
const { range, unitId, subUnitId } = commandInfo.params;
|
|
2801
|
-
|
|
2802
|
-
if (allRules) allRules.filter((rule) => rule.ranges.some((ruleRange) => _univerjs_core.Rectangle.intersects(ruleRange, range))).forEach((rule) => {
|
|
2803
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2804
|
-
});
|
|
2879
|
+
markRulesDirtyByRanges(unitId, subUnitId, [range]);
|
|
2805
2880
|
break;
|
|
2806
2881
|
}
|
|
2807
2882
|
}
|
|
@@ -2810,11 +2885,13 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2810
2885
|
};
|
|
2811
2886
|
ConditionalFormattingService = __decorate([
|
|
2812
2887
|
__decorateParam(0, (0, _univerjs_core.Inject)(ConditionalFormattingRuleModel)),
|
|
2813
|
-
__decorateParam(1, (0, _univerjs_core.Inject)(
|
|
2814
|
-
__decorateParam(2, (0, _univerjs_core.Inject)(
|
|
2815
|
-
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.
|
|
2816
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(
|
|
2817
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.
|
|
2888
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(ConditionalFormattingRangeIndexModel)),
|
|
2889
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(ConditionalFormattingStyleComposer)),
|
|
2890
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
2891
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
2892
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.IResourceManagerService)),
|
|
2893
|
+
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetInterceptorService)),
|
|
2894
|
+
__decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService))
|
|
2818
2895
|
], ConditionalFormattingService);
|
|
2819
2896
|
|
|
2820
2897
|
//#endregion
|
|
@@ -2831,7 +2908,10 @@ let UniverSheetsConditionalFormattingPlugin = class UniverSheetsConditionalForma
|
|
|
2831
2908
|
[
|
|
2832
2909
|
[ConditionalFormattingService],
|
|
2833
2910
|
[ConditionalFormattingFormulaService],
|
|
2911
|
+
[ConditionalFormattingRangeTransformService],
|
|
2912
|
+
[ConditionalFormattingStyleComposer],
|
|
2834
2913
|
[ConditionalFormattingRuleModel],
|
|
2914
|
+
[ConditionalFormattingRangeIndexModel],
|
|
2835
2915
|
[ConditionalFormattingViewModel]
|
|
2836
2916
|
].forEach((dependency) => {
|
|
2837
2917
|
this._injector.add(dependency);
|
|
@@ -2853,7 +2933,11 @@ let UniverSheetsConditionalFormattingPlugin = class UniverSheetsConditionalForma
|
|
|
2853
2933
|
}
|
|
2854
2934
|
onStarting() {
|
|
2855
2935
|
this._injector.get(ConditionalFormattingService);
|
|
2856
|
-
(0, _univerjs_core.touchDependencies)(this._injector, [
|
|
2936
|
+
(0, _univerjs_core.touchDependencies)(this._injector, [
|
|
2937
|
+
[ConditionalFormattingService],
|
|
2938
|
+
[ConditionalFormattingRangeIndexModel],
|
|
2939
|
+
[ConditionalFormattingViewModel]
|
|
2940
|
+
]);
|
|
2857
2941
|
}
|
|
2858
2942
|
};
|
|
2859
2943
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "pluginName", SHEET_CONDITIONAL_FORMATTING_PLUGIN);
|
|
@@ -2985,6 +3069,13 @@ Object.defineProperty(exports, 'ConditionalFormattingFormulaService', {
|
|
|
2985
3069
|
}
|
|
2986
3070
|
});
|
|
2987
3071
|
exports.ConditionalFormattingIcon = ConditionalFormattingIcon;
|
|
3072
|
+
Object.defineProperty(exports, 'ConditionalFormattingRangeIndexModel', {
|
|
3073
|
+
enumerable: true,
|
|
3074
|
+
get: function () {
|
|
3075
|
+
return ConditionalFormattingRangeIndexModel;
|
|
3076
|
+
}
|
|
3077
|
+
});
|
|
3078
|
+
exports.ConditionalFormattingRangeTransformService = ConditionalFormattingRangeTransformService;
|
|
2988
3079
|
exports.ConditionalFormattingRuleModel = ConditionalFormattingRuleModel;
|
|
2989
3080
|
Object.defineProperty(exports, 'ConditionalFormattingService', {
|
|
2990
3081
|
enumerable: true,
|
|
@@ -2992,6 +3083,12 @@ Object.defineProperty(exports, 'ConditionalFormattingService', {
|
|
|
2992
3083
|
return ConditionalFormattingService;
|
|
2993
3084
|
}
|
|
2994
3085
|
});
|
|
3086
|
+
Object.defineProperty(exports, 'ConditionalFormattingStyleComposer', {
|
|
3087
|
+
enumerable: true,
|
|
3088
|
+
get: function () {
|
|
3089
|
+
return ConditionalFormattingStyleComposer;
|
|
3090
|
+
}
|
|
3091
|
+
});
|
|
2995
3092
|
Object.defineProperty(exports, 'ConditionalFormattingViewModel', {
|
|
2996
3093
|
enumerable: true,
|
|
2997
3094
|
get: function () {
|