@univerjs/sheets-conditional-formatting 0.2.4 → 0.2.5
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 +1 -1
- package/lib/es/index.js +31 -32
- package/lib/types/commands/mutations/add-conditional-rule.mutation.d.ts +1 -2
- package/lib/types/commands/mutations/delete-conditional-rule.mutation.d.ts +1 -2
- package/lib/types/commands/mutations/set-conditional-rule.mutation.d.ts +1 -2
- package/lib/types/models/conditional-formatting-rule-model.d.ts +1 -1
- package/lib/types/plugin.d.ts +1 -2
- package/lib/types/services/__test__/test.util.d.ts +7 -8
- package/lib/types/services/calculate-unit/type.d.ts +1 -2
- package/lib/types/services/conditional-formatting-formula.service.d.ts +1 -2
- package/lib/types/services/conditional-formatting.service.d.ts +1 -2
- package/lib/umd/index.js +1 -1
- package/package.json +10 -12
package/lib/es/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
var OA = Object.defineProperty;
|
|
2
2
|
var hA = (f, v, e) => v in f ? OA(f, v, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[v] = e;
|
|
3
3
|
var D = (f, v, e) => hA(f, typeof v != "symbol" ? v + "" : v, e);
|
|
4
|
-
import { Tools as _, ObjectMatrix as Y, Range as W, CommandType as eA, ICommandService as BA, Disposable as EA, toDisposable as jA, RefAlias as UA, CellValueType as c, BooleanNumber as JA, ColorKit as iA, Rectangle as R, createInterceptorKey as RA, OnLifecycle as MA, LifecycleStages as VA, IUniverInstanceService as bA, IResourceManagerService as FA, InterceptorManager as IA, UniverInstanceType as
|
|
5
|
-
import { Inject as J, Injector as LA } from "@wendellhu/redi";
|
|
4
|
+
import { Tools as _, ObjectMatrix as Y, Range as W, Inject as J, Injector as XA, CommandType as eA, ICommandService as BA, Disposable as EA, toDisposable as jA, RefAlias as UA, CellValueType as c, BooleanNumber as JA, ColorKit as iA, Rectangle as R, createInterceptorKey as RA, OnLifecycle as MA, LifecycleStages as VA, IUniverInstanceService as bA, IResourceManagerService as FA, InterceptorManager as IA, UniverInstanceType as LA, Plugin as zA } from "@univerjs/core";
|
|
6
5
|
import { SheetInterceptorService as qA, RemoveSheetCommand as KA, ReorderRangeMutation as yA, MoveRangeMutation as xA, MoveColsMutation as GA, MoveRowsMutation as _A, InsertRowMutation as $A, RemoveRowMutation as Av, RemoveColMutation as vv, InsertColMutation as ev, SetRangeValuesMutation as Zv } from "@univerjs/sheets";
|
|
7
6
|
import { Subject as vA } from "rxjs";
|
|
8
7
|
import { bufferTime as aA, filter as PA, map as sA } from "rxjs/operators";
|
|
@@ -11,7 +10,7 @@ import E from "dayjs";
|
|
|
11
10
|
import { isObject as tv, SpreadsheetExtensionRegistry as oA, SheetExtension as gA, FIX_ONE_PIXEL_BLUR_OFFSET as kv } from "@univerjs/engine-render";
|
|
12
11
|
const cA = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
|
|
13
12
|
var o = /* @__PURE__ */ ((f) => (f.beginsWith = "beginsWith", f.endsWith = "endsWith", f.containsText = "containsText", f.notContainsText = "notContainsText", f.equal = "equal", f.notEqual = "notEqual", f.containsBlanks = "containsBlanks", f.notContainsBlanks = "notContainsBlanks", f.containsErrors = "containsErrors", f.notContainsErrors = "notContainsErrors", f))(o || {}), g = /* @__PURE__ */ ((f) => (f.today = "today", f.yesterday = "yesterday", f.tomorrow = "tomorrow", f.last7Days = "last7Days", f.thisMonth = "thisMonth", f.lastMonth = "lastMonth", f.nextMonth = "nextMonth", f.thisWeek = "thisWeek", f.lastWeek = "lastWeek", f.nextWeek = "nextWeek", f))(g || {}), H = /* @__PURE__ */ ((f) => (f.greaterThan = "greaterThan", f.greaterThanOrEqual = "greaterThanOrEqual", f.lessThan = "lessThan", f.lessThanOrEqual = "lessThanOrEqual", f.notBetween = "notBetween", f.between = "between", f.equal = "equal", f.notEqual = "notEqual", f))(H || {}), j = /* @__PURE__ */ ((f) => (f.highlightCell = "highlightCell", f.dataBar = "dataBar", f.colorScale = "colorScale", f.iconSet = "iconSet", f))(j || {}), a = /* @__PURE__ */ ((f) => (f.uniqueValues = "uniqueValues", f.duplicateValues = "duplicateValues", f.rank = "rank", f.text = "text", f.timePeriod = "timePeriod", f.number = "number", f.average = "average", f.formula = "formula", f))(a || {}), z = /* @__PURE__ */ ((f) => (f.num = "num", f.min = "min", f.max = "max", f.percent = "percent", f.percentile = "percentile", f.formula = "formula", f))(z || {});
|
|
14
|
-
const
|
|
13
|
+
const ue = "#fff", De = "#000000", re = () => ({
|
|
15
14
|
cfId: void 0,
|
|
16
15
|
ranges: [],
|
|
17
16
|
stopIfTrue: !1,
|
|
@@ -21,7 +20,7 @@ const De = "#fff", re = "#000000", He = () => ({
|
|
|
21
20
|
operator: "containsText"
|
|
22
21
|
/* containsText */
|
|
23
22
|
}
|
|
24
|
-
}),
|
|
23
|
+
}), He = (f, v) => {
|
|
25
24
|
switch (f) {
|
|
26
25
|
case "text": {
|
|
27
26
|
if ([
|
|
@@ -44,7 +43,7 @@ const De = "#fff", re = "#000000", He = () => ({
|
|
|
44
43
|
].includes(v) ? [10, 100] : 10;
|
|
45
44
|
}
|
|
46
45
|
return "";
|
|
47
|
-
},
|
|
46
|
+
}, Qe = (f, v) => {
|
|
48
47
|
switch (f) {
|
|
49
48
|
case "formula":
|
|
50
49
|
return "=";
|
|
@@ -133,7 +132,7 @@ const De = "#fff", re = "#000000", He = () => ({
|
|
|
133
132
|
return [v, { ...f, type: "self" }];
|
|
134
133
|
}
|
|
135
134
|
return null;
|
|
136
|
-
},
|
|
135
|
+
}, We = (f, v) => f.id === v.id && f.type === v.type;
|
|
137
136
|
class ZA {
|
|
138
137
|
constructor() {
|
|
139
138
|
// Map<unitID ,<sheetId ,ObjectMatrix>>
|
|
@@ -321,9 +320,9 @@ let O = class {
|
|
|
321
320
|
};
|
|
322
321
|
O = Dv([
|
|
323
322
|
HA(0, J(ZA)),
|
|
324
|
-
HA(1, J(
|
|
323
|
+
HA(1, J(XA))
|
|
325
324
|
], O);
|
|
326
|
-
const
|
|
325
|
+
const Ee = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subUnitId, cfId: v.rule.cfId } }), CA = {
|
|
327
326
|
type: eA.MUTATION,
|
|
328
327
|
id: "sheet.mutation.add-conditional-rule",
|
|
329
328
|
handler(f, v) {
|
|
@@ -341,7 +340,7 @@ const Je = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subU
|
|
|
341
340
|
const { unitId: e, subUnitId: A, start: Z, end: n } = v;
|
|
342
341
|
return f.get(O).moveRulePriority(e, A, Z, n), !0;
|
|
343
342
|
}
|
|
344
|
-
},
|
|
343
|
+
}, Je = (f) => {
|
|
345
344
|
const { unitId: v, subUnitId: e } = f, A = dv(f.start, f.end);
|
|
346
345
|
if (!A)
|
|
347
346
|
return [];
|
|
@@ -558,7 +557,7 @@ let M = class extends EA {
|
|
|
558
557
|
};
|
|
559
558
|
M = Wv([
|
|
560
559
|
$(0, J(BA)),
|
|
561
|
-
$(1, J(
|
|
560
|
+
$(1, J(XA)),
|
|
562
561
|
$(2, J(fv)),
|
|
563
562
|
$(3, J(ZA)),
|
|
564
563
|
$(4, J(O))
|
|
@@ -651,7 +650,7 @@ const iv = (f) => {
|
|
|
651
650
|
};
|
|
652
651
|
}
|
|
653
652
|
}
|
|
654
|
-
},
|
|
653
|
+
}, ie = (f, v, e, A) => {
|
|
655
654
|
const { accessor: Z } = A, n = Z.get(ZA), m = new Y();
|
|
656
655
|
return e.ranges.forEach((T) => {
|
|
657
656
|
W.foreach(T, (l, S) => {
|
|
@@ -1175,7 +1174,7 @@ let G = class extends EA {
|
|
|
1175
1174
|
this.disposeWithMe(
|
|
1176
1175
|
this._resourceManagerService.registerPluginResource({
|
|
1177
1176
|
pluginName: cA,
|
|
1178
|
-
businesses: [
|
|
1177
|
+
businesses: [LA.UNIVER_SHEET],
|
|
1179
1178
|
toJson: (A) => v(A),
|
|
1180
1179
|
parseJson: (A) => e(A),
|
|
1181
1180
|
onUnLoad: (A) => {
|
|
@@ -1361,16 +1360,16 @@ let G = class extends EA {
|
|
|
1361
1360
|
G = jv([
|
|
1362
1361
|
MA(VA.Starting, G),
|
|
1363
1362
|
I(0, J(O)),
|
|
1364
|
-
I(1, J(
|
|
1363
|
+
I(1, J(XA)),
|
|
1365
1364
|
I(2, J(ZA)),
|
|
1366
1365
|
I(3, J(bA)),
|
|
1367
1366
|
I(4, J(FA)),
|
|
1368
1367
|
I(5, J(qA)),
|
|
1369
1368
|
I(6, J(BA))
|
|
1370
1369
|
], G);
|
|
1371
|
-
const Rv = (f) => f.getCurrentUnitForType(
|
|
1370
|
+
const Rv = (f) => f.getCurrentUnitForType(LA.UNIVER_SHEET).getUnitId(), Mv = (f) => {
|
|
1372
1371
|
var v;
|
|
1373
|
-
return (v = f.getCurrentUnitForType(
|
|
1372
|
+
return (v = f.getCurrentUnitForType(LA.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : v.getSheetId();
|
|
1374
1373
|
}, YA = {
|
|
1375
1374
|
type: eA.MUTATION,
|
|
1376
1375
|
id: "sheet.mutation.set-conditional-rule",
|
|
@@ -1380,7 +1379,7 @@ const Rv = (f) => f.getCurrentUnitForType(XA.UNIVER_SHEET).getUnitId(), Mv = (f)
|
|
|
1380
1379
|
const { unitId: e, subUnitId: A, rule: Z } = v, n = v.cfId || v.rule.cfId;
|
|
1381
1380
|
return f.get(O).setRule(e, A, Z, n), !0;
|
|
1382
1381
|
}
|
|
1383
|
-
},
|
|
1382
|
+
}, ae = (f, v) => {
|
|
1384
1383
|
const e = f.get(O), { unitId: A, subUnitId: Z } = v, n = v.cfId || v.rule.cfId, m = e.getRule(A, Z, n);
|
|
1385
1384
|
return m ? [
|
|
1386
1385
|
{
|
|
@@ -1421,15 +1420,15 @@ let WA = (mA = class extends zA {
|
|
|
1421
1420
|
this._commandService.registerCommand(f);
|
|
1422
1421
|
});
|
|
1423
1422
|
}
|
|
1424
|
-
}, D(mA, "pluginName", cA), D(mA, "type",
|
|
1423
|
+
}, D(mA, "pluginName", cA), D(mA, "type", LA.UNIVER_SHEET), mA);
|
|
1425
1424
|
WA = Fv([
|
|
1426
|
-
QA(1, J(
|
|
1425
|
+
QA(1, J(XA)),
|
|
1427
1426
|
QA(2, J(BA))
|
|
1428
1427
|
], WA);
|
|
1429
|
-
const
|
|
1428
|
+
const se = (f) => {
|
|
1430
1429
|
var e;
|
|
1431
1430
|
return ((e = f.body) == null ? void 0 : e.dataStream.replace(/\r\n$/, "")) || "";
|
|
1432
|
-
},
|
|
1431
|
+
}, oe = (f, v) => v.length === f.length && !f.some((e) => v.some((A) => !R.equals(A, e)));
|
|
1433
1432
|
function Iv(f) {
|
|
1434
1433
|
if (typeof f != "object" || f === null)
|
|
1435
1434
|
return f;
|
|
@@ -1715,7 +1714,7 @@ class Xe extends gA {
|
|
|
1715
1714
|
oA.add(Xe);
|
|
1716
1715
|
export {
|
|
1717
1716
|
CA as AddConditionalRuleMutation,
|
|
1718
|
-
|
|
1717
|
+
Ee as AddConditionalRuleMutationUndoFactory,
|
|
1719
1718
|
H as CFNumberOperator,
|
|
1720
1719
|
j as CFRuleType,
|
|
1721
1720
|
a as CFSubRuleType,
|
|
@@ -1728,8 +1727,8 @@ export {
|
|
|
1728
1727
|
O as ConditionalFormattingRuleModel,
|
|
1729
1728
|
G as ConditionalFormattingService,
|
|
1730
1729
|
ZA as ConditionalFormattingViewModel,
|
|
1731
|
-
|
|
1732
|
-
|
|
1730
|
+
ue as DEFAULT_BG_COLOR,
|
|
1731
|
+
De as DEFAULT_FONT_COLOR,
|
|
1733
1732
|
Ne as DEFAULT_PADDING,
|
|
1734
1733
|
le as DEFAULT_WIDTH,
|
|
1735
1734
|
Kv as DataBar,
|
|
@@ -1740,35 +1739,35 @@ export {
|
|
|
1740
1739
|
s as FormulaResultStatus,
|
|
1741
1740
|
Te as IconUKey,
|
|
1742
1741
|
dA as MoveConditionalRuleMutation,
|
|
1743
|
-
|
|
1742
|
+
Je as MoveConditionalRuleMutationUndoFactory,
|
|
1744
1743
|
cA as SHEET_CONDITIONAL_FORMATTING_PLUGIN,
|
|
1745
1744
|
YA as SetConditionalRuleMutation,
|
|
1746
1745
|
WA as UniverSheetsConditionalFormattingPlugin,
|
|
1747
1746
|
dv as anchorUndoFactory,
|
|
1748
1747
|
AA as compareWithNumber,
|
|
1749
1748
|
wv as createCfId,
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1749
|
+
re as createDefaultRule,
|
|
1750
|
+
He as createDefaultValue,
|
|
1751
|
+
Qe as createDefaultValueByValueType,
|
|
1753
1752
|
zv as dataBarUKey,
|
|
1754
1753
|
tA as filterRange,
|
|
1755
1754
|
q as findIndexByAnchor,
|
|
1756
|
-
|
|
1755
|
+
ie as getCacheStyleMatrix,
|
|
1757
1756
|
U as getCellValue,
|
|
1758
1757
|
sv as getColorScaleFromValue,
|
|
1759
1758
|
av as getOppositeOperator,
|
|
1760
|
-
|
|
1759
|
+
se as getStringFromDataStream,
|
|
1761
1760
|
lA as getValueByType,
|
|
1762
1761
|
ne as iconGroup,
|
|
1763
1762
|
NA as iconMap,
|
|
1764
|
-
|
|
1763
|
+
We as isAnchorEqual,
|
|
1765
1764
|
SA as isFloatsEqual,
|
|
1766
1765
|
C as isNullable,
|
|
1767
|
-
|
|
1766
|
+
oe as isRangesEqual,
|
|
1768
1767
|
Pv as moveByAnchor,
|
|
1769
1768
|
Iv as removeUndefinedAttr,
|
|
1770
1769
|
iv as serialTimeToTimestamp,
|
|
1771
|
-
|
|
1770
|
+
ae as setConditionalRuleMutationUndoFactory,
|
|
1772
1771
|
Jv as toYMD_1900,
|
|
1773
1772
|
Bv as transformSupportSymmetryAnchor
|
|
1774
1773
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IMutation } from '@univerjs/core';
|
|
2
|
-
import { IAccessor } from '@wendellhu/redi';
|
|
1
|
+
import { IAccessor, IMutation } from '@univerjs/core';
|
|
3
2
|
import { IConditionFormattingRule } from '../../models/type';
|
|
4
3
|
import { IDeleteConditionalRuleMutationParams } from './delete-conditional-rule.mutation';
|
|
5
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injector } from '@
|
|
1
|
+
import { Injector } from '@univerjs/core';
|
|
2
2
|
import { IAnchor } from '../utils/anchor';
|
|
3
3
|
import { IConditionFormattingRule } from './type';
|
|
4
4
|
import { ConditionalFormattingViewModel } from './conditional-formatting-view-model';
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ICommandService, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
import { Injector } from '@wendellhu/redi';
|
|
1
|
+
import { ICommandService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
3
2
|
|
|
4
3
|
export declare class UniverSheetsConditionalFormattingPlugin extends Plugin {
|
|
5
4
|
readonly _injector: Injector;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ICommandService, Univer } from '@univerjs/core';
|
|
2
|
-
import { Dependency } from '@wendellhu/redi';
|
|
1
|
+
import { Dependency, ICommandService, Univer } from '@univerjs/core';
|
|
3
2
|
import { ConditionalFormattingService } from '../conditional-formatting.service';
|
|
4
3
|
import { ConditionalFormattingRuleModel } from '../../models/conditional-formatting-rule-model';
|
|
5
4
|
import { ConditionalFormattingViewModel } from '../../models/conditional-formatting-view-model';
|
|
@@ -7,12 +6,12 @@ import { ConditionalFormattingViewModel } from '../../models/conditional-formatt
|
|
|
7
6
|
export declare const createTestBed: (dependencies?: Dependency[]) => {
|
|
8
7
|
univer: Univer;
|
|
9
8
|
get: {
|
|
10
|
-
<T>(id: import('@
|
|
11
|
-
<T>(id: import('@
|
|
12
|
-
<T>(id: import('@
|
|
13
|
-
<T>(id: import('@
|
|
14
|
-
<T>(id: import('@
|
|
15
|
-
<T>(id: import('@
|
|
9
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, lookUp?: import('@univerjs/core').LookUp): T;
|
|
10
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.MANY, lookUp?: import('@univerjs/core').LookUp): T[];
|
|
11
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.OPTIONAL, lookUp?: import('@univerjs/core').LookUp): T | null;
|
|
12
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.REQUIRED, lookUp?: import('@univerjs/core').LookUp): T;
|
|
13
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
14
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
16
15
|
};
|
|
17
16
|
workbook: import('@univerjs/core').Workbook;
|
|
18
17
|
unitId: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IAccessor } from '@
|
|
2
|
-
import { ObjectMatrix, Workbook, Worksheet } from '@univerjs/core';
|
|
1
|
+
import { IAccessor, ObjectMatrix, Workbook, Worksheet } from '@univerjs/core';
|
|
3
2
|
import { CFRuleType } from '../../base/const';
|
|
4
3
|
import { IConditionFormattingRule } from '../../models/type';
|
|
5
4
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ObjectMatrix, Disposable, ICommandService, RefAlias } from '@univerjs/core';
|
|
2
|
-
import { Injector } from '@wendellhu/redi';
|
|
1
|
+
import { ObjectMatrix, Disposable, ICommandService, Injector, RefAlias } from '@univerjs/core';
|
|
3
2
|
import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
|
|
4
3
|
import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
|
|
5
4
|
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Disposable, ICommandService, InterceptorManager, IResourceManagerService, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
|
|
1
|
+
import { Disposable, ICommandService, Injector, InterceptorManager, IResourceManagerService, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
|
|
2
2
|
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
-
import { Injector } from '@wendellhu/redi';
|
|
4
3
|
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
5
4
|
import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
|
|
6
5
|
import { IHighlightCell } from '../models/type';
|