@univerjs/sheets-conditional-formatting 1.3.1 → 1.5.0
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/README.md +6 -5
- package/lib/cjs/facade.js +13 -21
- package/lib/cjs/index.js +284 -137
- package/lib/cjs/locale/ar-SA.js +1 -2
- package/lib/cjs/locale/ca-ES.js +1 -2
- package/lib/cjs/locale/de-DE.js +1 -2
- package/lib/cjs/locale/en-US.js +1 -2
- package/lib/cjs/locale/es-ES.js +1 -2
- package/lib/cjs/locale/fa-IR.js +1 -2
- package/lib/cjs/locale/fr-FR.js +1 -2
- package/lib/cjs/locale/id-ID.js +1 -2
- package/lib/cjs/locale/it-IT.js +1 -2
- package/lib/cjs/locale/ja-JP.js +1 -2
- package/lib/cjs/locale/ko-KR.js +1 -2
- package/lib/cjs/locale/pl-PL.js +1 -2
- package/lib/cjs/locale/pt-BR.js +1 -2
- package/lib/cjs/locale/ru-RU.js +1 -2
- package/lib/cjs/locale/sk-SK.js +1 -2
- package/lib/cjs/locale/vi-VN.js +1 -2
- package/lib/cjs/locale/zh-CN.js +1 -2
- package/lib/cjs/locale/zh-HK.js +1 -2
- package/lib/cjs/locale/zh-TW.js +1 -2
- package/lib/es/facade.js +13 -21
- package/lib/es/index.js +285 -138
- package/lib/es/locale/ar-SA.js +1 -2
- package/lib/es/locale/ca-ES.js +1 -2
- package/lib/es/locale/de-DE.js +1 -2
- package/lib/es/locale/en-US.js +1 -2
- package/lib/es/locale/es-ES.js +1 -2
- package/lib/es/locale/fa-IR.js +1 -2
- package/lib/es/locale/fr-FR.js +1 -2
- package/lib/es/locale/id-ID.js +1 -2
- package/lib/es/locale/it-IT.js +1 -2
- package/lib/es/locale/ja-JP.js +1 -2
- package/lib/es/locale/ko-KR.js +1 -2
- package/lib/es/locale/pl-PL.js +1 -2
- package/lib/es/locale/pt-BR.js +1 -2
- package/lib/es/locale/ru-RU.js +1 -2
- package/lib/es/locale/sk-SK.js +1 -2
- package/lib/es/locale/vi-VN.js +1 -2
- package/lib/es/locale/zh-CN.js +1 -2
- package/lib/es/locale/zh-HK.js +1 -2
- package/lib/es/locale/zh-TW.js +1 -2
- package/lib/facade.js +13 -21
- package/lib/index.js +285 -138
- package/lib/locale/ar-SA.js +1 -2
- package/lib/locale/ca-ES.js +1 -2
- package/lib/locale/de-DE.js +1 -2
- package/lib/locale/en-US.js +1 -2
- package/lib/locale/es-ES.js +1 -2
- package/lib/locale/fa-IR.js +1 -2
- package/lib/locale/fr-FR.js +1 -2
- package/lib/locale/id-ID.js +1 -2
- package/lib/locale/it-IT.js +1 -2
- package/lib/locale/ja-JP.js +1 -2
- package/lib/locale/ko-KR.js +1 -2
- package/lib/locale/pl-PL.js +1 -2
- package/lib/locale/pt-BR.js +1 -2
- package/lib/locale/ru-RU.js +1 -2
- package/lib/locale/sk-SK.js +1 -2
- package/lib/locale/vi-VN.js +1 -2
- package/lib/locale/zh-CN.js +1 -2
- package/lib/locale/zh-HK.js +1 -2
- package/lib/locale/zh-TW.js +1 -2
- package/lib/types/base/const.d.ts +1 -1
- package/lib/types/models/calculate-unit-v2/utils.d.ts +1 -1
- package/lib/types/render/conditional-formatting-raster-cache.d.ts +24 -0
- package/lib/types/render/data-bar.render.d.ts +4 -1
- package/lib/types/render/icon.render.d.ts +5 -1
- package/lib/types/render/resolve-render-ranges.d.ts +18 -0
- package/lib/types/services/conditional-formatting-formula.service.d.ts +3 -3
- package/lib/types/services/conditional-formatting-range-transform.service.d.ts +7 -0
- package/lib/types/services/conditional-formatting.service.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
package/lib/es/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutatio
|
|
|
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";
|
|
6
|
-
import { FIX_ONE_PIXEL_BLUR_OFFSET, SheetExtension, SpreadsheetExtensionRegistry, isObject } from "@univerjs/engine-render";
|
|
6
|
+
import { FIX_ONE_PIXEL_BLUR_OFFSET, SheetExtension, SpreadsheetExtensionRegistry, UniverRenderingContext, isObject } from "@univerjs/engine-render";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/base/const.ts
|
|
9
9
|
const SHEET_CONDITIONAL_FORMATTING_PLUGIN = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
|
|
10
10
|
let CFTextOperator = /* @__PURE__ */ function(CFTextOperator) {
|
|
11
11
|
CFTextOperator["beginsWith"] = "beginsWith";
|
|
@@ -113,8 +113,7 @@ const createDefaultValueByValueType = (type, defaultValue) => {
|
|
|
113
113
|
return "";
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
//#region src/utils/anchor.ts
|
|
116
|
+
// src/utils/anchor.ts
|
|
118
117
|
const findIndexByAnchor = (anchor, ruleList, get) => {
|
|
119
118
|
if (!ruleList) return null;
|
|
120
119
|
const anchorIndex = ruleList.findIndex((rule) => get(rule) === anchor.id);
|
|
@@ -198,8 +197,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
198
197
|
return anchor1.id === anchor2.id && anchor1.type === anchor2.type;
|
|
199
198
|
};
|
|
200
199
|
|
|
201
|
-
|
|
202
|
-
//#region src/utils/create-cf-id.ts
|
|
200
|
+
// src/utils/create-cf-id.ts
|
|
203
201
|
/**
|
|
204
202
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
205
203
|
*
|
|
@@ -217,8 +215,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
217
215
|
*/
|
|
218
216
|
const createCfId = () => `${generateRandomId(8)}`;
|
|
219
217
|
|
|
220
|
-
|
|
221
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
218
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
222
219
|
function _typeof(o) {
|
|
223
220
|
"@babel/helpers - typeof";
|
|
224
221
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -228,28 +225,25 @@ function _typeof(o) {
|
|
|
228
225
|
}, _typeof(o);
|
|
229
226
|
}
|
|
230
227
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
function toPrimitive(t, r) {
|
|
228
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
229
|
+
function toPrimitive(t, e) {
|
|
234
230
|
if ("object" != _typeof(t) || !t) return t;
|
|
235
|
-
var
|
|
236
|
-
if (void 0 !==
|
|
237
|
-
var i =
|
|
231
|
+
var r;
|
|
232
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
233
|
+
var i = r.call(t, e || "default");
|
|
238
234
|
if ("object" != _typeof(i)) return i;
|
|
239
235
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
240
236
|
}
|
|
241
|
-
return ("string" ===
|
|
237
|
+
return ("string" === e ? String : Number)(t);
|
|
242
238
|
}
|
|
243
239
|
|
|
244
|
-
|
|
245
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
240
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
246
241
|
function toPropertyKey(t) {
|
|
247
242
|
var i = toPrimitive(t, "string");
|
|
248
243
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
249
244
|
}
|
|
250
245
|
|
|
251
|
-
|
|
252
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
246
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
253
247
|
function _defineProperty(e, r, t) {
|
|
254
248
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
255
249
|
value: t,
|
|
@@ -259,8 +253,7 @@ function _defineProperty(e, r, t) {
|
|
|
259
253
|
}) : e[r] = t, e;
|
|
260
254
|
}
|
|
261
255
|
|
|
262
|
-
|
|
263
|
-
//#region src/models/conditional-formatting-rule-model.ts
|
|
256
|
+
// src/models/conditional-formatting-rule-model.ts
|
|
264
257
|
var ConditionalFormattingRuleModel = class {
|
|
265
258
|
constructor() {
|
|
266
259
|
_defineProperty(this, "_model", /* @__PURE__ */ new Map());
|
|
@@ -363,8 +356,7 @@ var ConditionalFormattingRuleModel = class {
|
|
|
363
356
|
}
|
|
364
357
|
};
|
|
365
358
|
|
|
366
|
-
|
|
367
|
-
//#region src/commands/mutations/move-conditional-rule.mutation.ts
|
|
359
|
+
// src/commands/mutations/move-conditional-rule.mutation.ts
|
|
368
360
|
const MoveConditionalRuleMutation = {
|
|
369
361
|
type: CommandType.MUTATION,
|
|
370
362
|
id: "sheet.mutation.move-conditional-rule",
|
|
@@ -391,8 +383,7 @@ const MoveConditionalRuleMutationUndoFactory = (param) => {
|
|
|
391
383
|
}];
|
|
392
384
|
};
|
|
393
385
|
|
|
394
|
-
|
|
395
|
-
//#region src/commands/mutations/delete-conditional-rule.mutation.ts
|
|
386
|
+
// src/commands/mutations/delete-conditional-rule.mutation.ts
|
|
396
387
|
const DeleteConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
397
388
|
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
398
389
|
const { unitId, subUnitId, cfId } = param;
|
|
@@ -449,8 +440,7 @@ const DeleteConditionalRuleMutation = {
|
|
|
449
440
|
}
|
|
450
441
|
};
|
|
451
442
|
|
|
452
|
-
|
|
453
|
-
//#region src/commands/mutations/add-conditional-rule.mutation.ts
|
|
443
|
+
// src/commands/mutations/add-conditional-rule.mutation.ts
|
|
454
444
|
const AddConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
455
445
|
return {
|
|
456
446
|
id: DeleteConditionalRuleMutation.id,
|
|
@@ -472,8 +462,7 @@ const AddConditionalRuleMutation = {
|
|
|
472
462
|
}
|
|
473
463
|
};
|
|
474
464
|
|
|
475
|
-
|
|
476
|
-
//#region src/commands/commands/add-cf.command.ts
|
|
465
|
+
// src/commands/commands/add-cf.command.ts
|
|
477
466
|
const AddCfCommand = {
|
|
478
467
|
type: CommandType.COMMAND,
|
|
479
468
|
id: "sheet.command.add-conditional-rule",
|
|
@@ -510,16 +499,14 @@ const AddCfCommand = {
|
|
|
510
499
|
}
|
|
511
500
|
};
|
|
512
501
|
|
|
513
|
-
|
|
514
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
502
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
|
|
515
503
|
function __decorateParam(paramIndex, decorator) {
|
|
516
504
|
return function(target, key) {
|
|
517
505
|
decorator(target, key, paramIndex);
|
|
518
506
|
};
|
|
519
507
|
}
|
|
520
508
|
|
|
521
|
-
|
|
522
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
509
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
|
|
523
510
|
function __decorate(decorators, target, key, desc) {
|
|
524
511
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
525
512
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -527,8 +514,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
527
514
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
528
515
|
}
|
|
529
516
|
|
|
530
|
-
|
|
531
|
-
//#region src/models/conditional-formatting-range-index-model.ts
|
|
517
|
+
// src/models/conditional-formatting-range-index-model.ts
|
|
532
518
|
let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndexModel extends Disposable {
|
|
533
519
|
constructor(_conditionalFormattingRuleModel) {
|
|
534
520
|
super();
|
|
@@ -614,18 +600,18 @@ let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndex
|
|
|
614
600
|
};
|
|
615
601
|
ConditionalFormattingRangeIndexModel = __decorate([__decorateParam(0, Inject(ConditionalFormattingRuleModel))], ConditionalFormattingRangeIndexModel);
|
|
616
602
|
|
|
617
|
-
|
|
618
|
-
//#region src/services/conditional-formatting-range-transform.service.ts
|
|
603
|
+
// src/services/conditional-formatting-range-transform.service.ts
|
|
619
604
|
var ConditionalFormattingRangeTransformService = class {
|
|
620
605
|
subtractRanges(sourceRanges, rangesToSubtract) {
|
|
621
|
-
return Rectangle.mergeRanges(Rectangle.subtractMulti(sourceRanges, rangesToSubtract));
|
|
606
|
+
return this._keepCoveredRangeType(Rectangle.mergeRanges(Rectangle.subtractMulti(sourceRanges, rangesToSubtract)), sourceRanges);
|
|
622
607
|
}
|
|
623
608
|
addRanges(sourceRanges, rangesToAdd) {
|
|
624
|
-
return Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]);
|
|
609
|
+
return this._keepCoveredRangeType(Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]), sourceRanges);
|
|
625
610
|
}
|
|
626
611
|
applyRangeDelta(sourceRanges, rangesToSubtract, rangesToAdd) {
|
|
627
|
-
const ranges = rangesToSubtract.length ?
|
|
628
|
-
|
|
612
|
+
const ranges = rangesToSubtract.length ? Rectangle.mergeRanges(Rectangle.subtractMulti(sourceRanges, rangesToSubtract)) : sourceRanges;
|
|
613
|
+
const merged = rangesToAdd.length ? Rectangle.mergeRanges([...ranges, ...rangesToAdd]) : ranges;
|
|
614
|
+
return this._keepCoveredRangeType(merged, sourceRanges);
|
|
629
615
|
}
|
|
630
616
|
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
631
617
|
const fragments = [];
|
|
@@ -647,10 +633,24 @@ var ConditionalFormattingRangeTransformService = class {
|
|
|
647
633
|
endColumn: range.endColumn + offset.col
|
|
648
634
|
};
|
|
649
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* Rebuilding ranges from coordinates drops `rangeType`. A result range that still covers exactly
|
|
638
|
+
* the same cells as a whole column/row source has to keep that type, otherwise a rule that was
|
|
639
|
+
* not actually changed (for example adding an already covered range) degrades to concrete rows.
|
|
640
|
+
* Results that no longer match a source range are genuine partial coverage and stay concrete.
|
|
641
|
+
*/
|
|
642
|
+
_keepCoveredRangeType(ranges, sourceRanges) {
|
|
643
|
+
return ranges.map((range) => {
|
|
644
|
+
const source = sourceRanges.find((item) => item.rangeType && item.startRow === range.startRow && item.endRow === range.endRow && item.startColumn === range.startColumn && item.endColumn === range.endColumn);
|
|
645
|
+
return source ? {
|
|
646
|
+
...range,
|
|
647
|
+
rangeType: source.rangeType
|
|
648
|
+
} : range;
|
|
649
|
+
});
|
|
650
|
+
}
|
|
650
651
|
};
|
|
651
652
|
|
|
652
|
-
|
|
653
|
-
//#region src/commands/mutations/set-conditional-rule.mutation.ts
|
|
653
|
+
// src/commands/mutations/set-conditional-rule.mutation.ts
|
|
654
654
|
const SetConditionalRuleMutation = {
|
|
655
655
|
type: CommandType.MUTATION,
|
|
656
656
|
id: "sheet.mutation.set-conditional-rule",
|
|
@@ -679,8 +679,7 @@ const setConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
|
679
679
|
return [];
|
|
680
680
|
};
|
|
681
681
|
|
|
682
|
-
|
|
683
|
-
//#region src/commands/commands/clear-range-cf.command.ts
|
|
682
|
+
// src/commands/commands/clear-range-cf.command.ts
|
|
684
683
|
const ClearRangeCfCommand = {
|
|
685
684
|
type: CommandType.COMMAND,
|
|
686
685
|
id: "sheet.command.clear-range-conditional-rule",
|
|
@@ -746,8 +745,7 @@ const ClearRangeCfCommand = {
|
|
|
746
745
|
}
|
|
747
746
|
};
|
|
748
747
|
|
|
749
|
-
|
|
750
|
-
//#region src/commands/commands/clear-worksheet-cf.command.ts
|
|
748
|
+
// src/commands/commands/clear-worksheet-cf.command.ts
|
|
751
749
|
const ClearWorksheetCfCommand = {
|
|
752
750
|
type: CommandType.COMMAND,
|
|
753
751
|
id: "sheet.command.clear-worksheet-conditional-rule",
|
|
@@ -781,8 +779,7 @@ const ClearWorksheetCfCommand = {
|
|
|
781
779
|
}
|
|
782
780
|
};
|
|
783
781
|
|
|
784
|
-
|
|
785
|
-
//#region src/commands/commands/delete-cf.command.ts
|
|
782
|
+
// src/commands/commands/delete-cf.command.ts
|
|
786
783
|
const DeleteCfCommand = {
|
|
787
784
|
type: CommandType.COMMAND,
|
|
788
785
|
id: "sheet.command.delete-conditional-rule",
|
|
@@ -813,8 +810,7 @@ const DeleteCfCommand = {
|
|
|
813
810
|
}
|
|
814
811
|
};
|
|
815
812
|
|
|
816
|
-
|
|
817
|
-
//#region src/commands/commands/move-cf.command.ts
|
|
813
|
+
// src/commands/commands/move-cf.command.ts
|
|
818
814
|
const MoveCfCommand = {
|
|
819
815
|
type: CommandType.COMMAND,
|
|
820
816
|
id: "sheet.command.move-conditional-rule",
|
|
@@ -850,8 +846,7 @@ const MoveCfCommand = {
|
|
|
850
846
|
}
|
|
851
847
|
};
|
|
852
848
|
|
|
853
|
-
|
|
854
|
-
//#region src/commands/commands/set-cf.command.ts
|
|
849
|
+
// src/commands/commands/set-cf.command.ts
|
|
855
850
|
const SetCfCommand = {
|
|
856
851
|
type: CommandType.COMMAND,
|
|
857
852
|
id: "sheet.command.set-conditional-rule",
|
|
@@ -883,8 +878,7 @@ const SetCfCommand = {
|
|
|
883
878
|
}
|
|
884
879
|
};
|
|
885
880
|
|
|
886
|
-
|
|
887
|
-
//#region src/utils/range.ts
|
|
881
|
+
// src/utils/range.ts
|
|
888
882
|
function getRangeInWorksheet(range, worksheet) {
|
|
889
883
|
const maxRows = worksheet.getMaxRows();
|
|
890
884
|
const maxColumns = worksheet.getMaxColumns();
|
|
@@ -912,8 +906,7 @@ function getRangesInWorksheet(ranges, worksheet) {
|
|
|
912
906
|
return effectiveRanges;
|
|
913
907
|
}
|
|
914
908
|
|
|
915
|
-
|
|
916
|
-
//#region src/services/conditional-formatting-formula.service.ts
|
|
909
|
+
// src/services/conditional-formatting-formula.service.ts
|
|
917
910
|
let ConditionalFormattingFormulaService = class ConditionalFormattingFormulaService extends Disposable {
|
|
918
911
|
constructor(_registerOtherFormulaService, _conditionalFormattingRuleModel, _univerInstanceService) {
|
|
919
912
|
super();
|
|
@@ -1097,8 +1090,7 @@ ConditionalFormattingFormulaService = __decorate([
|
|
|
1097
1090
|
__decorateParam(2, IUniverInstanceService)
|
|
1098
1091
|
], ConditionalFormattingFormulaService);
|
|
1099
1092
|
|
|
1100
|
-
|
|
1101
|
-
//#region src/models/calculate-unit-v2/base-calculate-unit.ts
|
|
1093
|
+
// src/models/calculate-unit-v2/base-calculate-unit.ts
|
|
1102
1094
|
/**
|
|
1103
1095
|
* Processing Main Path Calculation Logic
|
|
1104
1096
|
*/
|
|
@@ -1171,8 +1163,7 @@ var BaseCalculateUnit = class {
|
|
|
1171
1163
|
}
|
|
1172
1164
|
};
|
|
1173
1165
|
|
|
1174
|
-
|
|
1175
|
-
//#region src/models/calculate-unit-v2/color-scale-calculate-unit.ts
|
|
1166
|
+
// src/models/calculate-unit-v2/color-scale-calculate-unit.ts
|
|
1176
1167
|
var ColorScaleCalculateUnit = class extends BaseCalculateUnit {
|
|
1177
1168
|
preComputing(_row, _col, context) {
|
|
1178
1169
|
const rule = context.rule;
|
|
@@ -1224,8 +1215,155 @@ var ColorScaleCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1224
1215
|
}
|
|
1225
1216
|
};
|
|
1226
1217
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1218
|
+
// src/render/conditional-formatting-raster-cache.ts
|
|
1219
|
+
/**
|
|
1220
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1221
|
+
*
|
|
1222
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1223
|
+
* you may not use this file except in compliance with the License.
|
|
1224
|
+
* You may obtain a copy of the License at
|
|
1225
|
+
*
|
|
1226
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1227
|
+
*
|
|
1228
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1229
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1230
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1231
|
+
* See the License for the specific language governing permissions and
|
|
1232
|
+
* limitations under the License.
|
|
1233
|
+
*/
|
|
1234
|
+
const MAX_ENTRIES = 128;
|
|
1235
|
+
const MAX_PIXELS = 524288;
|
|
1236
|
+
const MAX_BITMAP_PIXELS = 131072;
|
|
1237
|
+
/** Retain physical pixels without mutating image sources already submitted to the destination. */
|
|
1238
|
+
var ConditionalFormattingRasterCache = class extends Disposable {
|
|
1239
|
+
constructor(..._args) {
|
|
1240
|
+
super(..._args);
|
|
1241
|
+
_defineProperty(this, "_bitmaps", /* @__PURE__ */ new Map());
|
|
1242
|
+
_defineProperty(this, "_pixels", 0);
|
|
1243
|
+
}
|
|
1244
|
+
draw(ctx, x, y, width, height, variant, draw, strokeWidth = 0) {
|
|
1245
|
+
var _native$getContextAtt;
|
|
1246
|
+
this.ensureNotDisposed();
|
|
1247
|
+
const native = ctx._context;
|
|
1248
|
+
const m = native === null || native === void 0 ? void 0 : native.getTransform();
|
|
1249
|
+
const colorSpace = native === null || native === void 0 || (_native$getContextAtt = native.getContextAttributes) === null || _native$getContextAtt === void 0 || (_native$getContextAtt = _native$getContextAtt.call(native)) === null || _native$getContextAtt === void 0 ? void 0 : _native$getContextAtt.colorSpace;
|
|
1250
|
+
if (!m || ctx.__mode === "printing" || typeof document === "undefined" || m.a !== m.d || m.a <= 0 || m.b || m.c || native.globalAlpha !== 1 || native.globalCompositeOperation !== "source-over" || colorSpace && colorSpace !== "srgb" || native.shadowBlur || native.shadowOffsetX || native.shadowOffsetY || ![
|
|
1251
|
+
"rgba(0, 0, 0, 0)",
|
|
1252
|
+
"transparent",
|
|
1253
|
+
"#00000000"
|
|
1254
|
+
].includes(native.shadowColor) || native.filter && native.filter !== "none" || width <= 0 || height <= 0 || typeof native.fillStyle !== "string" || typeof native.strokeStyle !== "string") {
|
|
1255
|
+
draw(ctx, x, y);
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
const px = x * m.a + m.e;
|
|
1259
|
+
const py = y * m.d + m.f;
|
|
1260
|
+
const padding = Math.max(2, Math.ceil(strokeWidth * m.a / 2) + 1);
|
|
1261
|
+
const left = Math.floor(px) - padding;
|
|
1262
|
+
const top = Math.floor(py) - padding;
|
|
1263
|
+
const pixelWidth = Math.ceil(px + width * m.a) - left + padding;
|
|
1264
|
+
const pixelHeight = Math.ceil(py + height * m.d) - top + padding;
|
|
1265
|
+
const pixels = pixelWidth * pixelHeight;
|
|
1266
|
+
if (!Number.isFinite(pixels) || pixels > MAX_BITMAP_PIXELS) {
|
|
1267
|
+
draw(ctx, x, y);
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
const localX = px - left;
|
|
1271
|
+
const localY = py - top;
|
|
1272
|
+
const dash = native.getLineDash();
|
|
1273
|
+
const key = JSON.stringify([
|
|
1274
|
+
variant,
|
|
1275
|
+
width,
|
|
1276
|
+
height,
|
|
1277
|
+
m.a,
|
|
1278
|
+
localX,
|
|
1279
|
+
localY,
|
|
1280
|
+
strokeWidth,
|
|
1281
|
+
native.fillStyle,
|
|
1282
|
+
native.strokeStyle,
|
|
1283
|
+
dash,
|
|
1284
|
+
native.lineDashOffset,
|
|
1285
|
+
native.lineCap,
|
|
1286
|
+
native.lineJoin,
|
|
1287
|
+
native.miterLimit,
|
|
1288
|
+
native.imageSmoothingEnabled,
|
|
1289
|
+
native.imageSmoothingQuality
|
|
1290
|
+
]);
|
|
1291
|
+
let bitmap = this._bitmaps.get(key);
|
|
1292
|
+
if (!bitmap) {
|
|
1293
|
+
const canvas = document.createElement("canvas");
|
|
1294
|
+
canvas.width = pixelWidth;
|
|
1295
|
+
canvas.height = pixelHeight;
|
|
1296
|
+
const context = canvas.getContext("2d");
|
|
1297
|
+
if (!context) {
|
|
1298
|
+
draw(ctx, x, y);
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
const paint = new UniverRenderingContext(context);
|
|
1302
|
+
paint.setTransform(m.a, 0, 0, m.d, localX, localY);
|
|
1303
|
+
paint.setLineDash(dash);
|
|
1304
|
+
paint.lineDashOffset = native.lineDashOffset;
|
|
1305
|
+
paint.lineCap = native.lineCap;
|
|
1306
|
+
paint.lineJoin = native.lineJoin;
|
|
1307
|
+
paint.miterLimit = native.miterLimit;
|
|
1308
|
+
paint.imageSmoothingEnabled = native.imageSmoothingEnabled;
|
|
1309
|
+
paint.imageSmoothingQuality = native.imageSmoothingQuality;
|
|
1310
|
+
draw(paint, 0, 0);
|
|
1311
|
+
while (this._bitmaps.size >= MAX_ENTRIES || this._pixels + pixels > MAX_PIXELS) {
|
|
1312
|
+
const oldestKey = this._bitmaps.keys().next().value;
|
|
1313
|
+
if (oldestKey === void 0) break;
|
|
1314
|
+
this._pixels -= this._bitmaps.get(oldestKey).pixels;
|
|
1315
|
+
this._bitmaps.delete(oldestKey);
|
|
1316
|
+
}
|
|
1317
|
+
bitmap = {
|
|
1318
|
+
canvas,
|
|
1319
|
+
pixels
|
|
1320
|
+
};
|
|
1321
|
+
this._bitmaps.set(key, bitmap);
|
|
1322
|
+
this._pixels += pixels;
|
|
1323
|
+
}
|
|
1324
|
+
ctx.save();
|
|
1325
|
+
try {
|
|
1326
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
1327
|
+
ctx.imageSmoothingEnabled = false;
|
|
1328
|
+
ctx.drawImage(bitmap.canvas, left, top);
|
|
1329
|
+
} finally {
|
|
1330
|
+
ctx.restore();
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
dispose() {
|
|
1334
|
+
for (const { canvas } of this._bitmaps.values()) {
|
|
1335
|
+
canvas.width = 0;
|
|
1336
|
+
canvas.height = 0;
|
|
1337
|
+
}
|
|
1338
|
+
this._bitmaps.clear();
|
|
1339
|
+
this._pixels = 0;
|
|
1340
|
+
super.dispose();
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
// src/render/resolve-render-ranges.ts
|
|
1345
|
+
function resolveRenderRanges(worksheet, sourceRanges, resolver) {
|
|
1346
|
+
if (!resolver) return sourceRanges;
|
|
1347
|
+
const mergedRanges = worksheet.getMergeData().length ? sourceRanges.flatMap((range) => worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn)) : [];
|
|
1348
|
+
const queryRanges = mergedRanges.length ? [...sourceRanges, ...mergedRanges.map((range) => ({
|
|
1349
|
+
startRow: range.startRow,
|
|
1350
|
+
endRow: range.startRow,
|
|
1351
|
+
startColumn: range.startColumn,
|
|
1352
|
+
endColumn: range.startColumn
|
|
1353
|
+
}))] : sourceRanges;
|
|
1354
|
+
const resolved = resolver(worksheet.getUnitId(), worksheet.getSheetId(), queryRanges);
|
|
1355
|
+
if (!resolved) return sourceRanges;
|
|
1356
|
+
if (!mergedRanges.length || !resolved.length) return resolved;
|
|
1357
|
+
const formattedMerges = mergedRanges.filter((merge) => resolved.some((range) => Rectangle.intersects(merge, range)));
|
|
1358
|
+
const clipped = [];
|
|
1359
|
+
for (const source of sourceRanges) for (const range of [...resolved, ...formattedMerges]) {
|
|
1360
|
+
const intersection = getIntersectRange(source, range);
|
|
1361
|
+
if (intersection) clipped.push(intersection);
|
|
1362
|
+
}
|
|
1363
|
+
return clipped.length > 1 ? Rectangle.mergeRanges(clipped) : clipped;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
// src/render/data-bar.render.ts
|
|
1229
1367
|
const dataBarUKey = "sheet-conditional-rule-data-bar";
|
|
1230
1368
|
const defaultDataBarPositiveColor = "#ffbe38";
|
|
1231
1369
|
const defaultDataBarNativeColor = "#abd91a";
|
|
@@ -1235,11 +1373,13 @@ const stringifyRange$1 = (range) => {
|
|
|
1235
1373
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
1236
1374
|
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
1237
1375
|
};
|
|
1238
|
-
var DataBar = class extends SheetExtension {
|
|
1376
|
+
var DataBar = class DataBar extends SheetExtension {
|
|
1239
1377
|
constructor(..._args) {
|
|
1240
1378
|
super(..._args);
|
|
1379
|
+
_defineProperty(this, "viewportCacheReusable", this.constructor === DataBar);
|
|
1241
1380
|
_defineProperty(this, "_paddingRightAndLeft", 2);
|
|
1242
1381
|
_defineProperty(this, "_paddingTopAndBottom", 2);
|
|
1382
|
+
_defineProperty(this, "_rasterCache", new ConditionalFormattingRasterCache());
|
|
1243
1383
|
_defineProperty(this, "_renderRangeResolver", null);
|
|
1244
1384
|
_defineProperty(this, "uKey", dataBarUKey);
|
|
1245
1385
|
_defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX$1);
|
|
@@ -1253,7 +1393,7 @@ var DataBar = class extends SheetExtension {
|
|
|
1253
1393
|
if (!worksheet) return false;
|
|
1254
1394
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
1255
1395
|
const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
|
|
1256
|
-
const renderRanges =
|
|
1396
|
+
const renderRanges = resolveRenderRanges(worksheet, sourceRanges, this._renderRangeResolver);
|
|
1257
1397
|
if (!renderRanges.length) return;
|
|
1258
1398
|
ctx.save();
|
|
1259
1399
|
renderRanges.forEach((range) => {
|
|
@@ -1276,43 +1416,42 @@ var DataBar = class extends SheetExtension {
|
|
|
1276
1416
|
const borderHeight = endY + FIX_ONE_PIXEL_BLUR_OFFSET - startY;
|
|
1277
1417
|
const width = borderWidth - this._paddingRightAndLeft * 2;
|
|
1278
1418
|
const height = borderHeight - this._paddingTopAndBottom * 2;
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1419
|
+
const positive = value > 0;
|
|
1420
|
+
const dataBarWidth = Math.max(positive ? width * (1 - startPoint / 100) * value / 100 : width * startPoint / 100 * Math.abs(value) / 100, 1);
|
|
1421
|
+
const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - (positive ? 0 : dataBarWidth);
|
|
1422
|
+
const y0 = startY + this._paddingTopAndBottom;
|
|
1423
|
+
ctx.fillStyle = color;
|
|
1424
|
+
ctx.strokeStyle = color;
|
|
1425
|
+
const fillColor = ctx.fillStyle;
|
|
1426
|
+
const strokeColor = ctx.strokeStyle;
|
|
1427
|
+
this._drawAtLocalOrigin(ctx, x0, y0, dataBarWidth, height, (paint, x, y) => {
|
|
1283
1428
|
if (isGradient) {
|
|
1284
|
-
const gradient =
|
|
1285
|
-
gradient.addColorStop(0, color);
|
|
1286
|
-
gradient.addColorStop(1, "rgb(255 255 255)");
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
} else
|
|
1291
|
-
this._drawRectWithRoundedCorner(
|
|
1292
|
-
if (isGradient)
|
|
1293
|
-
}
|
|
1294
|
-
const dataBarWidth = Math.max(width * startPoint / 100 * Math.abs(value) / 100, 1);
|
|
1295
|
-
const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - dataBarWidth;
|
|
1296
|
-
const y0 = startY + this._paddingTopAndBottom;
|
|
1297
|
-
if (isGradient) {
|
|
1298
|
-
const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
|
|
1299
|
-
gradient.addColorStop(0, "rgb(255 255 255)");
|
|
1300
|
-
gradient.addColorStop(1, color);
|
|
1301
|
-
ctx.fillStyle = gradient;
|
|
1302
|
-
ctx.strokeStyle = color;
|
|
1303
|
-
ctx.lineWidth = 1;
|
|
1304
|
-
} else ctx.fillStyle = color;
|
|
1305
|
-
this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, true, false, false, true);
|
|
1306
|
-
if (isGradient) ctx.stroke();
|
|
1307
|
-
}
|
|
1429
|
+
const gradient = paint.createLinearGradient(x, y, x + dataBarWidth, y);
|
|
1430
|
+
gradient.addColorStop(0, positive ? color : "rgb(255 255 255)");
|
|
1431
|
+
gradient.addColorStop(1, positive ? "rgb(255 255 255)" : color);
|
|
1432
|
+
paint.fillStyle = gradient;
|
|
1433
|
+
paint.strokeStyle = paint === ctx ? color : strokeColor;
|
|
1434
|
+
paint.lineWidth = 1;
|
|
1435
|
+
} else paint.fillStyle = paint === ctx ? color : fillColor;
|
|
1436
|
+
this._drawRectWithRoundedCorner(paint, x, y, dataBarWidth, height, !positive, positive, positive, !positive);
|
|
1437
|
+
if (isGradient) paint.stroke();
|
|
1438
|
+
}, `${positive}:${isGradient}:${this._radius}:${color}`, isGradient ? 1 : 0);
|
|
1308
1439
|
});
|
|
1309
1440
|
});
|
|
1310
1441
|
ctx.restore();
|
|
1311
1442
|
}
|
|
1312
1443
|
dispose() {
|
|
1444
|
+
this._rasterCache.dispose();
|
|
1313
1445
|
this._renderRangeResolver = null;
|
|
1314
1446
|
super.dispose();
|
|
1315
1447
|
}
|
|
1448
|
+
_drawAtLocalOrigin(ctx, x, y, width, height, draw, variant = "", strokeWidth = 0) {
|
|
1449
|
+
if (typeof navigator !== "undefined" && (ctx.getBrowserType() === "Safari" || Tools.isIPhone())) {
|
|
1450
|
+
draw(ctx, x, y);
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
this._rasterCache.draw(ctx, x, y, width, height, variant, draw, strokeWidth);
|
|
1454
|
+
}
|
|
1316
1455
|
_drawRectWithRoundedCorner(ctx, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
|
|
1317
1456
|
const radius = this._radius;
|
|
1318
1457
|
if (!height || !width) return;
|
|
@@ -1336,8 +1475,7 @@ var DataBar = class extends SheetExtension {
|
|
|
1336
1475
|
};
|
|
1337
1476
|
SpreadsheetExtensionRegistry.add(DataBar);
|
|
1338
1477
|
|
|
1339
|
-
|
|
1340
|
-
//#region src/models/calculate-unit-v2/data-bar-calculate-unit.ts
|
|
1478
|
+
// src/models/calculate-unit-v2/data-bar-calculate-unit.ts
|
|
1341
1479
|
const getSafeValue = (v) => Math.max(Math.min(100, v), 0);
|
|
1342
1480
|
const getValue$1 = (row, col, getCell) => {
|
|
1343
1481
|
const cell = getCell(row, col);
|
|
@@ -1464,8 +1602,7 @@ var DataBarCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1464
1602
|
}
|
|
1465
1603
|
};
|
|
1466
1604
|
|
|
1467
|
-
|
|
1468
|
-
//#region src/models/calculate-unit-v2/highlight-cell-calculate-unit.ts
|
|
1605
|
+
// src/models/calculate-unit-v2/highlight-cell-calculate-unit.ts
|
|
1469
1606
|
const isFormulaResultMatched = (value) => value === true || value === 1 || value === "TRUE";
|
|
1470
1607
|
const sortRangesByTopLeft = (ranges) => [...ranges].sort((a, b) => {
|
|
1471
1608
|
if (a.startRow !== b.startRow) return a.startRow - b.startRow;
|
|
@@ -1753,8 +1890,7 @@ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1753
1890
|
}
|
|
1754
1891
|
};
|
|
1755
1892
|
|
|
1756
|
-
|
|
1757
|
-
//#region src/models/calculate-unit-v2/icon-set-calculate-unit.ts
|
|
1893
|
+
// src/models/calculate-unit-v2/icon-set-calculate-unit.ts
|
|
1758
1894
|
const getValue = (row, col, getCell) => {
|
|
1759
1895
|
const cell = getCell(row, col);
|
|
1760
1896
|
if (cell && cell.t === CellValueType.NUMBER) {
|
|
@@ -1845,8 +1981,7 @@ var IconSetCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1845
1981
|
}
|
|
1846
1982
|
};
|
|
1847
1983
|
|
|
1848
|
-
|
|
1849
|
-
//#region src/models/conditional-formatting-view-model.ts
|
|
1984
|
+
// src/models/conditional-formatting-view-model.ts
|
|
1850
1985
|
const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH = 9e3;
|
|
1851
1986
|
let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extends Disposable {
|
|
1852
1987
|
constructor(_injector, _conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService, _univerInstanceService) {
|
|
@@ -2059,8 +2194,7 @@ ConditionalFormattingViewModel = __decorate([
|
|
|
2059
2194
|
__decorateParam(4, IUniverInstanceService)
|
|
2060
2195
|
], ConditionalFormattingViewModel);
|
|
2061
2196
|
|
|
2062
|
-
|
|
2063
|
-
//#region src/models/calculate-unit-v2/utils.ts
|
|
2197
|
+
// src/models/calculate-unit-v2/utils.ts
|
|
2064
2198
|
function isFloatsEqual(a, b) {
|
|
2065
2199
|
return Math.abs(a - b) < Number.EPSILON;
|
|
2066
2200
|
}
|
|
@@ -2248,8 +2382,7 @@ function getMaxInFormulaResult(result) {
|
|
|
2248
2382
|
return max;
|
|
2249
2383
|
}
|
|
2250
2384
|
|
|
2251
|
-
|
|
2252
|
-
//#region src/assets/icon-map.ts
|
|
2385
|
+
// src/assets/icon-map.ts
|
|
2253
2386
|
const ICON_MAP = {
|
|
2254
2387
|
"feedback": {
|
|
2255
2388
|
"mistake": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20d%3D%22M5.69014%205.69014C5.45583%205.92445%205.45583%206.30435%205.69014%206.53867L7.15137%207.9999L5.6899%209.46137C5.45558%209.69569%205.45558%2010.0756%205.6899%2010.3099C5.92421%2010.5442%206.30411%2010.5442%206.53842%2010.3099L7.9999%208.84843L9.46137%2010.3099C9.69569%2010.5442%2010.0756%2010.5442%2010.3099%2010.3099C10.5442%2010.0756%2010.5442%209.69569%2010.3099%209.46137L8.84843%207.9999L10.3097%206.53867C10.544%206.30435%2010.544%205.92445%2010.3097%205.69014C10.0753%205.45583%209.69544%205.45583%209.46113%205.69014L7.9999%207.15137L6.53867%205.69014C6.30435%205.45583%205.92445%205.45583%205.69014%205.69014Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
@@ -2283,16 +2416,16 @@ const ICON_MAP = {
|
|
|
2283
2416
|
"impatient": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Cpath%20d%3D%22M4.9%205.4L6.7%206.15%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3Cpath%20d%3D%22M11.1%205.4L9.3%206.15%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%227.2%22%20r%3D%220.65%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%227.2%22%20r%3D%220.65%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%2011.25C5.7%2010.05%206.7%209.45%208%209.45C9.3%209.45%2010.3%2010.05%2011%2011.25%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2284
2417
|
},
|
|
2285
2418
|
"arrow": {
|
|
2286
|
-
"down-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2287
|
-
"right-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2288
|
-
"up-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2289
|
-
"rightAndDown-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2290
|
-
"rightAndUp-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2291
|
-
"down-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2292
|
-
"right-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2293
|
-
"up-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2294
|
-
"rightAndDown-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2295
|
-
"rightAndUp-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2419
|
+
"down-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23FE4B4B%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M8%202.5V13.5M3%208.5L8%2013.5L13%208.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2420
|
+
"right-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M2.5%208H13.5M8.5%203L13.5%208L8.5%2013%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2421
|
+
"up-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%2359D01E%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M8%2013.5V2.5M3%207.5L8%202.5L13%207.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2422
|
+
"rightAndDown-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M3.5%203.5L12.5%2012.5M5.5%2012.5H12.5V5.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2423
|
+
"rightAndUp-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M3.5%2012.5L12.5%203.5M5.5%203.5H12.5V10.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2424
|
+
"down-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23999999%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M8%202.5V13.5M3%208.5L8%2013.5L13%208.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2425
|
+
"right-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23999999%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M2.5%208H13.5M8.5%203L13.5%208L8.5%2013%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2426
|
+
"up-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23999999%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M8%2013.5V2.5M3%207.5L8%202.5L13%207.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2427
|
+
"rightAndDown-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23999999%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M3.5%203.5L12.5%2012.5M5.5%2012.5H12.5V5.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2428
|
+
"rightAndUp-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23999999%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M3.5%2012.5L12.5%203.5M5.5%203.5H12.5V10.5%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A"
|
|
2296
2429
|
},
|
|
2297
2430
|
"shape": {
|
|
2298
2431
|
"cross": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%227%22%20width%3D%2210%22%20height%3D%222%22%20rx%3D%220.75%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
@@ -2312,9 +2445,9 @@ const ICON_MAP = {
|
|
|
2312
2445
|
"indicate-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2313
2446
|
},
|
|
2314
2447
|
"feedback2": {
|
|
2315
|
-
"mistake2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%
|
|
2448
|
+
"mistake2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%23FE4B4B%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M3.3%203.3L12.7%2012.7M12.7%203.3L3.3%2012.7%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2316
2449
|
"warn2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.25%202.5C7.25%202.08579%207.58579%201.75%208%201.75C8.41421%201.75%208.75%202.08579%208.75%202.5V10C8.75%2010.4142%208.41421%2010.75%208%2010.75C7.58579%2010.75%207.25%2010.4142%207.25%2010V2.5Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%2213.25%22%20r%3D%221%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2317
|
-
"correct2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%
|
|
2450
|
+
"correct2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20stroke%3D%22%2359D01E%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cpath%20d%3D%22M2.27%208L6.09%2011.82L13.73%204.18%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A"
|
|
2318
2451
|
},
|
|
2319
2452
|
"flag": {
|
|
2320
2453
|
"flag-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
@@ -2330,8 +2463,7 @@ const ICON_MAP = {
|
|
|
2330
2463
|
}
|
|
2331
2464
|
};
|
|
2332
2465
|
|
|
2333
|
-
|
|
2334
|
-
//#region src/models/icon-map.ts
|
|
2466
|
+
// src/models/icon-map.ts
|
|
2335
2467
|
let IIconSetType = /* @__PURE__ */ function(IIconSetType) {
|
|
2336
2468
|
IIconSetType["threeArrows"] = "3Arrows";
|
|
2337
2469
|
IIconSetType["threeArrowsGray"] = "3ArrowsGray";
|
|
@@ -2574,13 +2706,11 @@ for (const key in iconMap) {
|
|
|
2574
2706
|
Object.freeze(v);
|
|
2575
2707
|
}
|
|
2576
2708
|
|
|
2577
|
-
|
|
2578
|
-
//#region package.json
|
|
2709
|
+
// package.json
|
|
2579
2710
|
var name = "@univerjs/sheets-conditional-formatting";
|
|
2580
|
-
var version = "1.
|
|
2711
|
+
var version = "1.5.0";
|
|
2581
2712
|
|
|
2582
|
-
|
|
2583
|
-
//#region src/config/config.ts
|
|
2713
|
+
// src/config/config.ts
|
|
2584
2714
|
/**
|
|
2585
2715
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2586
2716
|
*
|
|
@@ -2600,8 +2730,7 @@ const SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY = "ssheets-conditional-for
|
|
|
2600
2730
|
const configSymbol = Symbol(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY);
|
|
2601
2731
|
const defaultPluginConfig = {};
|
|
2602
2732
|
|
|
2603
|
-
|
|
2604
|
-
//#region src/services/conditional-formatting-style-composer.service.ts
|
|
2733
|
+
// src/services/conditional-formatting-style-composer.service.ts
|
|
2605
2734
|
/**
|
|
2606
2735
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2607
2736
|
*
|
|
@@ -2695,8 +2824,7 @@ let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleCompose
|
|
|
2695
2824
|
};
|
|
2696
2825
|
ConditionalFormattingStyleComposer = __decorate([__decorateParam(0, Inject(ConditionalFormattingRuleModel)), __decorateParam(1, Inject(ConditionalFormattingViewModel))], ConditionalFormattingStyleComposer);
|
|
2697
2826
|
|
|
2698
|
-
|
|
2699
|
-
//#region src/services/conditional-formatting.service.ts
|
|
2827
|
+
// src/services/conditional-formatting.service.ts
|
|
2700
2828
|
let ConditionalFormattingService = class ConditionalFormattingService extends Disposable {
|
|
2701
2829
|
get _conditionalFormattingViewModelV2() {
|
|
2702
2830
|
return this._injector.get(ConditionalFormattingViewModel);
|
|
@@ -2842,7 +2970,9 @@ let ConditionalFormattingService = class ConditionalFormattingService extends Di
|
|
|
2842
2970
|
};
|
|
2843
2971
|
switch (commandInfo.id) {
|
|
2844
2972
|
case SetRangeValuesMutation.id: {
|
|
2973
|
+
var _this$_conditionalFor;
|
|
2845
2974
|
const { subUnitId, unitId, cellValue } = commandInfo.params;
|
|
2975
|
+
if (!((_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId)) === null || _this$_conditionalFor === void 0 ? void 0 : _this$_conditionalFor.length)) break;
|
|
2846
2976
|
const ranges = [];
|
|
2847
2977
|
new ObjectMatrix(cellValue).forValue((row, col, value) => {
|
|
2848
2978
|
if (value && Object.keys(value).some((key) => ["p", "v"].includes(key))) ranges.push({
|
|
@@ -2947,8 +3077,7 @@ ConditionalFormattingService = __decorate([
|
|
|
2947
3077
|
__decorateParam(7, Inject(ICommandService))
|
|
2948
3078
|
], ConditionalFormattingService);
|
|
2949
3079
|
|
|
2950
|
-
|
|
2951
|
-
//#region src/plugin.ts
|
|
3080
|
+
// src/plugin.ts
|
|
2952
3081
|
let UniverSheetsConditionalFormattingPlugin = class UniverSheetsConditionalFormattingPlugin extends Plugin {
|
|
2953
3082
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
|
2954
3083
|
super();
|
|
@@ -3004,8 +3133,7 @@ UniverSheetsConditionalFormattingPlugin = __decorate([
|
|
|
3004
3133
|
__decorateParam(3, IConfigService)
|
|
3005
3134
|
], UniverSheetsConditionalFormattingPlugin);
|
|
3006
3135
|
|
|
3007
|
-
|
|
3008
|
-
//#region src/render/icon.render.ts
|
|
3136
|
+
// src/render/icon.render.ts
|
|
3009
3137
|
const IconUKey = "sheet-conditional-rule-icon";
|
|
3010
3138
|
const EXTENSION_Z_INDEX = 35;
|
|
3011
3139
|
const DEFAULT_WIDTH = 15;
|
|
@@ -3014,12 +3142,15 @@ const stringifyRange = (range) => {
|
|
|
3014
3142
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
3015
3143
|
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
3016
3144
|
};
|
|
3017
|
-
var ConditionalFormattingIcon = class extends SheetExtension {
|
|
3145
|
+
var ConditionalFormattingIcon = class ConditionalFormattingIcon extends SheetExtension {
|
|
3018
3146
|
constructor() {
|
|
3019
3147
|
super();
|
|
3148
|
+
_defineProperty(this, "viewportCacheReusable", this.constructor === ConditionalFormattingIcon);
|
|
3020
3149
|
_defineProperty(this, "_paddingRightAndLeft", 2);
|
|
3021
3150
|
_defineProperty(this, "_width", 15);
|
|
3022
3151
|
_defineProperty(this, "_imageMap", /* @__PURE__ */ new Map());
|
|
3152
|
+
_defineProperty(this, "_rasterCache", new ConditionalFormattingRasterCache());
|
|
3153
|
+
_defineProperty(this, "_pendingImages", /* @__PURE__ */ new Set());
|
|
3023
3154
|
_defineProperty(this, "_renderRangeResolver", null);
|
|
3024
3155
|
_defineProperty(this, "uKey", IconUKey);
|
|
3025
3156
|
_defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX);
|
|
@@ -3034,7 +3165,7 @@ var ConditionalFormattingIcon = class extends SheetExtension {
|
|
|
3034
3165
|
if (!worksheet) return false;
|
|
3035
3166
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
3036
3167
|
const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
|
|
3037
|
-
const renderRanges =
|
|
3168
|
+
const renderRanges = resolveRenderRanges(worksheet, sourceRanges, this._renderRangeResolver);
|
|
3038
3169
|
if (!renderRanges.length) return;
|
|
3039
3170
|
ctx.save();
|
|
3040
3171
|
renderRanges.forEach((range) => {
|
|
@@ -3060,22 +3191,40 @@ var ConditionalFormattingIcon = class extends SheetExtension {
|
|
|
3060
3191
|
const borderHeight = endY - startY;
|
|
3061
3192
|
if (this._width > borderHeight || this._width > borderWidth + this._paddingRightAndLeft * 2) return;
|
|
3062
3193
|
const y = (borderHeight - this._width) / 2 + startY;
|
|
3063
|
-
|
|
3194
|
+
this._drawIcon(ctx, icon, startX + this._paddingRightAndLeft, y);
|
|
3064
3195
|
});
|
|
3065
3196
|
});
|
|
3066
3197
|
ctx.restore();
|
|
3067
3198
|
}
|
|
3068
3199
|
dispose() {
|
|
3200
|
+
this._rasterCache.dispose();
|
|
3201
|
+
for (const image of this._pendingImages) image.onload = null;
|
|
3202
|
+
this._pendingImages.clear();
|
|
3203
|
+
this._imageMap.clear();
|
|
3069
3204
|
this._renderRangeResolver = null;
|
|
3070
3205
|
super.dispose();
|
|
3071
3206
|
}
|
|
3207
|
+
_drawIcon(ctx, image, x, y) {
|
|
3208
|
+
if (!ctx._context || ctx.__mode === "printing" || ctx.getSystemType() !== "Linux") {
|
|
3209
|
+
ctx.drawImage(image, x, y, this._width, this._width);
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
this._rasterCache.draw(ctx, x, y, this._width, this._width, image.src, (paint, left, top) => {
|
|
3213
|
+
paint.drawImage(image, left, top, this._width, this._width);
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3072
3216
|
_init() {
|
|
3073
3217
|
for (const type in iconMap) iconMap[type].forEach((base64, index) => {
|
|
3074
3218
|
const key = this._createKey(type, String(index));
|
|
3075
3219
|
const image = new Image();
|
|
3076
3220
|
image.onload = () => {
|
|
3221
|
+
var _this$parent;
|
|
3222
|
+
image.onload = null;
|
|
3223
|
+
this._pendingImages.delete(image);
|
|
3077
3224
|
this._imageMap.set(key, image);
|
|
3225
|
+
(_this$parent = this.parent) === null || _this$parent === void 0 || _this$parent.makeDirty(true);
|
|
3078
3226
|
};
|
|
3227
|
+
this._pendingImages.add(image);
|
|
3079
3228
|
image.src = base64;
|
|
3080
3229
|
});
|
|
3081
3230
|
}
|
|
@@ -3085,8 +3234,7 @@ var ConditionalFormattingIcon = class extends SheetExtension {
|
|
|
3085
3234
|
};
|
|
3086
3235
|
SpreadsheetExtensionRegistry.add(ConditionalFormattingIcon);
|
|
3087
3236
|
|
|
3088
|
-
|
|
3089
|
-
//#region src/utils/remove-undefined-attr.ts
|
|
3237
|
+
// src/utils/remove-undefined-attr.ts
|
|
3090
3238
|
/**
|
|
3091
3239
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3092
3240
|
*
|
|
@@ -3112,5 +3260,4 @@ function removeUndefinedAttr(obj) {
|
|
|
3112
3260
|
return result;
|
|
3113
3261
|
}
|
|
3114
3262
|
|
|
3115
|
-
//#endregion
|
|
3116
3263
|
export { AddCfCommand, AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingFormulaService, ConditionalFormattingIcon, ConditionalFormattingRangeIndexModel, ConditionalFormattingRangeTransformService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingStyleComposer, ConditionalFormattingViewModel, DEFAULT_BG_COLOR, DEFAULT_FONT_COLOR, DEFAULT_PADDING, DEFAULT_WIDTH, DataBar, DeleteCfCommand, DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, IIconSetType, IconUKey, MoveCfCommand, MoveConditionalRuleMutation, MoveConditionalRuleMutationUndoFactory, SHEET_CONDITIONAL_FORMATTING_PLUGIN, SetCfCommand, SetConditionalRuleMutation, UniverSheetsConditionalFormattingPlugin, anchorUndoFactory, compareWithNumber, createCfId, createDefaultRule, createDefaultValue, createDefaultValueByValueType, dataBarUKey, defaultDataBarNativeColor, defaultDataBarPositiveColor, defaultPlaceholderColor, filterRange, findIndexByAnchor, getCacheStyleMatrix, getCellValue, getColorScaleFromValue, getMaxInFormulaResult, getOppositeOperator, getValueByType, iconGroup, iconMap, isAnchorEqual, isFloatsEqual, isNullable, moveByAnchor, removeUndefinedAttr, serialTimeToTimestamp, setConditionalRuleMutationUndoFactory, transformSupportSymmetryAnchor };
|