@univerjs/sheets-conditional-formatting 1.0.0-alpha.7 → 1.0.0-alpha.8
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 +4 -51
- package/lib/cjs/index.js +19 -15
- package/lib/es/facade.js +4 -51
- package/lib/es/index.js +21 -17
- package/lib/facade.js +4 -51
- package/lib/index.js +21 -17
- package/lib/types/facade/f-range.d.ts +1 -40
- package/lib/types/facade/f-worksheet.d.ts +0 -8
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -8
package/lib/cjs/facade.js
CHANGED
|
@@ -4,7 +4,7 @@ let _univerjs_sheets_conditional_formatting = require("@univerjs/sheets-conditio
|
|
|
4
4
|
let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
|
|
5
5
|
let _univerjs_core_facade = require("@univerjs/core/facade");
|
|
6
6
|
|
|
7
|
-
//#region \0@oxc-project+runtime@0.
|
|
7
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
8
8
|
function _typeof(o) {
|
|
9
9
|
"@babel/helpers - typeof";
|
|
10
10
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -15,7 +15,7 @@ function _typeof(o) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region \0@oxc-project+runtime@0.
|
|
18
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
19
19
|
function toPrimitive(t, r) {
|
|
20
20
|
if ("object" != _typeof(t) || !t) return t;
|
|
21
21
|
var e = t[Symbol.toPrimitive];
|
|
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region \0@oxc-project+runtime@0.
|
|
31
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
32
32
|
function toPropertyKey(t) {
|
|
33
33
|
var i = toPrimitive(t, "string");
|
|
34
34
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
|
-
//#region \0@oxc-project+runtime@0.
|
|
38
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
39
39
|
function _defineProperty(e, r, t) {
|
|
40
40
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
41
41
|
value: t,
|
|
@@ -2117,50 +2117,6 @@ var FRangeSheetsConditionalFormattingMixin = class extends _univerjs_sheets_faca
|
|
|
2117
2117
|
createConditionalFormattingRule() {
|
|
2118
2118
|
return new FConditionalFormattingBuilder({ ranges: [this._range] });
|
|
2119
2119
|
}
|
|
2120
|
-
addConditionalFormattingRule(rule) {
|
|
2121
|
-
const params = {
|
|
2122
|
-
unitId: this._workbook.getUnitId(),
|
|
2123
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2124
|
-
rule
|
|
2125
|
-
};
|
|
2126
|
-
this._commandService.syncExecuteCommand(_univerjs_sheets_conditional_formatting.AddCfCommand.id, params);
|
|
2127
|
-
return this;
|
|
2128
|
-
}
|
|
2129
|
-
deleteConditionalFormattingRule(cfId) {
|
|
2130
|
-
const params = {
|
|
2131
|
-
unitId: this._workbook.getUnitId(),
|
|
2132
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2133
|
-
cfId
|
|
2134
|
-
};
|
|
2135
|
-
this._commandService.syncExecuteCommand(_univerjs_sheets_conditional_formatting.DeleteCfCommand.id, params);
|
|
2136
|
-
return this;
|
|
2137
|
-
}
|
|
2138
|
-
moveConditionalFormattingRule(cfId, toCfId, type = "after") {
|
|
2139
|
-
const params = {
|
|
2140
|
-
unitId: this._workbook.getUnitId(),
|
|
2141
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2142
|
-
start: {
|
|
2143
|
-
id: cfId,
|
|
2144
|
-
type: "self"
|
|
2145
|
-
},
|
|
2146
|
-
end: {
|
|
2147
|
-
id: toCfId,
|
|
2148
|
-
type
|
|
2149
|
-
}
|
|
2150
|
-
};
|
|
2151
|
-
this._commandService.syncExecuteCommand(_univerjs_sheets_conditional_formatting.MoveCfCommand.id, params);
|
|
2152
|
-
return this;
|
|
2153
|
-
}
|
|
2154
|
-
setConditionalFormattingRule(cfId, rule) {
|
|
2155
|
-
const params = {
|
|
2156
|
-
unitId: this._workbook.getUnitId(),
|
|
2157
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2158
|
-
rule,
|
|
2159
|
-
cfId
|
|
2160
|
-
};
|
|
2161
|
-
this._commandService.syncExecuteCommand(_univerjs_sheets_conditional_formatting.SetCfCommand.id, params);
|
|
2162
|
-
return this;
|
|
2163
|
-
}
|
|
2164
2120
|
clearConditionalFormatRules() {
|
|
2165
2121
|
const params = {
|
|
2166
2122
|
unitId: this._workbook.getUnitId(),
|
|
@@ -2182,9 +2138,6 @@ var FWorksheetConditionalFormattingMixin = class extends _univerjs_sheets_facade
|
|
|
2182
2138
|
getConditionalFormattingRules() {
|
|
2183
2139
|
return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
|
|
2184
2140
|
}
|
|
2185
|
-
createConditionalFormattingRule() {
|
|
2186
|
-
return new FConditionalFormattingBuilder();
|
|
2187
|
-
}
|
|
2188
2141
|
newConditionalFormattingRule() {
|
|
2189
2142
|
return new FConditionalFormattingBuilder();
|
|
2190
2143
|
}
|
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.140.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.140.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.140.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.140.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,
|
|
@@ -513,7 +513,7 @@ const AddCfCommand = {
|
|
|
513
513
|
};
|
|
514
514
|
|
|
515
515
|
//#endregion
|
|
516
|
-
//#region \0@oxc-project+runtime@0.
|
|
516
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
517
517
|
function __decorateParam(paramIndex, decorator) {
|
|
518
518
|
return function(target, key) {
|
|
519
519
|
decorator(target, key, paramIndex);
|
|
@@ -521,7 +521,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
//#endregion
|
|
524
|
-
//#region \0@oxc-project+runtime@0.
|
|
524
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
525
525
|
function __decorate(decorators, target, key, desc) {
|
|
526
526
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
527
527
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -633,7 +633,7 @@ var ConditionalFormattingRangeTransformService = class {
|
|
|
633
633
|
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
634
634
|
const fragments = [];
|
|
635
635
|
sourceRanges.forEach((range) => {
|
|
636
|
-
const intersect = _univerjs_core.
|
|
636
|
+
const intersect = (0, _univerjs_core.getIntersectRange)(range, sourceRange);
|
|
637
637
|
if (!intersect) return;
|
|
638
638
|
fragments.push(this.translateRange(intersect, {
|
|
639
639
|
row: targetAnchor.row - sourceRange.startRow,
|
|
@@ -710,13 +710,14 @@ const ClearRangeCfCommand = {
|
|
|
710
710
|
allRuleList.forEach((oldRule) => {
|
|
711
711
|
const newRanges = conditionalFormattingRangeTransformService.subtractRanges(oldRule.ranges, ranges);
|
|
712
712
|
if (newRanges.length) {
|
|
713
|
+
const rule = {
|
|
714
|
+
...oldRule,
|
|
715
|
+
ranges: newRanges
|
|
716
|
+
};
|
|
713
717
|
const params = {
|
|
714
718
|
unitId,
|
|
715
719
|
subUnitId,
|
|
716
|
-
rule
|
|
717
|
-
...oldRule,
|
|
718
|
-
ranges: newRanges
|
|
719
|
-
}
|
|
720
|
+
rule
|
|
720
721
|
};
|
|
721
722
|
const undo = setConditionalRuleMutationUndoFactory(accessor, params);
|
|
722
723
|
redos.push({
|
|
@@ -1682,7 +1683,10 @@ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1682
1683
|
const formulaResult = conditionalFormattingFormulaService.getFormulaResultWithCoords(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, relativeRow, relativeCol);
|
|
1683
1684
|
if (formulaResult.status === _univerjs_engine_formula.FormulaResultStatus.SUCCESS && formulaResult.result !== void 0) return isFormulaResultMatched(formulaResult.result);
|
|
1684
1685
|
const cache = preComputingResult === null || preComputingResult === void 0 ? void 0 : preComputingResult.value;
|
|
1685
|
-
if (cache)
|
|
1686
|
+
if (cache) {
|
|
1687
|
+
const value = cache.getValue(relativeRow, relativeCol);
|
|
1688
|
+
return isFormulaResultMatched(value);
|
|
1689
|
+
}
|
|
1686
1690
|
return false;
|
|
1687
1691
|
}
|
|
1688
1692
|
}
|
|
@@ -2125,7 +2129,7 @@ const getCacheStyleMatrix = (unitId, subUnitId, rule, context) => {
|
|
|
2125
2129
|
const cellCfItem = conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
|
|
2126
2130
|
if (cellCfItem) {
|
|
2127
2131
|
const item = cellCfItem.find((item) => item.cfId === rule.cfId);
|
|
2128
|
-
|
|
2132
|
+
item !== null && item !== void 0 && item.result && matrix.setValue(row, col, item.result);
|
|
2129
2133
|
}
|
|
2130
2134
|
});
|
|
2131
2135
|
});
|
|
@@ -2541,7 +2545,7 @@ for (const key in iconMap) {
|
|
|
2541
2545
|
//#endregion
|
|
2542
2546
|
//#region package.json
|
|
2543
2547
|
var name = "@univerjs/sheets-conditional-formatting";
|
|
2544
|
-
var version = "1.0.0-alpha.
|
|
2548
|
+
var version = "1.0.0-alpha.8";
|
|
2545
2549
|
|
|
2546
2550
|
//#endregion
|
|
2547
2551
|
//#region src/config/config.ts
|
|
@@ -2933,7 +2937,7 @@ _defineProperty(UniverSheetsConditionalFormattingPlugin, "packageName", name);
|
|
|
2933
2937
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "version", version);
|
|
2934
2938
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
2935
2939
|
UniverSheetsConditionalFormattingPlugin = __decorate([
|
|
2936
|
-
(0, _univerjs_core.DependentOn)(_univerjs_engine_formula.UniverFormulaEnginePlugin),
|
|
2940
|
+
(0, _univerjs_core.DependentOn)(_univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_sheets.UniverSheetsPlugin),
|
|
2937
2941
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
2938
2942
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
|
|
2939
2943
|
__decorateParam(3, _univerjs_core.IConfigService)
|
package/lib/es/facade.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AddCfCommand, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperat
|
|
|
3
3
|
import { FRange, FWorksheet } from "@univerjs/sheets/facade";
|
|
4
4
|
import { FEnum } from "@univerjs/core/facade";
|
|
5
5
|
|
|
6
|
-
//#region \0@oxc-project+runtime@0.
|
|
6
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
7
7
|
function _typeof(o) {
|
|
8
8
|
"@babel/helpers - typeof";
|
|
9
9
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -14,7 +14,7 @@ function _typeof(o) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region \0@oxc-project+runtime@0.
|
|
17
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
18
18
|
function toPrimitive(t, r) {
|
|
19
19
|
if ("object" != _typeof(t) || !t) return t;
|
|
20
20
|
var e = t[Symbol.toPrimitive];
|
|
@@ -27,14 +27,14 @@ function toPrimitive(t, r) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region \0@oxc-project+runtime@0.
|
|
30
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
31
31
|
function toPropertyKey(t) {
|
|
32
32
|
var i = toPrimitive(t, "string");
|
|
33
33
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
38
38
|
function _defineProperty(e, r, t) {
|
|
39
39
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
40
40
|
value: t,
|
|
@@ -2116,50 +2116,6 @@ var FRangeSheetsConditionalFormattingMixin = class extends FRange {
|
|
|
2116
2116
|
createConditionalFormattingRule() {
|
|
2117
2117
|
return new FConditionalFormattingBuilder({ ranges: [this._range] });
|
|
2118
2118
|
}
|
|
2119
|
-
addConditionalFormattingRule(rule) {
|
|
2120
|
-
const params = {
|
|
2121
|
-
unitId: this._workbook.getUnitId(),
|
|
2122
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2123
|
-
rule
|
|
2124
|
-
};
|
|
2125
|
-
this._commandService.syncExecuteCommand(AddCfCommand.id, params);
|
|
2126
|
-
return this;
|
|
2127
|
-
}
|
|
2128
|
-
deleteConditionalFormattingRule(cfId) {
|
|
2129
|
-
const params = {
|
|
2130
|
-
unitId: this._workbook.getUnitId(),
|
|
2131
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2132
|
-
cfId
|
|
2133
|
-
};
|
|
2134
|
-
this._commandService.syncExecuteCommand(DeleteCfCommand.id, params);
|
|
2135
|
-
return this;
|
|
2136
|
-
}
|
|
2137
|
-
moveConditionalFormattingRule(cfId, toCfId, type = "after") {
|
|
2138
|
-
const params = {
|
|
2139
|
-
unitId: this._workbook.getUnitId(),
|
|
2140
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2141
|
-
start: {
|
|
2142
|
-
id: cfId,
|
|
2143
|
-
type: "self"
|
|
2144
|
-
},
|
|
2145
|
-
end: {
|
|
2146
|
-
id: toCfId,
|
|
2147
|
-
type
|
|
2148
|
-
}
|
|
2149
|
-
};
|
|
2150
|
-
this._commandService.syncExecuteCommand(MoveCfCommand.id, params);
|
|
2151
|
-
return this;
|
|
2152
|
-
}
|
|
2153
|
-
setConditionalFormattingRule(cfId, rule) {
|
|
2154
|
-
const params = {
|
|
2155
|
-
unitId: this._workbook.getUnitId(),
|
|
2156
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2157
|
-
rule,
|
|
2158
|
-
cfId
|
|
2159
|
-
};
|
|
2160
|
-
this._commandService.syncExecuteCommand(SetCfCommand.id, params);
|
|
2161
|
-
return this;
|
|
2162
|
-
}
|
|
2163
2119
|
clearConditionalFormatRules() {
|
|
2164
2120
|
const params = {
|
|
2165
2121
|
unitId: this._workbook.getUnitId(),
|
|
@@ -2181,9 +2137,6 @@ var FWorksheetConditionalFormattingMixin = class extends FWorksheet {
|
|
|
2181
2137
|
getConditionalFormattingRules() {
|
|
2182
2138
|
return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
|
|
2183
2139
|
}
|
|
2184
|
-
createConditionalFormattingRule() {
|
|
2185
|
-
return new FConditionalFormattingBuilder();
|
|
2186
|
-
}
|
|
2187
2140
|
newConditionalFormattingRule() {
|
|
2188
2141
|
return new FConditionalFormattingBuilder();
|
|
2189
2142
|
}
|
package/lib/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BooleanNumber, CellValueType, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, generateRandomId, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@univerjs/core";
|
|
2
|
-
import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, ReorderRangeMutation, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, getSheetCommandTarget } from "@univerjs/sheets";
|
|
1
|
+
import { BooleanNumber, CellValueType, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, generateRandomId, getIntersectRange, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@univerjs/core";
|
|
2
|
+
import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, ReorderRangeMutation, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget } from "@univerjs/sheets";
|
|
3
3
|
import { BehaviorSubject, Subject } from "rxjs";
|
|
4
4
|
import { BooleanValue, ERROR_TYPE_SET, FormulaResultStatus, OtherFormulaBizType, RegisterOtherFormulaService, UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
|
|
5
5
|
import { bufferTime, distinctUntilChanged, filter, map } from "rxjs/operators";
|
|
@@ -220,7 +220,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
220
220
|
const createCfId = () => `${generateRandomId(8)}`;
|
|
221
221
|
|
|
222
222
|
//#endregion
|
|
223
|
-
//#region \0@oxc-project+runtime@0.
|
|
223
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
224
224
|
function _typeof(o) {
|
|
225
225
|
"@babel/helpers - typeof";
|
|
226
226
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -231,7 +231,7 @@ function _typeof(o) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
//#endregion
|
|
234
|
-
//#region \0@oxc-project+runtime@0.
|
|
234
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
235
235
|
function toPrimitive(t, r) {
|
|
236
236
|
if ("object" != _typeof(t) || !t) return t;
|
|
237
237
|
var e = t[Symbol.toPrimitive];
|
|
@@ -244,14 +244,14 @@ function toPrimitive(t, r) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
//#endregion
|
|
247
|
-
//#region \0@oxc-project+runtime@0.
|
|
247
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
248
248
|
function toPropertyKey(t) {
|
|
249
249
|
var i = toPrimitive(t, "string");
|
|
250
250
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
//#endregion
|
|
254
|
-
//#region \0@oxc-project+runtime@0.
|
|
254
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
255
255
|
function _defineProperty(e, r, t) {
|
|
256
256
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
257
257
|
value: t,
|
|
@@ -512,7 +512,7 @@ const AddCfCommand = {
|
|
|
512
512
|
};
|
|
513
513
|
|
|
514
514
|
//#endregion
|
|
515
|
-
//#region \0@oxc-project+runtime@0.
|
|
515
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
516
516
|
function __decorateParam(paramIndex, decorator) {
|
|
517
517
|
return function(target, key) {
|
|
518
518
|
decorator(target, key, paramIndex);
|
|
@@ -520,7 +520,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
//#endregion
|
|
523
|
-
//#region \0@oxc-project+runtime@0.
|
|
523
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
524
524
|
function __decorate(decorators, target, key, desc) {
|
|
525
525
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
526
526
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -632,7 +632,7 @@ var ConditionalFormattingRangeTransformService = class {
|
|
|
632
632
|
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
633
633
|
const fragments = [];
|
|
634
634
|
sourceRanges.forEach((range) => {
|
|
635
|
-
const intersect =
|
|
635
|
+
const intersect = getIntersectRange(range, sourceRange);
|
|
636
636
|
if (!intersect) return;
|
|
637
637
|
fragments.push(this.translateRange(intersect, {
|
|
638
638
|
row: targetAnchor.row - sourceRange.startRow,
|
|
@@ -709,13 +709,14 @@ const ClearRangeCfCommand = {
|
|
|
709
709
|
allRuleList.forEach((oldRule) => {
|
|
710
710
|
const newRanges = conditionalFormattingRangeTransformService.subtractRanges(oldRule.ranges, ranges);
|
|
711
711
|
if (newRanges.length) {
|
|
712
|
+
const rule = {
|
|
713
|
+
...oldRule,
|
|
714
|
+
ranges: newRanges
|
|
715
|
+
};
|
|
712
716
|
const params = {
|
|
713
717
|
unitId,
|
|
714
718
|
subUnitId,
|
|
715
|
-
rule
|
|
716
|
-
...oldRule,
|
|
717
|
-
ranges: newRanges
|
|
718
|
-
}
|
|
719
|
+
rule
|
|
719
720
|
};
|
|
720
721
|
const undo = setConditionalRuleMutationUndoFactory(accessor, params);
|
|
721
722
|
redos.push({
|
|
@@ -1681,7 +1682,10 @@ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1681
1682
|
const formulaResult = conditionalFormattingFormulaService.getFormulaResultWithCoords(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, relativeRow, relativeCol);
|
|
1682
1683
|
if (formulaResult.status === FormulaResultStatus.SUCCESS && formulaResult.result !== void 0) return isFormulaResultMatched(formulaResult.result);
|
|
1683
1684
|
const cache = preComputingResult === null || preComputingResult === void 0 ? void 0 : preComputingResult.value;
|
|
1684
|
-
if (cache)
|
|
1685
|
+
if (cache) {
|
|
1686
|
+
const value = cache.getValue(relativeRow, relativeCol);
|
|
1687
|
+
return isFormulaResultMatched(value);
|
|
1688
|
+
}
|
|
1685
1689
|
return false;
|
|
1686
1690
|
}
|
|
1687
1691
|
}
|
|
@@ -2124,7 +2128,7 @@ const getCacheStyleMatrix = (unitId, subUnitId, rule, context) => {
|
|
|
2124
2128
|
const cellCfItem = conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
|
|
2125
2129
|
if (cellCfItem) {
|
|
2126
2130
|
const item = cellCfItem.find((item) => item.cfId === rule.cfId);
|
|
2127
|
-
|
|
2131
|
+
item !== null && item !== void 0 && item.result && matrix.setValue(row, col, item.result);
|
|
2128
2132
|
}
|
|
2129
2133
|
});
|
|
2130
2134
|
});
|
|
@@ -2540,7 +2544,7 @@ for (const key in iconMap) {
|
|
|
2540
2544
|
//#endregion
|
|
2541
2545
|
//#region package.json
|
|
2542
2546
|
var name = "@univerjs/sheets-conditional-formatting";
|
|
2543
|
-
var version = "1.0.0-alpha.
|
|
2547
|
+
var version = "1.0.0-alpha.8";
|
|
2544
2548
|
|
|
2545
2549
|
//#endregion
|
|
2546
2550
|
//#region src/config/config.ts
|
|
@@ -2932,7 +2936,7 @@ _defineProperty(UniverSheetsConditionalFormattingPlugin, "packageName", name);
|
|
|
2932
2936
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "version", version);
|
|
2933
2937
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
2934
2938
|
UniverSheetsConditionalFormattingPlugin = __decorate([
|
|
2935
|
-
DependentOn(UniverFormulaEnginePlugin),
|
|
2939
|
+
DependentOn(UniverFormulaEnginePlugin, UniverSheetsPlugin),
|
|
2936
2940
|
__decorateParam(1, Inject(Injector)),
|
|
2937
2941
|
__decorateParam(2, Inject(ICommandService)),
|
|
2938
2942
|
__decorateParam(3, IConfigService)
|
package/lib/facade.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AddCfCommand, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperat
|
|
|
3
3
|
import { FRange, FWorksheet } from "@univerjs/sheets/facade";
|
|
4
4
|
import { FEnum } from "@univerjs/core/facade";
|
|
5
5
|
|
|
6
|
-
//#region \0@oxc-project+runtime@0.
|
|
6
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
7
7
|
function _typeof(o) {
|
|
8
8
|
"@babel/helpers - typeof";
|
|
9
9
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -14,7 +14,7 @@ function _typeof(o) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region \0@oxc-project+runtime@0.
|
|
17
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
18
18
|
function toPrimitive(t, r) {
|
|
19
19
|
if ("object" != _typeof(t) || !t) return t;
|
|
20
20
|
var e = t[Symbol.toPrimitive];
|
|
@@ -27,14 +27,14 @@ function toPrimitive(t, r) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region \0@oxc-project+runtime@0.
|
|
30
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
31
31
|
function toPropertyKey(t) {
|
|
32
32
|
var i = toPrimitive(t, "string");
|
|
33
33
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
38
38
|
function _defineProperty(e, r, t) {
|
|
39
39
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
40
40
|
value: t,
|
|
@@ -2116,50 +2116,6 @@ var FRangeSheetsConditionalFormattingMixin = class extends FRange {
|
|
|
2116
2116
|
createConditionalFormattingRule() {
|
|
2117
2117
|
return new FConditionalFormattingBuilder({ ranges: [this._range] });
|
|
2118
2118
|
}
|
|
2119
|
-
addConditionalFormattingRule(rule) {
|
|
2120
|
-
const params = {
|
|
2121
|
-
unitId: this._workbook.getUnitId(),
|
|
2122
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2123
|
-
rule
|
|
2124
|
-
};
|
|
2125
|
-
this._commandService.syncExecuteCommand(AddCfCommand.id, params);
|
|
2126
|
-
return this;
|
|
2127
|
-
}
|
|
2128
|
-
deleteConditionalFormattingRule(cfId) {
|
|
2129
|
-
const params = {
|
|
2130
|
-
unitId: this._workbook.getUnitId(),
|
|
2131
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2132
|
-
cfId
|
|
2133
|
-
};
|
|
2134
|
-
this._commandService.syncExecuteCommand(DeleteCfCommand.id, params);
|
|
2135
|
-
return this;
|
|
2136
|
-
}
|
|
2137
|
-
moveConditionalFormattingRule(cfId, toCfId, type = "after") {
|
|
2138
|
-
const params = {
|
|
2139
|
-
unitId: this._workbook.getUnitId(),
|
|
2140
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2141
|
-
start: {
|
|
2142
|
-
id: cfId,
|
|
2143
|
-
type: "self"
|
|
2144
|
-
},
|
|
2145
|
-
end: {
|
|
2146
|
-
id: toCfId,
|
|
2147
|
-
type
|
|
2148
|
-
}
|
|
2149
|
-
};
|
|
2150
|
-
this._commandService.syncExecuteCommand(MoveCfCommand.id, params);
|
|
2151
|
-
return this;
|
|
2152
|
-
}
|
|
2153
|
-
setConditionalFormattingRule(cfId, rule) {
|
|
2154
|
-
const params = {
|
|
2155
|
-
unitId: this._workbook.getUnitId(),
|
|
2156
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
2157
|
-
rule,
|
|
2158
|
-
cfId
|
|
2159
|
-
};
|
|
2160
|
-
this._commandService.syncExecuteCommand(SetCfCommand.id, params);
|
|
2161
|
-
return this;
|
|
2162
|
-
}
|
|
2163
2119
|
clearConditionalFormatRules() {
|
|
2164
2120
|
const params = {
|
|
2165
2121
|
unitId: this._workbook.getUnitId(),
|
|
@@ -2181,9 +2137,6 @@ var FWorksheetConditionalFormattingMixin = class extends FWorksheet {
|
|
|
2181
2137
|
getConditionalFormattingRules() {
|
|
2182
2138
|
return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
|
|
2183
2139
|
}
|
|
2184
|
-
createConditionalFormattingRule() {
|
|
2185
|
-
return new FConditionalFormattingBuilder();
|
|
2186
|
-
}
|
|
2187
2140
|
newConditionalFormattingRule() {
|
|
2188
2141
|
return new FConditionalFormattingBuilder();
|
|
2189
2142
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BooleanNumber, CellValueType, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, generateRandomId, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@univerjs/core";
|
|
2
|
-
import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, ReorderRangeMutation, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, getSheetCommandTarget } from "@univerjs/sheets";
|
|
1
|
+
import { BooleanNumber, CellValueType, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, generateRandomId, getIntersectRange, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@univerjs/core";
|
|
2
|
+
import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, ReorderRangeMutation, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget } from "@univerjs/sheets";
|
|
3
3
|
import { BehaviorSubject, Subject } from "rxjs";
|
|
4
4
|
import { BooleanValue, ERROR_TYPE_SET, FormulaResultStatus, OtherFormulaBizType, RegisterOtherFormulaService, UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
|
|
5
5
|
import { bufferTime, distinctUntilChanged, filter, map } from "rxjs/operators";
|
|
@@ -220,7 +220,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
220
220
|
const createCfId = () => `${generateRandomId(8)}`;
|
|
221
221
|
|
|
222
222
|
//#endregion
|
|
223
|
-
//#region \0@oxc-project+runtime@0.
|
|
223
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
224
224
|
function _typeof(o) {
|
|
225
225
|
"@babel/helpers - typeof";
|
|
226
226
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -231,7 +231,7 @@ function _typeof(o) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
//#endregion
|
|
234
|
-
//#region \0@oxc-project+runtime@0.
|
|
234
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
235
235
|
function toPrimitive(t, r) {
|
|
236
236
|
if ("object" != _typeof(t) || !t) return t;
|
|
237
237
|
var e = t[Symbol.toPrimitive];
|
|
@@ -244,14 +244,14 @@ function toPrimitive(t, r) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
//#endregion
|
|
247
|
-
//#region \0@oxc-project+runtime@0.
|
|
247
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
248
248
|
function toPropertyKey(t) {
|
|
249
249
|
var i = toPrimitive(t, "string");
|
|
250
250
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
//#endregion
|
|
254
|
-
//#region \0@oxc-project+runtime@0.
|
|
254
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
255
255
|
function _defineProperty(e, r, t) {
|
|
256
256
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
257
257
|
value: t,
|
|
@@ -512,7 +512,7 @@ const AddCfCommand = {
|
|
|
512
512
|
};
|
|
513
513
|
|
|
514
514
|
//#endregion
|
|
515
|
-
//#region \0@oxc-project+runtime@0.
|
|
515
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
516
516
|
function __decorateParam(paramIndex, decorator) {
|
|
517
517
|
return function(target, key) {
|
|
518
518
|
decorator(target, key, paramIndex);
|
|
@@ -520,7 +520,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
//#endregion
|
|
523
|
-
//#region \0@oxc-project+runtime@0.
|
|
523
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
524
524
|
function __decorate(decorators, target, key, desc) {
|
|
525
525
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
526
526
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -632,7 +632,7 @@ var ConditionalFormattingRangeTransformService = class {
|
|
|
632
632
|
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
633
633
|
const fragments = [];
|
|
634
634
|
sourceRanges.forEach((range) => {
|
|
635
|
-
const intersect =
|
|
635
|
+
const intersect = getIntersectRange(range, sourceRange);
|
|
636
636
|
if (!intersect) return;
|
|
637
637
|
fragments.push(this.translateRange(intersect, {
|
|
638
638
|
row: targetAnchor.row - sourceRange.startRow,
|
|
@@ -709,13 +709,14 @@ const ClearRangeCfCommand = {
|
|
|
709
709
|
allRuleList.forEach((oldRule) => {
|
|
710
710
|
const newRanges = conditionalFormattingRangeTransformService.subtractRanges(oldRule.ranges, ranges);
|
|
711
711
|
if (newRanges.length) {
|
|
712
|
+
const rule = {
|
|
713
|
+
...oldRule,
|
|
714
|
+
ranges: newRanges
|
|
715
|
+
};
|
|
712
716
|
const params = {
|
|
713
717
|
unitId,
|
|
714
718
|
subUnitId,
|
|
715
|
-
rule
|
|
716
|
-
...oldRule,
|
|
717
|
-
ranges: newRanges
|
|
718
|
-
}
|
|
719
|
+
rule
|
|
719
720
|
};
|
|
720
721
|
const undo = setConditionalRuleMutationUndoFactory(accessor, params);
|
|
721
722
|
redos.push({
|
|
@@ -1681,7 +1682,10 @@ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1681
1682
|
const formulaResult = conditionalFormattingFormulaService.getFormulaResultWithCoords(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, relativeRow, relativeCol);
|
|
1682
1683
|
if (formulaResult.status === FormulaResultStatus.SUCCESS && formulaResult.result !== void 0) return isFormulaResultMatched(formulaResult.result);
|
|
1683
1684
|
const cache = preComputingResult === null || preComputingResult === void 0 ? void 0 : preComputingResult.value;
|
|
1684
|
-
if (cache)
|
|
1685
|
+
if (cache) {
|
|
1686
|
+
const value = cache.getValue(relativeRow, relativeCol);
|
|
1687
|
+
return isFormulaResultMatched(value);
|
|
1688
|
+
}
|
|
1685
1689
|
return false;
|
|
1686
1690
|
}
|
|
1687
1691
|
}
|
|
@@ -2124,7 +2128,7 @@ const getCacheStyleMatrix = (unitId, subUnitId, rule, context) => {
|
|
|
2124
2128
|
const cellCfItem = conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
|
|
2125
2129
|
if (cellCfItem) {
|
|
2126
2130
|
const item = cellCfItem.find((item) => item.cfId === rule.cfId);
|
|
2127
|
-
|
|
2131
|
+
item !== null && item !== void 0 && item.result && matrix.setValue(row, col, item.result);
|
|
2128
2132
|
}
|
|
2129
2133
|
});
|
|
2130
2134
|
});
|
|
@@ -2540,7 +2544,7 @@ for (const key in iconMap) {
|
|
|
2540
2544
|
//#endregion
|
|
2541
2545
|
//#region package.json
|
|
2542
2546
|
var name = "@univerjs/sheets-conditional-formatting";
|
|
2543
|
-
var version = "1.0.0-alpha.
|
|
2547
|
+
var version = "1.0.0-alpha.8";
|
|
2544
2548
|
|
|
2545
2549
|
//#endregion
|
|
2546
2550
|
//#region src/config/config.ts
|
|
@@ -2932,7 +2936,7 @@ _defineProperty(UniverSheetsConditionalFormattingPlugin, "packageName", name);
|
|
|
2932
2936
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "version", version);
|
|
2933
2937
|
_defineProperty(UniverSheetsConditionalFormattingPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
2934
2938
|
UniverSheetsConditionalFormattingPlugin = __decorate([
|
|
2935
|
-
DependentOn(UniverFormulaEnginePlugin),
|
|
2939
|
+
DependentOn(UniverFormulaEnginePlugin, UniverSheetsPlugin),
|
|
2936
2940
|
__decorateParam(1, Inject(Injector)),
|
|
2937
2941
|
__decorateParam(2, Inject(ICommandService)),
|
|
2938
2942
|
__decorateParam(3, IConfigService)
|