@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/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
|
6
6
|
let rxjs_operators = require("rxjs/operators");
|
|
7
7
|
let _univerjs_engine_render = require("@univerjs/engine-render");
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/base/const.ts
|
|
10
10
|
const SHEET_CONDITIONAL_FORMATTING_PLUGIN = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
|
|
11
11
|
let CFTextOperator = /* @__PURE__ */ function(CFTextOperator) {
|
|
12
12
|
CFTextOperator["beginsWith"] = "beginsWith";
|
|
@@ -114,8 +114,7 @@ const createDefaultValueByValueType = (type, defaultValue) => {
|
|
|
114
114
|
return "";
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
//#region src/utils/anchor.ts
|
|
117
|
+
// src/utils/anchor.ts
|
|
119
118
|
const findIndexByAnchor = (anchor, ruleList, get) => {
|
|
120
119
|
if (!ruleList) return null;
|
|
121
120
|
const anchorIndex = ruleList.findIndex((rule) => get(rule) === anchor.id);
|
|
@@ -199,8 +198,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
199
198
|
return anchor1.id === anchor2.id && anchor1.type === anchor2.type;
|
|
200
199
|
};
|
|
201
200
|
|
|
202
|
-
|
|
203
|
-
//#region src/utils/create-cf-id.ts
|
|
201
|
+
// src/utils/create-cf-id.ts
|
|
204
202
|
/**
|
|
205
203
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
206
204
|
*
|
|
@@ -218,8 +216,7 @@ const isAnchorEqual = (anchor1, anchor2) => {
|
|
|
218
216
|
*/
|
|
219
217
|
const createCfId = () => `${(0, _univerjs_core.generateRandomId)(8)}`;
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
219
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
223
220
|
function _typeof(o) {
|
|
224
221
|
"@babel/helpers - typeof";
|
|
225
222
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -229,28 +226,25 @@ function _typeof(o) {
|
|
|
229
226
|
}, _typeof(o);
|
|
230
227
|
}
|
|
231
228
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
function toPrimitive(t, r) {
|
|
229
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
230
|
+
function toPrimitive(t, e) {
|
|
235
231
|
if ("object" != _typeof(t) || !t) return t;
|
|
236
|
-
var
|
|
237
|
-
if (void 0 !==
|
|
238
|
-
var i =
|
|
232
|
+
var r;
|
|
233
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
234
|
+
var i = r.call(t, e || "default");
|
|
239
235
|
if ("object" != _typeof(i)) return i;
|
|
240
236
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
241
237
|
}
|
|
242
|
-
return ("string" ===
|
|
238
|
+
return ("string" === e ? String : Number)(t);
|
|
243
239
|
}
|
|
244
240
|
|
|
245
|
-
|
|
246
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
241
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
247
242
|
function toPropertyKey(t) {
|
|
248
243
|
var i = toPrimitive(t, "string");
|
|
249
244
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
250
245
|
}
|
|
251
246
|
|
|
252
|
-
|
|
253
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
247
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
254
248
|
function _defineProperty(e, r, t) {
|
|
255
249
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
256
250
|
value: t,
|
|
@@ -260,8 +254,7 @@ function _defineProperty(e, r, t) {
|
|
|
260
254
|
}) : e[r] = t, e;
|
|
261
255
|
}
|
|
262
256
|
|
|
263
|
-
|
|
264
|
-
//#region src/models/conditional-formatting-rule-model.ts
|
|
257
|
+
// src/models/conditional-formatting-rule-model.ts
|
|
265
258
|
var ConditionalFormattingRuleModel = class {
|
|
266
259
|
constructor() {
|
|
267
260
|
_defineProperty(this, "_model", /* @__PURE__ */ new Map());
|
|
@@ -364,8 +357,7 @@ var ConditionalFormattingRuleModel = class {
|
|
|
364
357
|
}
|
|
365
358
|
};
|
|
366
359
|
|
|
367
|
-
|
|
368
|
-
//#region src/commands/mutations/move-conditional-rule.mutation.ts
|
|
360
|
+
// src/commands/mutations/move-conditional-rule.mutation.ts
|
|
369
361
|
const MoveConditionalRuleMutation = {
|
|
370
362
|
type: _univerjs_core.CommandType.MUTATION,
|
|
371
363
|
id: "sheet.mutation.move-conditional-rule",
|
|
@@ -392,8 +384,7 @@ const MoveConditionalRuleMutationUndoFactory = (param) => {
|
|
|
392
384
|
}];
|
|
393
385
|
};
|
|
394
386
|
|
|
395
|
-
|
|
396
|
-
//#region src/commands/mutations/delete-conditional-rule.mutation.ts
|
|
387
|
+
// src/commands/mutations/delete-conditional-rule.mutation.ts
|
|
397
388
|
const DeleteConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
398
389
|
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
399
390
|
const { unitId, subUnitId, cfId } = param;
|
|
@@ -450,8 +441,7 @@ const DeleteConditionalRuleMutation = {
|
|
|
450
441
|
}
|
|
451
442
|
};
|
|
452
443
|
|
|
453
|
-
|
|
454
|
-
//#region src/commands/mutations/add-conditional-rule.mutation.ts
|
|
444
|
+
// src/commands/mutations/add-conditional-rule.mutation.ts
|
|
455
445
|
const AddConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
456
446
|
return {
|
|
457
447
|
id: DeleteConditionalRuleMutation.id,
|
|
@@ -473,8 +463,7 @@ const AddConditionalRuleMutation = {
|
|
|
473
463
|
}
|
|
474
464
|
};
|
|
475
465
|
|
|
476
|
-
|
|
477
|
-
//#region src/commands/commands/add-cf.command.ts
|
|
466
|
+
// src/commands/commands/add-cf.command.ts
|
|
478
467
|
const AddCfCommand = {
|
|
479
468
|
type: _univerjs_core.CommandType.COMMAND,
|
|
480
469
|
id: "sheet.command.add-conditional-rule",
|
|
@@ -511,16 +500,14 @@ const AddCfCommand = {
|
|
|
511
500
|
}
|
|
512
501
|
};
|
|
513
502
|
|
|
514
|
-
|
|
515
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
503
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
|
|
516
504
|
function __decorateParam(paramIndex, decorator) {
|
|
517
505
|
return function(target, key) {
|
|
518
506
|
decorator(target, key, paramIndex);
|
|
519
507
|
};
|
|
520
508
|
}
|
|
521
509
|
|
|
522
|
-
|
|
523
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
510
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
|
|
524
511
|
function __decorate(decorators, target, key, desc) {
|
|
525
512
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
526
513
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -528,8 +515,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
528
515
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
529
516
|
}
|
|
530
517
|
|
|
531
|
-
|
|
532
|
-
//#region src/models/conditional-formatting-range-index-model.ts
|
|
518
|
+
// src/models/conditional-formatting-range-index-model.ts
|
|
533
519
|
let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndexModel extends _univerjs_core.Disposable {
|
|
534
520
|
constructor(_conditionalFormattingRuleModel) {
|
|
535
521
|
super();
|
|
@@ -615,18 +601,18 @@ let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndex
|
|
|
615
601
|
};
|
|
616
602
|
ConditionalFormattingRangeIndexModel = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ConditionalFormattingRuleModel))], ConditionalFormattingRangeIndexModel);
|
|
617
603
|
|
|
618
|
-
|
|
619
|
-
//#region src/services/conditional-formatting-range-transform.service.ts
|
|
604
|
+
// src/services/conditional-formatting-range-transform.service.ts
|
|
620
605
|
var ConditionalFormattingRangeTransformService = class {
|
|
621
606
|
subtractRanges(sourceRanges, rangesToSubtract) {
|
|
622
|
-
return _univerjs_core.Rectangle.mergeRanges(_univerjs_core.Rectangle.subtractMulti(sourceRanges, rangesToSubtract));
|
|
607
|
+
return this._keepCoveredRangeType(_univerjs_core.Rectangle.mergeRanges(_univerjs_core.Rectangle.subtractMulti(sourceRanges, rangesToSubtract)), sourceRanges);
|
|
623
608
|
}
|
|
624
609
|
addRanges(sourceRanges, rangesToAdd) {
|
|
625
|
-
return _univerjs_core.Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]);
|
|
610
|
+
return this._keepCoveredRangeType(_univerjs_core.Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]), sourceRanges);
|
|
626
611
|
}
|
|
627
612
|
applyRangeDelta(sourceRanges, rangesToSubtract, rangesToAdd) {
|
|
628
|
-
const ranges = rangesToSubtract.length ?
|
|
629
|
-
|
|
613
|
+
const ranges = rangesToSubtract.length ? _univerjs_core.Rectangle.mergeRanges(_univerjs_core.Rectangle.subtractMulti(sourceRanges, rangesToSubtract)) : sourceRanges;
|
|
614
|
+
const merged = rangesToAdd.length ? _univerjs_core.Rectangle.mergeRanges([...ranges, ...rangesToAdd]) : ranges;
|
|
615
|
+
return this._keepCoveredRangeType(merged, sourceRanges);
|
|
630
616
|
}
|
|
631
617
|
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
632
618
|
const fragments = [];
|
|
@@ -648,10 +634,24 @@ var ConditionalFormattingRangeTransformService = class {
|
|
|
648
634
|
endColumn: range.endColumn + offset.col
|
|
649
635
|
};
|
|
650
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Rebuilding ranges from coordinates drops `rangeType`. A result range that still covers exactly
|
|
639
|
+
* the same cells as a whole column/row source has to keep that type, otherwise a rule that was
|
|
640
|
+
* not actually changed (for example adding an already covered range) degrades to concrete rows.
|
|
641
|
+
* Results that no longer match a source range are genuine partial coverage and stay concrete.
|
|
642
|
+
*/
|
|
643
|
+
_keepCoveredRangeType(ranges, sourceRanges) {
|
|
644
|
+
return ranges.map((range) => {
|
|
645
|
+
const source = sourceRanges.find((item) => item.rangeType && item.startRow === range.startRow && item.endRow === range.endRow && item.startColumn === range.startColumn && item.endColumn === range.endColumn);
|
|
646
|
+
return source ? {
|
|
647
|
+
...range,
|
|
648
|
+
rangeType: source.rangeType
|
|
649
|
+
} : range;
|
|
650
|
+
});
|
|
651
|
+
}
|
|
651
652
|
};
|
|
652
653
|
|
|
653
|
-
|
|
654
|
-
//#region src/commands/mutations/set-conditional-rule.mutation.ts
|
|
654
|
+
// src/commands/mutations/set-conditional-rule.mutation.ts
|
|
655
655
|
const SetConditionalRuleMutation = {
|
|
656
656
|
type: _univerjs_core.CommandType.MUTATION,
|
|
657
657
|
id: "sheet.mutation.set-conditional-rule",
|
|
@@ -680,8 +680,7 @@ const setConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
|
680
680
|
return [];
|
|
681
681
|
};
|
|
682
682
|
|
|
683
|
-
|
|
684
|
-
//#region src/commands/commands/clear-range-cf.command.ts
|
|
683
|
+
// src/commands/commands/clear-range-cf.command.ts
|
|
685
684
|
const ClearRangeCfCommand = {
|
|
686
685
|
type: _univerjs_core.CommandType.COMMAND,
|
|
687
686
|
id: "sheet.command.clear-range-conditional-rule",
|
|
@@ -747,8 +746,7 @@ const ClearRangeCfCommand = {
|
|
|
747
746
|
}
|
|
748
747
|
};
|
|
749
748
|
|
|
750
|
-
|
|
751
|
-
//#region src/commands/commands/clear-worksheet-cf.command.ts
|
|
749
|
+
// src/commands/commands/clear-worksheet-cf.command.ts
|
|
752
750
|
const ClearWorksheetCfCommand = {
|
|
753
751
|
type: _univerjs_core.CommandType.COMMAND,
|
|
754
752
|
id: "sheet.command.clear-worksheet-conditional-rule",
|
|
@@ -782,8 +780,7 @@ const ClearWorksheetCfCommand = {
|
|
|
782
780
|
}
|
|
783
781
|
};
|
|
784
782
|
|
|
785
|
-
|
|
786
|
-
//#region src/commands/commands/delete-cf.command.ts
|
|
783
|
+
// src/commands/commands/delete-cf.command.ts
|
|
787
784
|
const DeleteCfCommand = {
|
|
788
785
|
type: _univerjs_core.CommandType.COMMAND,
|
|
789
786
|
id: "sheet.command.delete-conditional-rule",
|
|
@@ -814,8 +811,7 @@ const DeleteCfCommand = {
|
|
|
814
811
|
}
|
|
815
812
|
};
|
|
816
813
|
|
|
817
|
-
|
|
818
|
-
//#region src/commands/commands/move-cf.command.ts
|
|
814
|
+
// src/commands/commands/move-cf.command.ts
|
|
819
815
|
const MoveCfCommand = {
|
|
820
816
|
type: _univerjs_core.CommandType.COMMAND,
|
|
821
817
|
id: "sheet.command.move-conditional-rule",
|
|
@@ -851,8 +847,7 @@ const MoveCfCommand = {
|
|
|
851
847
|
}
|
|
852
848
|
};
|
|
853
849
|
|
|
854
|
-
|
|
855
|
-
//#region src/commands/commands/set-cf.command.ts
|
|
850
|
+
// src/commands/commands/set-cf.command.ts
|
|
856
851
|
const SetCfCommand = {
|
|
857
852
|
type: _univerjs_core.CommandType.COMMAND,
|
|
858
853
|
id: "sheet.command.set-conditional-rule",
|
|
@@ -884,8 +879,7 @@ const SetCfCommand = {
|
|
|
884
879
|
}
|
|
885
880
|
};
|
|
886
881
|
|
|
887
|
-
|
|
888
|
-
//#region src/utils/range.ts
|
|
882
|
+
// src/utils/range.ts
|
|
889
883
|
function getRangeInWorksheet(range, worksheet) {
|
|
890
884
|
const maxRows = worksheet.getMaxRows();
|
|
891
885
|
const maxColumns = worksheet.getMaxColumns();
|
|
@@ -913,8 +907,7 @@ function getRangesInWorksheet(ranges, worksheet) {
|
|
|
913
907
|
return effectiveRanges;
|
|
914
908
|
}
|
|
915
909
|
|
|
916
|
-
|
|
917
|
-
//#region src/services/conditional-formatting-formula.service.ts
|
|
910
|
+
// src/services/conditional-formatting-formula.service.ts
|
|
918
911
|
let ConditionalFormattingFormulaService = class ConditionalFormattingFormulaService extends _univerjs_core.Disposable {
|
|
919
912
|
constructor(_registerOtherFormulaService, _conditionalFormattingRuleModel, _univerInstanceService) {
|
|
920
913
|
super();
|
|
@@ -1098,8 +1091,7 @@ ConditionalFormattingFormulaService = __decorate([
|
|
|
1098
1091
|
__decorateParam(2, _univerjs_core.IUniverInstanceService)
|
|
1099
1092
|
], ConditionalFormattingFormulaService);
|
|
1100
1093
|
|
|
1101
|
-
|
|
1102
|
-
//#region src/models/calculate-unit-v2/base-calculate-unit.ts
|
|
1094
|
+
// src/models/calculate-unit-v2/base-calculate-unit.ts
|
|
1103
1095
|
/**
|
|
1104
1096
|
* Processing Main Path Calculation Logic
|
|
1105
1097
|
*/
|
|
@@ -1172,8 +1164,7 @@ var BaseCalculateUnit = class {
|
|
|
1172
1164
|
}
|
|
1173
1165
|
};
|
|
1174
1166
|
|
|
1175
|
-
|
|
1176
|
-
//#region src/models/calculate-unit-v2/color-scale-calculate-unit.ts
|
|
1167
|
+
// src/models/calculate-unit-v2/color-scale-calculate-unit.ts
|
|
1177
1168
|
var ColorScaleCalculateUnit = class extends BaseCalculateUnit {
|
|
1178
1169
|
preComputing(_row, _col, context) {
|
|
1179
1170
|
const rule = context.rule;
|
|
@@ -1225,8 +1216,155 @@ var ColorScaleCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1225
1216
|
}
|
|
1226
1217
|
};
|
|
1227
1218
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1219
|
+
// src/render/conditional-formatting-raster-cache.ts
|
|
1220
|
+
/**
|
|
1221
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1222
|
+
*
|
|
1223
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1224
|
+
* you may not use this file except in compliance with the License.
|
|
1225
|
+
* You may obtain a copy of the License at
|
|
1226
|
+
*
|
|
1227
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1228
|
+
*
|
|
1229
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1230
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1231
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1232
|
+
* See the License for the specific language governing permissions and
|
|
1233
|
+
* limitations under the License.
|
|
1234
|
+
*/
|
|
1235
|
+
const MAX_ENTRIES = 128;
|
|
1236
|
+
const MAX_PIXELS = 524288;
|
|
1237
|
+
const MAX_BITMAP_PIXELS = 131072;
|
|
1238
|
+
/** Retain physical pixels without mutating image sources already submitted to the destination. */
|
|
1239
|
+
var ConditionalFormattingRasterCache = class extends _univerjs_core.Disposable {
|
|
1240
|
+
constructor(..._args) {
|
|
1241
|
+
super(..._args);
|
|
1242
|
+
_defineProperty(this, "_bitmaps", /* @__PURE__ */ new Map());
|
|
1243
|
+
_defineProperty(this, "_pixels", 0);
|
|
1244
|
+
}
|
|
1245
|
+
draw(ctx, x, y, width, height, variant, draw, strokeWidth = 0) {
|
|
1246
|
+
var _native$getContextAtt;
|
|
1247
|
+
this.ensureNotDisposed();
|
|
1248
|
+
const native = ctx._context;
|
|
1249
|
+
const m = native === null || native === void 0 ? void 0 : native.getTransform();
|
|
1250
|
+
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;
|
|
1251
|
+
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 || ![
|
|
1252
|
+
"rgba(0, 0, 0, 0)",
|
|
1253
|
+
"transparent",
|
|
1254
|
+
"#00000000"
|
|
1255
|
+
].includes(native.shadowColor) || native.filter && native.filter !== "none" || width <= 0 || height <= 0 || typeof native.fillStyle !== "string" || typeof native.strokeStyle !== "string") {
|
|
1256
|
+
draw(ctx, x, y);
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
const px = x * m.a + m.e;
|
|
1260
|
+
const py = y * m.d + m.f;
|
|
1261
|
+
const padding = Math.max(2, Math.ceil(strokeWidth * m.a / 2) + 1);
|
|
1262
|
+
const left = Math.floor(px) - padding;
|
|
1263
|
+
const top = Math.floor(py) - padding;
|
|
1264
|
+
const pixelWidth = Math.ceil(px + width * m.a) - left + padding;
|
|
1265
|
+
const pixelHeight = Math.ceil(py + height * m.d) - top + padding;
|
|
1266
|
+
const pixels = pixelWidth * pixelHeight;
|
|
1267
|
+
if (!Number.isFinite(pixels) || pixels > MAX_BITMAP_PIXELS) {
|
|
1268
|
+
draw(ctx, x, y);
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
const localX = px - left;
|
|
1272
|
+
const localY = py - top;
|
|
1273
|
+
const dash = native.getLineDash();
|
|
1274
|
+
const key = JSON.stringify([
|
|
1275
|
+
variant,
|
|
1276
|
+
width,
|
|
1277
|
+
height,
|
|
1278
|
+
m.a,
|
|
1279
|
+
localX,
|
|
1280
|
+
localY,
|
|
1281
|
+
strokeWidth,
|
|
1282
|
+
native.fillStyle,
|
|
1283
|
+
native.strokeStyle,
|
|
1284
|
+
dash,
|
|
1285
|
+
native.lineDashOffset,
|
|
1286
|
+
native.lineCap,
|
|
1287
|
+
native.lineJoin,
|
|
1288
|
+
native.miterLimit,
|
|
1289
|
+
native.imageSmoothingEnabled,
|
|
1290
|
+
native.imageSmoothingQuality
|
|
1291
|
+
]);
|
|
1292
|
+
let bitmap = this._bitmaps.get(key);
|
|
1293
|
+
if (!bitmap) {
|
|
1294
|
+
const canvas = document.createElement("canvas");
|
|
1295
|
+
canvas.width = pixelWidth;
|
|
1296
|
+
canvas.height = pixelHeight;
|
|
1297
|
+
const context = canvas.getContext("2d");
|
|
1298
|
+
if (!context) {
|
|
1299
|
+
draw(ctx, x, y);
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
const paint = new _univerjs_engine_render.UniverRenderingContext(context);
|
|
1303
|
+
paint.setTransform(m.a, 0, 0, m.d, localX, localY);
|
|
1304
|
+
paint.setLineDash(dash);
|
|
1305
|
+
paint.lineDashOffset = native.lineDashOffset;
|
|
1306
|
+
paint.lineCap = native.lineCap;
|
|
1307
|
+
paint.lineJoin = native.lineJoin;
|
|
1308
|
+
paint.miterLimit = native.miterLimit;
|
|
1309
|
+
paint.imageSmoothingEnabled = native.imageSmoothingEnabled;
|
|
1310
|
+
paint.imageSmoothingQuality = native.imageSmoothingQuality;
|
|
1311
|
+
draw(paint, 0, 0);
|
|
1312
|
+
while (this._bitmaps.size >= MAX_ENTRIES || this._pixels + pixels > MAX_PIXELS) {
|
|
1313
|
+
const oldestKey = this._bitmaps.keys().next().value;
|
|
1314
|
+
if (oldestKey === void 0) break;
|
|
1315
|
+
this._pixels -= this._bitmaps.get(oldestKey).pixels;
|
|
1316
|
+
this._bitmaps.delete(oldestKey);
|
|
1317
|
+
}
|
|
1318
|
+
bitmap = {
|
|
1319
|
+
canvas,
|
|
1320
|
+
pixels
|
|
1321
|
+
};
|
|
1322
|
+
this._bitmaps.set(key, bitmap);
|
|
1323
|
+
this._pixels += pixels;
|
|
1324
|
+
}
|
|
1325
|
+
ctx.save();
|
|
1326
|
+
try {
|
|
1327
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
1328
|
+
ctx.imageSmoothingEnabled = false;
|
|
1329
|
+
ctx.drawImage(bitmap.canvas, left, top);
|
|
1330
|
+
} finally {
|
|
1331
|
+
ctx.restore();
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
dispose() {
|
|
1335
|
+
for (const { canvas } of this._bitmaps.values()) {
|
|
1336
|
+
canvas.width = 0;
|
|
1337
|
+
canvas.height = 0;
|
|
1338
|
+
}
|
|
1339
|
+
this._bitmaps.clear();
|
|
1340
|
+
this._pixels = 0;
|
|
1341
|
+
super.dispose();
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
// src/render/resolve-render-ranges.ts
|
|
1346
|
+
function resolveRenderRanges(worksheet, sourceRanges, resolver) {
|
|
1347
|
+
if (!resolver) return sourceRanges;
|
|
1348
|
+
const mergedRanges = worksheet.getMergeData().length ? sourceRanges.flatMap((range) => worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn)) : [];
|
|
1349
|
+
const queryRanges = mergedRanges.length ? [...sourceRanges, ...mergedRanges.map((range) => ({
|
|
1350
|
+
startRow: range.startRow,
|
|
1351
|
+
endRow: range.startRow,
|
|
1352
|
+
startColumn: range.startColumn,
|
|
1353
|
+
endColumn: range.startColumn
|
|
1354
|
+
}))] : sourceRanges;
|
|
1355
|
+
const resolved = resolver(worksheet.getUnitId(), worksheet.getSheetId(), queryRanges);
|
|
1356
|
+
if (!resolved) return sourceRanges;
|
|
1357
|
+
if (!mergedRanges.length || !resolved.length) return resolved;
|
|
1358
|
+
const formattedMerges = mergedRanges.filter((merge) => resolved.some((range) => _univerjs_core.Rectangle.intersects(merge, range)));
|
|
1359
|
+
const clipped = [];
|
|
1360
|
+
for (const source of sourceRanges) for (const range of [...resolved, ...formattedMerges]) {
|
|
1361
|
+
const intersection = (0, _univerjs_core.getIntersectRange)(source, range);
|
|
1362
|
+
if (intersection) clipped.push(intersection);
|
|
1363
|
+
}
|
|
1364
|
+
return clipped.length > 1 ? _univerjs_core.Rectangle.mergeRanges(clipped) : clipped;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// src/render/data-bar.render.ts
|
|
1230
1368
|
const dataBarUKey = "sheet-conditional-rule-data-bar";
|
|
1231
1369
|
const defaultDataBarPositiveColor = "#ffbe38";
|
|
1232
1370
|
const defaultDataBarNativeColor = "#abd91a";
|
|
@@ -1236,11 +1374,13 @@ const stringifyRange$1 = (range) => {
|
|
|
1236
1374
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
1237
1375
|
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
1238
1376
|
};
|
|
1239
|
-
var DataBar = class extends _univerjs_engine_render.SheetExtension {
|
|
1377
|
+
var DataBar = class DataBar extends _univerjs_engine_render.SheetExtension {
|
|
1240
1378
|
constructor(..._args) {
|
|
1241
1379
|
super(..._args);
|
|
1380
|
+
_defineProperty(this, "viewportCacheReusable", this.constructor === DataBar);
|
|
1242
1381
|
_defineProperty(this, "_paddingRightAndLeft", 2);
|
|
1243
1382
|
_defineProperty(this, "_paddingTopAndBottom", 2);
|
|
1383
|
+
_defineProperty(this, "_rasterCache", new ConditionalFormattingRasterCache());
|
|
1244
1384
|
_defineProperty(this, "_renderRangeResolver", null);
|
|
1245
1385
|
_defineProperty(this, "uKey", dataBarUKey);
|
|
1246
1386
|
_defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX$1);
|
|
@@ -1254,7 +1394,7 @@ var DataBar = class extends _univerjs_engine_render.SheetExtension {
|
|
|
1254
1394
|
if (!worksheet) return false;
|
|
1255
1395
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
1256
1396
|
const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
|
|
1257
|
-
const renderRanges =
|
|
1397
|
+
const renderRanges = resolveRenderRanges(worksheet, sourceRanges, this._renderRangeResolver);
|
|
1258
1398
|
if (!renderRanges.length) return;
|
|
1259
1399
|
ctx.save();
|
|
1260
1400
|
renderRanges.forEach((range) => {
|
|
@@ -1277,43 +1417,42 @@ var DataBar = class extends _univerjs_engine_render.SheetExtension {
|
|
|
1277
1417
|
const borderHeight = endY + _univerjs_engine_render.FIX_ONE_PIXEL_BLUR_OFFSET - startY;
|
|
1278
1418
|
const width = borderWidth - this._paddingRightAndLeft * 2;
|
|
1279
1419
|
const height = borderHeight - this._paddingTopAndBottom * 2;
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1420
|
+
const positive = value > 0;
|
|
1421
|
+
const dataBarWidth = Math.max(positive ? width * (1 - startPoint / 100) * value / 100 : width * startPoint / 100 * Math.abs(value) / 100, 1);
|
|
1422
|
+
const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - (positive ? 0 : dataBarWidth);
|
|
1423
|
+
const y0 = startY + this._paddingTopAndBottom;
|
|
1424
|
+
ctx.fillStyle = color;
|
|
1425
|
+
ctx.strokeStyle = color;
|
|
1426
|
+
const fillColor = ctx.fillStyle;
|
|
1427
|
+
const strokeColor = ctx.strokeStyle;
|
|
1428
|
+
this._drawAtLocalOrigin(ctx, x0, y0, dataBarWidth, height, (paint, x, y) => {
|
|
1284
1429
|
if (isGradient) {
|
|
1285
|
-
const gradient =
|
|
1286
|
-
gradient.addColorStop(0, color);
|
|
1287
|
-
gradient.addColorStop(1, "rgb(255 255 255)");
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
} else
|
|
1292
|
-
this._drawRectWithRoundedCorner(
|
|
1293
|
-
if (isGradient)
|
|
1294
|
-
}
|
|
1295
|
-
const dataBarWidth = Math.max(width * startPoint / 100 * Math.abs(value) / 100, 1);
|
|
1296
|
-
const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - dataBarWidth;
|
|
1297
|
-
const y0 = startY + this._paddingTopAndBottom;
|
|
1298
|
-
if (isGradient) {
|
|
1299
|
-
const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
|
|
1300
|
-
gradient.addColorStop(0, "rgb(255 255 255)");
|
|
1301
|
-
gradient.addColorStop(1, color);
|
|
1302
|
-
ctx.fillStyle = gradient;
|
|
1303
|
-
ctx.strokeStyle = color;
|
|
1304
|
-
ctx.lineWidth = 1;
|
|
1305
|
-
} else ctx.fillStyle = color;
|
|
1306
|
-
this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, true, false, false, true);
|
|
1307
|
-
if (isGradient) ctx.stroke();
|
|
1308
|
-
}
|
|
1430
|
+
const gradient = paint.createLinearGradient(x, y, x + dataBarWidth, y);
|
|
1431
|
+
gradient.addColorStop(0, positive ? color : "rgb(255 255 255)");
|
|
1432
|
+
gradient.addColorStop(1, positive ? "rgb(255 255 255)" : color);
|
|
1433
|
+
paint.fillStyle = gradient;
|
|
1434
|
+
paint.strokeStyle = paint === ctx ? color : strokeColor;
|
|
1435
|
+
paint.lineWidth = 1;
|
|
1436
|
+
} else paint.fillStyle = paint === ctx ? color : fillColor;
|
|
1437
|
+
this._drawRectWithRoundedCorner(paint, x, y, dataBarWidth, height, !positive, positive, positive, !positive);
|
|
1438
|
+
if (isGradient) paint.stroke();
|
|
1439
|
+
}, `${positive}:${isGradient}:${this._radius}:${color}`, isGradient ? 1 : 0);
|
|
1309
1440
|
});
|
|
1310
1441
|
});
|
|
1311
1442
|
ctx.restore();
|
|
1312
1443
|
}
|
|
1313
1444
|
dispose() {
|
|
1445
|
+
this._rasterCache.dispose();
|
|
1314
1446
|
this._renderRangeResolver = null;
|
|
1315
1447
|
super.dispose();
|
|
1316
1448
|
}
|
|
1449
|
+
_drawAtLocalOrigin(ctx, x, y, width, height, draw, variant = "", strokeWidth = 0) {
|
|
1450
|
+
if (typeof navigator !== "undefined" && (ctx.getBrowserType() === "Safari" || _univerjs_core.Tools.isIPhone())) {
|
|
1451
|
+
draw(ctx, x, y);
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
this._rasterCache.draw(ctx, x, y, width, height, variant, draw, strokeWidth);
|
|
1455
|
+
}
|
|
1317
1456
|
_drawRectWithRoundedCorner(ctx, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
|
|
1318
1457
|
const radius = this._radius;
|
|
1319
1458
|
if (!height || !width) return;
|
|
@@ -1337,8 +1476,7 @@ var DataBar = class extends _univerjs_engine_render.SheetExtension {
|
|
|
1337
1476
|
};
|
|
1338
1477
|
_univerjs_engine_render.SpreadsheetExtensionRegistry.add(DataBar);
|
|
1339
1478
|
|
|
1340
|
-
|
|
1341
|
-
//#region src/models/calculate-unit-v2/data-bar-calculate-unit.ts
|
|
1479
|
+
// src/models/calculate-unit-v2/data-bar-calculate-unit.ts
|
|
1342
1480
|
const getSafeValue = (v) => Math.max(Math.min(100, v), 0);
|
|
1343
1481
|
const getValue$1 = (row, col, getCell) => {
|
|
1344
1482
|
const cell = getCell(row, col);
|
|
@@ -1465,8 +1603,7 @@ var DataBarCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1465
1603
|
}
|
|
1466
1604
|
};
|
|
1467
1605
|
|
|
1468
|
-
|
|
1469
|
-
//#region src/models/calculate-unit-v2/highlight-cell-calculate-unit.ts
|
|
1606
|
+
// src/models/calculate-unit-v2/highlight-cell-calculate-unit.ts
|
|
1470
1607
|
const isFormulaResultMatched = (value) => value === true || value === 1 || value === "TRUE";
|
|
1471
1608
|
const sortRangesByTopLeft = (ranges) => [...ranges].sort((a, b) => {
|
|
1472
1609
|
if (a.startRow !== b.startRow) return a.startRow - b.startRow;
|
|
@@ -1754,8 +1891,7 @@ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1754
1891
|
}
|
|
1755
1892
|
};
|
|
1756
1893
|
|
|
1757
|
-
|
|
1758
|
-
//#region src/models/calculate-unit-v2/icon-set-calculate-unit.ts
|
|
1894
|
+
// src/models/calculate-unit-v2/icon-set-calculate-unit.ts
|
|
1759
1895
|
const getValue = (row, col, getCell) => {
|
|
1760
1896
|
const cell = getCell(row, col);
|
|
1761
1897
|
if (cell && cell.t === _univerjs_core.CellValueType.NUMBER) {
|
|
@@ -1846,8 +1982,7 @@ var IconSetCalculateUnit = class extends BaseCalculateUnit {
|
|
|
1846
1982
|
}
|
|
1847
1983
|
};
|
|
1848
1984
|
|
|
1849
|
-
|
|
1850
|
-
//#region src/models/conditional-formatting-view-model.ts
|
|
1985
|
+
// src/models/conditional-formatting-view-model.ts
|
|
1851
1986
|
const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH = 9e3;
|
|
1852
1987
|
let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extends _univerjs_core.Disposable {
|
|
1853
1988
|
constructor(_injector, _conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService, _univerInstanceService) {
|
|
@@ -2060,8 +2195,7 @@ ConditionalFormattingViewModel = __decorate([
|
|
|
2060
2195
|
__decorateParam(4, _univerjs_core.IUniverInstanceService)
|
|
2061
2196
|
], ConditionalFormattingViewModel);
|
|
2062
2197
|
|
|
2063
|
-
|
|
2064
|
-
//#region src/models/calculate-unit-v2/utils.ts
|
|
2198
|
+
// src/models/calculate-unit-v2/utils.ts
|
|
2065
2199
|
function isFloatsEqual(a, b) {
|
|
2066
2200
|
return Math.abs(a - b) < Number.EPSILON;
|
|
2067
2201
|
}
|
|
@@ -2249,8 +2383,7 @@ function getMaxInFormulaResult(result) {
|
|
|
2249
2383
|
return max;
|
|
2250
2384
|
}
|
|
2251
2385
|
|
|
2252
|
-
|
|
2253
|
-
//#region src/assets/icon-map.ts
|
|
2386
|
+
// src/assets/icon-map.ts
|
|
2254
2387
|
const ICON_MAP = {
|
|
2255
2388
|
"feedback": {
|
|
2256
2389
|
"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",
|
|
@@ -2284,16 +2417,16 @@ const ICON_MAP = {
|
|
|
2284
2417
|
"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"
|
|
2285
2418
|
},
|
|
2286
2419
|
"arrow": {
|
|
2287
|
-
"down-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2288
|
-
"right-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2289
|
-
"up-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2290
|
-
"rightAndDown-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2291
|
-
"rightAndUp-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2292
|
-
"down-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2293
|
-
"right-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2294
|
-
"up-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2295
|
-
"rightAndDown-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2296
|
-
"rightAndUp-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%
|
|
2420
|
+
"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",
|
|
2421
|
+
"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",
|
|
2422
|
+
"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",
|
|
2423
|
+
"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",
|
|
2424
|
+
"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",
|
|
2425
|
+
"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",
|
|
2426
|
+
"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",
|
|
2427
|
+
"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",
|
|
2428
|
+
"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",
|
|
2429
|
+
"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"
|
|
2297
2430
|
},
|
|
2298
2431
|
"shape": {
|
|
2299
2432
|
"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",
|
|
@@ -2313,9 +2446,9 @@ const ICON_MAP = {
|
|
|
2313
2446
|
"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"
|
|
2314
2447
|
},
|
|
2315
2448
|
"feedback2": {
|
|
2316
|
-
"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%
|
|
2449
|
+
"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",
|
|
2317
2450
|
"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",
|
|
2318
|
-
"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%
|
|
2451
|
+
"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"
|
|
2319
2452
|
},
|
|
2320
2453
|
"flag": {
|
|
2321
2454
|
"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",
|
|
@@ -2331,8 +2464,7 @@ const ICON_MAP = {
|
|
|
2331
2464
|
}
|
|
2332
2465
|
};
|
|
2333
2466
|
|
|
2334
|
-
|
|
2335
|
-
//#region src/models/icon-map.ts
|
|
2467
|
+
// src/models/icon-map.ts
|
|
2336
2468
|
let IIconSetType = /* @__PURE__ */ function(IIconSetType) {
|
|
2337
2469
|
IIconSetType["threeArrows"] = "3Arrows";
|
|
2338
2470
|
IIconSetType["threeArrowsGray"] = "3ArrowsGray";
|
|
@@ -2575,13 +2707,11 @@ for (const key in iconMap) {
|
|
|
2575
2707
|
Object.freeze(v);
|
|
2576
2708
|
}
|
|
2577
2709
|
|
|
2578
|
-
|
|
2579
|
-
//#region package.json
|
|
2710
|
+
// package.json
|
|
2580
2711
|
var name = "@univerjs/sheets-conditional-formatting";
|
|
2581
|
-
var version = "1.
|
|
2712
|
+
var version = "1.5.0";
|
|
2582
2713
|
|
|
2583
|
-
|
|
2584
|
-
//#region src/config/config.ts
|
|
2714
|
+
// src/config/config.ts
|
|
2585
2715
|
/**
|
|
2586
2716
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2587
2717
|
*
|
|
@@ -2601,8 +2731,7 @@ const SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY = "ssheets-conditional-for
|
|
|
2601
2731
|
const configSymbol = Symbol(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY);
|
|
2602
2732
|
const defaultPluginConfig = {};
|
|
2603
2733
|
|
|
2604
|
-
|
|
2605
|
-
//#region src/services/conditional-formatting-style-composer.service.ts
|
|
2734
|
+
// src/services/conditional-formatting-style-composer.service.ts
|
|
2606
2735
|
/**
|
|
2607
2736
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2608
2737
|
*
|
|
@@ -2696,8 +2825,7 @@ let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleCompose
|
|
|
2696
2825
|
};
|
|
2697
2826
|
ConditionalFormattingStyleComposer = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(ConditionalFormattingRuleModel)), __decorateParam(1, (0, _univerjs_core.Inject)(ConditionalFormattingViewModel))], ConditionalFormattingStyleComposer);
|
|
2698
2827
|
|
|
2699
|
-
|
|
2700
|
-
//#region src/services/conditional-formatting.service.ts
|
|
2828
|
+
// src/services/conditional-formatting.service.ts
|
|
2701
2829
|
let ConditionalFormattingService = class ConditionalFormattingService extends _univerjs_core.Disposable {
|
|
2702
2830
|
get _conditionalFormattingViewModelV2() {
|
|
2703
2831
|
return this._injector.get(ConditionalFormattingViewModel);
|
|
@@ -2843,7 +2971,9 @@ let ConditionalFormattingService = class ConditionalFormattingService extends _u
|
|
|
2843
2971
|
};
|
|
2844
2972
|
switch (commandInfo.id) {
|
|
2845
2973
|
case _univerjs_sheets.SetRangeValuesMutation.id: {
|
|
2974
|
+
var _this$_conditionalFor;
|
|
2846
2975
|
const { subUnitId, unitId, cellValue } = commandInfo.params;
|
|
2976
|
+
if (!((_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId)) === null || _this$_conditionalFor === void 0 ? void 0 : _this$_conditionalFor.length)) break;
|
|
2847
2977
|
const ranges = [];
|
|
2848
2978
|
new _univerjs_core.ObjectMatrix(cellValue).forValue((row, col, value) => {
|
|
2849
2979
|
if (value && Object.keys(value).some((key) => ["p", "v"].includes(key))) ranges.push({
|
|
@@ -2948,8 +3078,7 @@ ConditionalFormattingService = __decorate([
|
|
|
2948
3078
|
__decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService))
|
|
2949
3079
|
], ConditionalFormattingService);
|
|
2950
3080
|
|
|
2951
|
-
|
|
2952
|
-
//#region src/plugin.ts
|
|
3081
|
+
// src/plugin.ts
|
|
2953
3082
|
let UniverSheetsConditionalFormattingPlugin = class UniverSheetsConditionalFormattingPlugin extends _univerjs_core.Plugin {
|
|
2954
3083
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
|
2955
3084
|
super();
|
|
@@ -3005,8 +3134,7 @@ UniverSheetsConditionalFormattingPlugin = __decorate([
|
|
|
3005
3134
|
__decorateParam(3, _univerjs_core.IConfigService)
|
|
3006
3135
|
], UniverSheetsConditionalFormattingPlugin);
|
|
3007
3136
|
|
|
3008
|
-
|
|
3009
|
-
//#region src/render/icon.render.ts
|
|
3137
|
+
// src/render/icon.render.ts
|
|
3010
3138
|
const IconUKey = "sheet-conditional-rule-icon";
|
|
3011
3139
|
const EXTENSION_Z_INDEX = 35;
|
|
3012
3140
|
const DEFAULT_WIDTH = 15;
|
|
@@ -3015,12 +3143,15 @@ const stringifyRange = (range) => {
|
|
|
3015
3143
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
3016
3144
|
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
3017
3145
|
};
|
|
3018
|
-
var ConditionalFormattingIcon = class extends _univerjs_engine_render.SheetExtension {
|
|
3146
|
+
var ConditionalFormattingIcon = class ConditionalFormattingIcon extends _univerjs_engine_render.SheetExtension {
|
|
3019
3147
|
constructor() {
|
|
3020
3148
|
super();
|
|
3149
|
+
_defineProperty(this, "viewportCacheReusable", this.constructor === ConditionalFormattingIcon);
|
|
3021
3150
|
_defineProperty(this, "_paddingRightAndLeft", 2);
|
|
3022
3151
|
_defineProperty(this, "_width", 15);
|
|
3023
3152
|
_defineProperty(this, "_imageMap", /* @__PURE__ */ new Map());
|
|
3153
|
+
_defineProperty(this, "_rasterCache", new ConditionalFormattingRasterCache());
|
|
3154
|
+
_defineProperty(this, "_pendingImages", /* @__PURE__ */ new Set());
|
|
3024
3155
|
_defineProperty(this, "_renderRangeResolver", null);
|
|
3025
3156
|
_defineProperty(this, "uKey", IconUKey);
|
|
3026
3157
|
_defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX);
|
|
@@ -3035,7 +3166,7 @@ var ConditionalFormattingIcon = class extends _univerjs_engine_render.SheetExten
|
|
|
3035
3166
|
if (!worksheet) return false;
|
|
3036
3167
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
3037
3168
|
const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
|
|
3038
|
-
const renderRanges =
|
|
3169
|
+
const renderRanges = resolveRenderRanges(worksheet, sourceRanges, this._renderRangeResolver);
|
|
3039
3170
|
if (!renderRanges.length) return;
|
|
3040
3171
|
ctx.save();
|
|
3041
3172
|
renderRanges.forEach((range) => {
|
|
@@ -3061,22 +3192,40 @@ var ConditionalFormattingIcon = class extends _univerjs_engine_render.SheetExten
|
|
|
3061
3192
|
const borderHeight = endY - startY;
|
|
3062
3193
|
if (this._width > borderHeight || this._width > borderWidth + this._paddingRightAndLeft * 2) return;
|
|
3063
3194
|
const y = (borderHeight - this._width) / 2 + startY;
|
|
3064
|
-
|
|
3195
|
+
this._drawIcon(ctx, icon, startX + this._paddingRightAndLeft, y);
|
|
3065
3196
|
});
|
|
3066
3197
|
});
|
|
3067
3198
|
ctx.restore();
|
|
3068
3199
|
}
|
|
3069
3200
|
dispose() {
|
|
3201
|
+
this._rasterCache.dispose();
|
|
3202
|
+
for (const image of this._pendingImages) image.onload = null;
|
|
3203
|
+
this._pendingImages.clear();
|
|
3204
|
+
this._imageMap.clear();
|
|
3070
3205
|
this._renderRangeResolver = null;
|
|
3071
3206
|
super.dispose();
|
|
3072
3207
|
}
|
|
3208
|
+
_drawIcon(ctx, image, x, y) {
|
|
3209
|
+
if (!ctx._context || ctx.__mode === "printing" || ctx.getSystemType() !== "Linux") {
|
|
3210
|
+
ctx.drawImage(image, x, y, this._width, this._width);
|
|
3211
|
+
return;
|
|
3212
|
+
}
|
|
3213
|
+
this._rasterCache.draw(ctx, x, y, this._width, this._width, image.src, (paint, left, top) => {
|
|
3214
|
+
paint.drawImage(image, left, top, this._width, this._width);
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3073
3217
|
_init() {
|
|
3074
3218
|
for (const type in iconMap) iconMap[type].forEach((base64, index) => {
|
|
3075
3219
|
const key = this._createKey(type, String(index));
|
|
3076
3220
|
const image = new Image();
|
|
3077
3221
|
image.onload = () => {
|
|
3222
|
+
var _this$parent;
|
|
3223
|
+
image.onload = null;
|
|
3224
|
+
this._pendingImages.delete(image);
|
|
3078
3225
|
this._imageMap.set(key, image);
|
|
3226
|
+
(_this$parent = this.parent) === null || _this$parent === void 0 || _this$parent.makeDirty(true);
|
|
3079
3227
|
};
|
|
3228
|
+
this._pendingImages.add(image);
|
|
3080
3229
|
image.src = base64;
|
|
3081
3230
|
});
|
|
3082
3231
|
}
|
|
@@ -3086,8 +3235,7 @@ var ConditionalFormattingIcon = class extends _univerjs_engine_render.SheetExten
|
|
|
3086
3235
|
};
|
|
3087
3236
|
_univerjs_engine_render.SpreadsheetExtensionRegistry.add(ConditionalFormattingIcon);
|
|
3088
3237
|
|
|
3089
|
-
|
|
3090
|
-
//#region src/utils/remove-undefined-attr.ts
|
|
3238
|
+
// src/utils/remove-undefined-attr.ts
|
|
3091
3239
|
/**
|
|
3092
3240
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3093
3241
|
*
|
|
@@ -3113,7 +3261,6 @@ function removeUndefinedAttr(obj) {
|
|
|
3113
3261
|
return result;
|
|
3114
3262
|
}
|
|
3115
3263
|
|
|
3116
|
-
//#endregion
|
|
3117
3264
|
exports.AddCfCommand = AddCfCommand;
|
|
3118
3265
|
exports.AddConditionalRuleMutation = AddConditionalRuleMutation;
|
|
3119
3266
|
exports.AddConditionalRuleMutationUndoFactory = AddConditionalRuleMutationUndoFactory;
|