@univerjs/sheets-conditional-formatting-ui 1.0.0-beta.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +281 -316
- package/lib/cjs/locale/ar-SA.js +2 -7
- package/lib/cjs/locale/ca-ES.js +2 -7
- package/lib/cjs/locale/de-DE.js +2 -7
- package/lib/cjs/locale/en-US.js +2 -7
- package/lib/cjs/locale/es-ES.js +2 -7
- package/lib/cjs/locale/fa-IR.js +2 -7
- package/lib/cjs/locale/fr-FR.js +2 -7
- package/lib/cjs/locale/id-ID.js +2 -7
- package/lib/cjs/locale/it-IT.js +2 -7
- package/lib/cjs/locale/ja-JP.js +2 -7
- package/lib/cjs/locale/ko-KR.js +2 -7
- package/lib/cjs/locale/pl-PL.js +2 -7
- package/lib/cjs/locale/pt-BR.js +2 -7
- package/lib/cjs/locale/ru-RU.js +2 -7
- package/lib/cjs/locale/sk-SK.js +2 -7
- package/lib/cjs/locale/vi-VN.js +2 -7
- package/lib/cjs/locale/zh-CN.js +2 -7
- package/lib/cjs/locale/zh-HK.js +2 -7
- package/lib/cjs/locale/zh-TW.js +2 -7
- package/lib/es/index.js +283 -318
- package/lib/es/locale/ar-SA.js +2 -7
- package/lib/es/locale/ca-ES.js +2 -7
- package/lib/es/locale/de-DE.js +2 -7
- package/lib/es/locale/en-US.js +2 -7
- package/lib/es/locale/es-ES.js +2 -7
- package/lib/es/locale/fa-IR.js +2 -7
- package/lib/es/locale/fr-FR.js +2 -7
- package/lib/es/locale/id-ID.js +2 -7
- package/lib/es/locale/it-IT.js +2 -7
- package/lib/es/locale/ja-JP.js +2 -7
- package/lib/es/locale/ko-KR.js +2 -7
- package/lib/es/locale/pl-PL.js +2 -7
- package/lib/es/locale/pt-BR.js +2 -7
- package/lib/es/locale/ru-RU.js +2 -7
- package/lib/es/locale/sk-SK.js +2 -7
- package/lib/es/locale/vi-VN.js +2 -7
- package/lib/es/locale/zh-CN.js +2 -7
- package/lib/es/locale/zh-HK.js +2 -7
- package/lib/es/locale/zh-TW.js +2 -7
- package/lib/index.css +40 -18
- package/lib/index.js +283 -318
- package/lib/locale/ar-SA.js +2 -7
- package/lib/locale/ca-ES.js +2 -7
- package/lib/locale/de-DE.js +2 -7
- package/lib/locale/en-US.js +2 -7
- package/lib/locale/es-ES.js +2 -7
- package/lib/locale/fa-IR.js +2 -7
- package/lib/locale/fr-FR.js +2 -7
- package/lib/locale/id-ID.js +2 -7
- package/lib/locale/it-IT.js +2 -7
- package/lib/locale/ja-JP.js +2 -7
- package/lib/locale/ko-KR.js +2 -7
- package/lib/locale/pl-PL.js +2 -7
- package/lib/locale/pt-BR.js +2 -7
- package/lib/locale/ru-RU.js +2 -7
- package/lib/locale/sk-SK.js +2 -7
- package/lib/locale/vi-VN.js +2 -7
- package/lib/locale/zh-CN.js +2 -7
- package/lib/locale/zh-HK.js +2 -7
- package/lib/locale/zh-TW.js +2 -7
- package/lib/types/controllers/cf.auto-fill.controller.d.ts +2 -3
- package/lib/types/controllers/cf.copy-paste.controller.d.ts +2 -3
- package/lib/types/controllers/cf.painter.controller.d.ts +2 -3
- package/lib/types/controllers/cf.render.controller.d.ts +7 -2
- package/lib/types/locale/en-US.d.ts +0 -5
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
package/lib/cjs/index.js
CHANGED
|
@@ -985,7 +985,7 @@ const menuSchema = {
|
|
|
985
985
|
//#endregion
|
|
986
986
|
//#region package.json
|
|
987
987
|
var name = "@univerjs/sheets-conditional-formatting-ui";
|
|
988
|
-
var version = "1.0.0-beta.
|
|
988
|
+
var version = "1.0.0-beta.2";
|
|
989
989
|
|
|
990
990
|
//#endregion
|
|
991
991
|
//#region src/config/config.ts
|
|
@@ -1182,12 +1182,11 @@ const specialPastes = [
|
|
|
1182
1182
|
_univerjs_sheets_ui.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER
|
|
1183
1183
|
];
|
|
1184
1184
|
let ConditionalFormattingCopyPasteController = class ConditionalFormattingCopyPasteController extends _univerjs_core.Disposable {
|
|
1185
|
-
constructor(_sheetClipboardService, _conditionalFormattingRuleModel, _injector,
|
|
1185
|
+
constructor(_sheetClipboardService, _conditionalFormattingRuleModel, _injector, _univerInstanceService, _conditionalFormattingRangeTransformService) {
|
|
1186
1186
|
super();
|
|
1187
1187
|
this._sheetClipboardService = _sheetClipboardService;
|
|
1188
1188
|
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
1189
1189
|
this._injector = _injector;
|
|
1190
|
-
this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
|
|
1191
1190
|
this._univerInstanceService = _univerInstanceService;
|
|
1192
1191
|
this._conditionalFormattingRangeTransformService = _conditionalFormattingRangeTransformService;
|
|
1193
1192
|
_defineProperty(this, "_copyInfo", void 0);
|
|
@@ -1207,10 +1206,11 @@ let ConditionalFormattingCopyPasteController = class ConditionalFormattingCopyPa
|
|
|
1207
1206
|
}));
|
|
1208
1207
|
}
|
|
1209
1208
|
_collectConditionalRule(unitId, subUnitId, range) {
|
|
1210
|
-
|
|
1209
|
+
var _this$_conditionalFor;
|
|
1210
|
+
const rules = /* @__PURE__ */ new Map();
|
|
1211
1211
|
const cfMap = {};
|
|
1212
1212
|
this._copyInfo = {
|
|
1213
|
-
|
|
1213
|
+
rules,
|
|
1214
1214
|
info: {
|
|
1215
1215
|
unitId,
|
|
1216
1216
|
subUnitId,
|
|
@@ -1221,22 +1221,28 @@ let ConditionalFormattingCopyPasteController = class ConditionalFormattingCopyPa
|
|
|
1221
1221
|
return (0, _univerjs_sheets.rangeToDiscreteRange)(range, accessor, unitId, subUnitId);
|
|
1222
1222
|
});
|
|
1223
1223
|
if (!discreteRange) return;
|
|
1224
|
-
const {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
if (!cellCfList) return;
|
|
1230
|
-
cellCfList.forEach((item) => cfIdSet.add(item.cfId));
|
|
1231
|
-
matrix.setValue(rowIndex, colIndex, cellCfList.map((item) => item.cfId));
|
|
1224
|
+
const { projectRange } = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([discreteRange]);
|
|
1225
|
+
(_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId)) === null || _this$_conditionalFor === void 0 || _this$_conditionalFor.forEach((rule) => {
|
|
1226
|
+
const projectedRanges = rule.ranges.flatMap((ruleRange) => {
|
|
1227
|
+
const projected = projectRange(ruleRange);
|
|
1228
|
+
return projected ? [projected] : [];
|
|
1232
1229
|
});
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1230
|
+
if (projectedRanges.length) {
|
|
1231
|
+
rules.set(rule.cfId, projectedRanges.length > 1 ? _univerjs_core.Rectangle.mergeRanges(projectedRanges) : projectedRanges);
|
|
1232
|
+
cfMap[rule.cfId] = {
|
|
1233
|
+
rule: rule.rule,
|
|
1234
|
+
stopIfTrue: rule.stopIfTrue
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
1237
|
});
|
|
1238
1238
|
}
|
|
1239
1239
|
_generateConditionalFormattingMutations(pasteFrom, pasteTo, payload) {
|
|
1240
|
+
var _this$_conditionalFor2;
|
|
1241
|
+
const copyInfo = this._copyInfo;
|
|
1242
|
+
if (!copyInfo) return {
|
|
1243
|
+
redos: [],
|
|
1244
|
+
undos: []
|
|
1245
|
+
};
|
|
1240
1246
|
const { unitId: copyUnitId, subUnitId: copySubUnitId, range: copyRange } = pasteFrom;
|
|
1241
1247
|
const { unitId: pastedUnitId, subUnitId: pastedSubUnitId, range: pastedRange } = pasteTo;
|
|
1242
1248
|
const { copyType = _univerjs_sheets_ui.COPY_TYPE.COPY } = payload;
|
|
@@ -1254,109 +1260,86 @@ let ConditionalFormattingCopyPasteController = class ConditionalFormattingCopyPa
|
|
|
1254
1260
|
undos: []
|
|
1255
1261
|
};
|
|
1256
1262
|
}
|
|
1257
|
-
const
|
|
1258
|
-
const
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
endColumn: realCol
|
|
1280
|
-
});
|
|
1263
|
+
const sourceVirtualization = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([copyRange]);
|
|
1264
|
+
const sourceVirtualRange = sourceVirtualization.ranges[0];
|
|
1265
|
+
const targetVirtualization = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([pastedRange]);
|
|
1266
|
+
const targetVirtualRange = targetVirtualization.ranges[0];
|
|
1267
|
+
const repeatRange = (0, _univerjs_sheets_ui.getRepeatRange)(sourceVirtualRange, targetVirtualRange, true);
|
|
1268
|
+
const targetRanges = targetVirtualization.mapRange(targetVirtualRange);
|
|
1269
|
+
const isSameSheet = pastedUnitId === copyUnitId && pastedSubUnitId === copySubUnitId;
|
|
1270
|
+
const effectedConditionalFormattingRuleRanges = /* @__PURE__ */ new Map();
|
|
1271
|
+
const getEffectKey = (unitId, subUnitId, cfId) => JSON.stringify([
|
|
1272
|
+
unitId,
|
|
1273
|
+
subUnitId,
|
|
1274
|
+
cfId
|
|
1275
|
+
]);
|
|
1276
|
+
(_this$_conditionalFor2 = this._conditionalFormattingRuleModel.getSubunitRules(pastedUnitId, pastedSubUnitId)) === null || _this$_conditionalFor2 === void 0 || _this$_conditionalFor2.forEach((rule) => {
|
|
1277
|
+
if (!_univerjs_core.Rectangle.doAnyRangesIntersect(rule.ranges, targetRanges)) return;
|
|
1278
|
+
effectedConditionalFormattingRuleRanges.set(getEffectKey(pastedUnitId, pastedSubUnitId, rule.cfId), {
|
|
1279
|
+
cfId: rule.cfId,
|
|
1280
|
+
unitId: pastedUnitId,
|
|
1281
|
+
subUnitId: pastedSubUnitId,
|
|
1282
|
+
ranges: rule.ranges,
|
|
1283
|
+
add: [],
|
|
1284
|
+
remove: targetRanges
|
|
1281
1285
|
});
|
|
1282
1286
|
});
|
|
1283
|
-
if (copyType === _univerjs_sheets_ui.COPY_TYPE.CUT && (pastedUnitId !== copyUnitId || pastedSubUnitId !== copySubUnitId))
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
if (!
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
remove: []
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
effectedConditionalFormattingRuleRanges[item.cfId].remove.push({
|
|
1299
|
-
startRow: realRow,
|
|
1300
|
-
endRow: realRow,
|
|
1301
|
-
startColumn: realCol,
|
|
1302
|
-
endColumn: realCol
|
|
1287
|
+
if (copyType === _univerjs_sheets_ui.COPY_TYPE.CUT && (pastedUnitId !== copyUnitId || pastedSubUnitId !== copySubUnitId)) {
|
|
1288
|
+
const sourceRanges = sourceVirtualization.mapRange(sourceVirtualRange);
|
|
1289
|
+
copyInfo.rules.forEach((_ranges, cfId) => {
|
|
1290
|
+
const rule = this._conditionalFormattingRuleModel.getRule(copyUnitId, copySubUnitId, cfId);
|
|
1291
|
+
if (!rule) return;
|
|
1292
|
+
effectedConditionalFormattingRuleRanges.set(getEffectKey(copyUnitId, copySubUnitId, cfId), {
|
|
1293
|
+
cfId,
|
|
1294
|
+
unitId: copyUnitId,
|
|
1295
|
+
subUnitId: copySubUnitId,
|
|
1296
|
+
ranges: rule.ranges,
|
|
1297
|
+
add: [],
|
|
1298
|
+
remove: sourceRanges
|
|
1303
1299
|
});
|
|
1304
1300
|
});
|
|
1305
|
-
}
|
|
1306
|
-
const {
|
|
1307
|
-
const waitAddRule =
|
|
1301
|
+
}
|
|
1302
|
+
const { rules, info } = copyInfo;
|
|
1303
|
+
const waitAddRule = /* @__PURE__ */ new Map();
|
|
1308
1304
|
const cacheCfIdMap = {};
|
|
1309
1305
|
const getCurrentSheetCfRule = (copyRangeCfId) => {
|
|
1310
1306
|
const oldRule = info === null || info === void 0 ? void 0 : info.cfMap[copyRangeCfId];
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
} else {
|
|
1318
|
-
const rule = {
|
|
1319
|
-
rule: oldRule,
|
|
1320
|
-
cfId: this._conditionalFormattingRuleModel.createCfId(pastedUnitId, pastedSubUnitId),
|
|
1321
|
-
ranges: [],
|
|
1322
|
-
stopIfTrue: false
|
|
1323
|
-
};
|
|
1324
|
-
cacheCfIdMap[copyRangeCfId] = rule;
|
|
1325
|
-
waitAddRule.push(rule);
|
|
1326
|
-
return rule;
|
|
1307
|
+
if (isSameSheet) {
|
|
1308
|
+
const rule = this._conditionalFormattingRuleModel.getRule(pastedUnitId, pastedSubUnitId, copyRangeCfId);
|
|
1309
|
+
if (rule) {
|
|
1310
|
+
cacheCfIdMap[copyRangeCfId] = rule;
|
|
1311
|
+
return rule;
|
|
1312
|
+
}
|
|
1327
1313
|
}
|
|
1314
|
+
const rule = {
|
|
1315
|
+
rule: oldRule.rule,
|
|
1316
|
+
cfId: this._conditionalFormattingRuleModel.createCfId(pastedUnitId, pastedSubUnitId),
|
|
1317
|
+
ranges: [],
|
|
1318
|
+
stopIfTrue: oldRule.stopIfTrue
|
|
1319
|
+
};
|
|
1320
|
+
cacheCfIdMap[copyRangeCfId] = rule;
|
|
1321
|
+
waitAddRule.set(rule.cfId, rule);
|
|
1322
|
+
return rule;
|
|
1328
1323
|
};
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
unitId: pastedUnitId,
|
|
1342
|
-
subUnitId: pastedSubUnitId,
|
|
1343
|
-
ranges: rule.ranges,
|
|
1344
|
-
add: [],
|
|
1345
|
-
remove: []
|
|
1346
|
-
};
|
|
1347
|
-
effectedConditionalFormattingRuleRanges[rule.cfId].add.push({
|
|
1348
|
-
startRow: _row,
|
|
1349
|
-
endRow: _row,
|
|
1350
|
-
startColumn: _col,
|
|
1351
|
-
endColumn: _col
|
|
1352
|
-
});
|
|
1353
|
-
});
|
|
1324
|
+
const sourceRuleEntries = Array.from(rules.entries());
|
|
1325
|
+
if (!isSameSheet) sourceRuleEntries.reverse();
|
|
1326
|
+
sourceRuleEntries.forEach(([cfId, sourceRanges]) => {
|
|
1327
|
+
const rule = cacheCfIdMap[cfId] || getCurrentSheetCfRule(cfId);
|
|
1328
|
+
const effectKey = getEffectKey(pastedUnitId, pastedSubUnitId, rule.cfId);
|
|
1329
|
+
if (!effectedConditionalFormattingRuleRanges.has(effectKey)) effectedConditionalFormattingRuleRanges.set(effectKey, {
|
|
1330
|
+
cfId: rule.cfId,
|
|
1331
|
+
unitId: pastedUnitId,
|
|
1332
|
+
subUnitId: pastedSubUnitId,
|
|
1333
|
+
ranges: rule.ranges,
|
|
1334
|
+
add: [],
|
|
1335
|
+
remove: []
|
|
1354
1336
|
});
|
|
1337
|
+
effectedConditionalFormattingRuleRanges.get(effectKey).add.push(...repeatRange.flatMap((item) => sourceRanges.flatMap((sourceRange) => targetVirtualization.mapRange(_univerjs_core.Rectangle.getPositionRange(sourceRange, item.startRange)))));
|
|
1355
1338
|
});
|
|
1356
1339
|
const redos = [];
|
|
1357
1340
|
const undos = [];
|
|
1358
|
-
for (const
|
|
1359
|
-
const { unitId, subUnitId, ranges: sourceRanges, add, remove } =
|
|
1341
|
+
for (const effect of effectedConditionalFormattingRuleRanges.values()) {
|
|
1342
|
+
const { cfId, unitId, subUnitId, ranges: sourceRanges, add, remove } = effect;
|
|
1360
1343
|
const ranges = this._conditionalFormattingRangeTransformService.applyRangeDelta(sourceRanges, remove, add);
|
|
1361
1344
|
if (!ranges.length) {
|
|
1362
1345
|
const deleteParams = {
|
|
@@ -1369,13 +1352,15 @@ let ConditionalFormattingCopyPasteController = class ConditionalFormattingCopyPa
|
|
|
1369
1352
|
params: deleteParams
|
|
1370
1353
|
});
|
|
1371
1354
|
undos.push(...(0, _univerjs_sheets_conditional_formatting.DeleteConditionalRuleMutationUndoFactory)(this._injector, deleteParams));
|
|
1355
|
+
continue;
|
|
1372
1356
|
}
|
|
1373
|
-
|
|
1357
|
+
const waitAdd = waitAddRule.get(cfId);
|
|
1358
|
+
if (waitAdd) {
|
|
1374
1359
|
const addParams = {
|
|
1375
1360
|
unitId: pastedUnitId,
|
|
1376
1361
|
subUnitId: pastedSubUnitId,
|
|
1377
1362
|
rule: {
|
|
1378
|
-
...
|
|
1363
|
+
...waitAdd,
|
|
1379
1364
|
ranges
|
|
1380
1365
|
}
|
|
1381
1366
|
};
|
|
@@ -1412,9 +1397,8 @@ ConditionalFormattingCopyPasteController = __decorate([
|
|
|
1412
1397
|
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.ISheetClipboardService)),
|
|
1413
1398
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel)),
|
|
1414
1399
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
1415
|
-
__decorateParam(3, (0, _univerjs_core.Inject)(
|
|
1416
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(
|
|
1417
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeTransformService))
|
|
1400
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
1401
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeTransformService))
|
|
1418
1402
|
], ConditionalFormattingCopyPasteController);
|
|
1419
1403
|
|
|
1420
1404
|
//#endregion
|
|
@@ -1500,7 +1484,7 @@ ConditionalFormattingPermissionController = __decorate([
|
|
|
1500
1484
|
//#endregion
|
|
1501
1485
|
//#region src/controllers/cf.render.controller.ts
|
|
1502
1486
|
let SheetsCfRenderController = class SheetsCfRenderController extends _univerjs_core.Disposable {
|
|
1503
|
-
constructor(_sheetInterceptorService, _conditionalFormattingService, _univerInstanceService, _renderManagerService, _conditionalFormattingViewModel, _conditionalFormattingRuleModel) {
|
|
1487
|
+
constructor(_sheetInterceptorService, _conditionalFormattingService, _univerInstanceService, _renderManagerService, _conditionalFormattingViewModel, _conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel) {
|
|
1504
1488
|
super();
|
|
1505
1489
|
this._sheetInterceptorService = _sheetInterceptorService;
|
|
1506
1490
|
this._conditionalFormattingService = _conditionalFormattingService;
|
|
@@ -1508,14 +1492,69 @@ let SheetsCfRenderController = class SheetsCfRenderController extends _univerjs_
|
|
|
1508
1492
|
this._renderManagerService = _renderManagerService;
|
|
1509
1493
|
this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
|
|
1510
1494
|
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
1495
|
+
this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
|
|
1511
1496
|
_defineProperty(this, "_ruleChangeCacheMap", /* @__PURE__ */ new Map());
|
|
1497
|
+
_defineProperty(this, "_boundRenderExtensions", /* @__PURE__ */ new Map());
|
|
1512
1498
|
this._initViewModelInterceptor();
|
|
1499
|
+
this._initRenderRangeResolvers();
|
|
1513
1500
|
this._initSkeleton();
|
|
1514
1501
|
queueMicrotask(() => this._markActiveSheetRulesDirty());
|
|
1515
1502
|
this.disposeWithMe(() => {
|
|
1516
1503
|
this._ruleChangeCacheMap.clear();
|
|
1504
|
+
this._boundRenderExtensions.forEach((extensions) => {
|
|
1505
|
+
extensions.forEach((extension) => extension.setRenderRangeResolver(null));
|
|
1506
|
+
});
|
|
1507
|
+
this._boundRenderExtensions.clear();
|
|
1517
1508
|
});
|
|
1518
1509
|
}
|
|
1510
|
+
_initRenderRangeResolvers() {
|
|
1511
|
+
const dataBarResolver = this._createRenderRangeResolver(_univerjs_sheets_conditional_formatting.CFRuleType.dataBar);
|
|
1512
|
+
const iconResolver = this._createRenderRangeResolver(_univerjs_sheets_conditional_formatting.CFRuleType.iconSet);
|
|
1513
|
+
const bind = (unitId) => {
|
|
1514
|
+
var _this$_renderManagerS;
|
|
1515
|
+
this._unbindRenderRangeResolvers(unitId);
|
|
1516
|
+
const mainComponent = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.mainComponent;
|
|
1517
|
+
if (!mainComponent || !("getExtensionByKey" in mainComponent)) return;
|
|
1518
|
+
const extensions = /* @__PURE__ */ new Set();
|
|
1519
|
+
const dataBar = mainComponent.getExtensionByKey(_univerjs_sheets_conditional_formatting.dataBarUKey);
|
|
1520
|
+
if (dataBar instanceof _univerjs_sheets_conditional_formatting.DataBar) {
|
|
1521
|
+
dataBar.setRenderRangeResolver(dataBarResolver);
|
|
1522
|
+
extensions.add(dataBar);
|
|
1523
|
+
}
|
|
1524
|
+
const icon = mainComponent.getExtensionByKey(_univerjs_sheets_conditional_formatting.IconUKey);
|
|
1525
|
+
if (icon instanceof _univerjs_sheets_conditional_formatting.ConditionalFormattingIcon) {
|
|
1526
|
+
icon.setRenderRangeResolver(iconResolver);
|
|
1527
|
+
extensions.add(icon);
|
|
1528
|
+
}
|
|
1529
|
+
if (extensions.size) this._boundRenderExtensions.set(unitId, extensions);
|
|
1530
|
+
};
|
|
1531
|
+
this._renderManagerService.getAllRenderersOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).forEach((render) => bind(render.unitId));
|
|
1532
|
+
this.disposeWithMe(this._renderManagerService.created$.subscribe((render) => {
|
|
1533
|
+
if (render.type === _univerjs_core.UniverInstanceType.UNIVER_SHEET) bind(render.unitId);
|
|
1534
|
+
}));
|
|
1535
|
+
this.disposeWithMe(this._renderManagerService.disposed$.subscribe((unitId) => this._unbindRenderRangeResolvers(unitId)));
|
|
1536
|
+
}
|
|
1537
|
+
_createRenderRangeResolver(ruleType) {
|
|
1538
|
+
return (unitId, subUnitId, ranges) => {
|
|
1539
|
+
const intersections = [];
|
|
1540
|
+
const indexedRules = this._conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges).filter((rule) => rule.rule.type === ruleType);
|
|
1541
|
+
const matchingRules = indexedRules.length ? indexedRules : (this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? []).filter((rule) => rule.rule.type === ruleType);
|
|
1542
|
+
ranges.forEach((range) => {
|
|
1543
|
+
matchingRules.forEach((rule) => {
|
|
1544
|
+
rule.ranges.forEach((ruleRange) => {
|
|
1545
|
+
const intersection = (0, _univerjs_core.getIntersectRange)(range, ruleRange);
|
|
1546
|
+
if (intersection) intersections.push(intersection);
|
|
1547
|
+
});
|
|
1548
|
+
});
|
|
1549
|
+
});
|
|
1550
|
+
return intersections.length > 1 ? _univerjs_core.Rectangle.mergeRanges(intersections) : intersections;
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
_unbindRenderRangeResolvers(unitId) {
|
|
1554
|
+
const extensions = this._boundRenderExtensions.get(unitId);
|
|
1555
|
+
extensions === null || extensions === void 0 || extensions.forEach((extension) => extension.setRenderRangeResolver(null));
|
|
1556
|
+
this._boundRenderExtensions.delete(unitId);
|
|
1557
|
+
}
|
|
1519
1558
|
_collectDirtyRanges(items, unitId, subUnitId) {
|
|
1520
1559
|
const ranges = [];
|
|
1521
1560
|
items.forEach((item) => {
|
|
@@ -1610,7 +1649,8 @@ SheetsCfRenderController = __decorate([
|
|
|
1610
1649
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
1611
1650
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_engine_render.IRenderManagerService)),
|
|
1612
1651
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingViewModel)),
|
|
1613
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel))
|
|
1652
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel)),
|
|
1653
|
+
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeIndexModel))
|
|
1614
1654
|
], SheetsCfRenderController);
|
|
1615
1655
|
|
|
1616
1656
|
//#endregion
|
|
@@ -1664,13 +1704,12 @@ UniverSheetsConditionalFormattingMobileUIPlugin = __decorate([
|
|
|
1664
1704
|
//#endregion
|
|
1665
1705
|
//#region src/controllers/cf.auto-fill.controller.ts
|
|
1666
1706
|
let ConditionalFormattingAutoFillController = class ConditionalFormattingAutoFillController extends _univerjs_core.Disposable {
|
|
1667
|
-
constructor(_injector, _univerInstanceService, _autoFillService, _conditionalFormattingRuleModel,
|
|
1707
|
+
constructor(_injector, _univerInstanceService, _autoFillService, _conditionalFormattingRuleModel, _conditionalFormattingRangeTransformService) {
|
|
1668
1708
|
super();
|
|
1669
1709
|
this._injector = _injector;
|
|
1670
1710
|
this._univerInstanceService = _univerInstanceService;
|
|
1671
1711
|
this._autoFillService = _autoFillService;
|
|
1672
1712
|
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
1673
|
-
this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
|
|
1674
1713
|
this._conditionalFormattingRangeTransformService = _conditionalFormattingRangeTransformService;
|
|
1675
1714
|
this._initAutoFill();
|
|
1676
1715
|
}
|
|
@@ -1679,11 +1718,24 @@ let ConditionalFormattingAutoFillController = class ConditionalFormattingAutoFil
|
|
|
1679
1718
|
redos: [],
|
|
1680
1719
|
undos: []
|
|
1681
1720
|
});
|
|
1682
|
-
const
|
|
1683
|
-
var
|
|
1684
|
-
const unitId = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getUnitId();
|
|
1685
|
-
const subUnitId = (
|
|
1686
|
-
|
|
1721
|
+
const generalApplyFunc = (sourceRange, targetRange) => {
|
|
1722
|
+
var _this$_univerInstance, _this$_univerInstance2;
|
|
1723
|
+
const unitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
|
|
1724
|
+
const subUnitId = (_this$_univerInstance2 = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance2 === void 0 || (_this$_univerInstance2 = _this$_univerInstance2.getActiveSheet()) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getSheetId();
|
|
1725
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
1726
|
+
const rangeDeltaMap = /* @__PURE__ */ new Map();
|
|
1727
|
+
const redos = [];
|
|
1728
|
+
const undos = [];
|
|
1729
|
+
if (!unitId || !subUnitId) return noopReturnFunc();
|
|
1730
|
+
const virtualization = (0, _univerjs_sheets_ui.virtualizeDiscreteRanges)([sourceRange, targetRange]);
|
|
1731
|
+
const [vSourceRange, vTargetRange] = virtualization.ranges;
|
|
1732
|
+
const repeats = _univerjs_sheets.AutoFillTools.getAutoFillRepeatRange(vSourceRange, vTargetRange);
|
|
1733
|
+
const targetRanges = repeats.flatMap((repeat) => virtualization.mapRange(_univerjs_core.Rectangle.getPositionRange(repeat.relativeRange, {
|
|
1734
|
+
startRow: repeat.repeatStartCell.row,
|
|
1735
|
+
endRow: repeat.repeatStartCell.row,
|
|
1736
|
+
startColumn: repeat.repeatStartCell.col,
|
|
1737
|
+
endColumn: repeat.repeatStartCell.col
|
|
1738
|
+
})));
|
|
1687
1739
|
const getRangeDelta = (cfId) => {
|
|
1688
1740
|
let rangeDelta = rangeDeltaMap.get(cfId);
|
|
1689
1741
|
if (!rangeDelta) {
|
|
@@ -1695,80 +1747,29 @@ let ConditionalFormattingAutoFillController = class ConditionalFormattingAutoFil
|
|
|
1695
1747
|
}
|
|
1696
1748
|
return rangeDelta;
|
|
1697
1749
|
};
|
|
1698
|
-
|
|
1699
|
-
if (
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
startColumn: sourceStartCell.col,
|
|
1708
|
-
endColumn: sourceStartCell.col,
|
|
1709
|
-
endRow: sourceStartCell.row
|
|
1710
|
-
};
|
|
1711
|
-
const targetRange = {
|
|
1712
|
-
startRow: targetStartCell.row,
|
|
1713
|
-
startColumn: targetStartCell.col,
|
|
1714
|
-
endColumn: targetStartCell.col,
|
|
1715
|
-
endRow: targetStartCell.row
|
|
1716
|
-
};
|
|
1717
|
-
_univerjs_core.Range.foreach(relativeRange, (row, col) => {
|
|
1718
|
-
const sourcePositionRange = _univerjs_core.Rectangle.getPositionRange({
|
|
1719
|
-
startRow: row,
|
|
1720
|
-
startColumn: col,
|
|
1721
|
-
endColumn: col,
|
|
1722
|
-
endRow: row
|
|
1723
|
-
}, sourceRange);
|
|
1724
|
-
const targetPositionRange = _univerjs_core.Rectangle.getPositionRange({
|
|
1725
|
-
startRow: row,
|
|
1726
|
-
startColumn: col,
|
|
1727
|
-
endColumn: col,
|
|
1728
|
-
endRow: row
|
|
1729
|
-
}, targetRange);
|
|
1730
|
-
const { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn);
|
|
1731
|
-
const sourceCellCf = this._conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, sourceRow, sourceCol);
|
|
1732
|
-
const { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn);
|
|
1733
|
-
const targetCellCf = this._conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, targetRow, targetCol);
|
|
1734
|
-
if (targetCellCf) targetCellCf.forEach((cf) => {
|
|
1735
|
-
if (!ensureRuleRanges(cf.cfId)) return;
|
|
1736
|
-
getRangeDelta(cf.cfId).remove.push({
|
|
1737
|
-
startRow: targetRow,
|
|
1738
|
-
endRow: targetRow,
|
|
1739
|
-
startColumn: targetCol,
|
|
1740
|
-
endColumn: targetCol
|
|
1741
|
-
});
|
|
1742
|
-
});
|
|
1743
|
-
if (sourceCellCf) sourceCellCf.forEach((cf) => {
|
|
1744
|
-
if (!ensureRuleRanges(cf.cfId)) return;
|
|
1745
|
-
getRangeDelta(cf.cfId).add.push({
|
|
1746
|
-
startRow: targetRow,
|
|
1747
|
-
endRow: targetRow,
|
|
1748
|
-
startColumn: targetCol,
|
|
1749
|
-
endColumn: targetCol
|
|
1750
|
-
});
|
|
1750
|
+
(this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? []).forEach((rule) => {
|
|
1751
|
+
if (_univerjs_core.Rectangle.doAnyRangesIntersect(rule.ranges, targetRanges)) {
|
|
1752
|
+
rangeMap.set(rule.cfId, rule.ranges);
|
|
1753
|
+
getRangeDelta(rule.cfId).remove.push(...targetRanges);
|
|
1754
|
+
}
|
|
1755
|
+
const sourceRanges = rule.ranges.flatMap((range) => {
|
|
1756
|
+
const projected = virtualization.projectRange(range);
|
|
1757
|
+
const intersected = projected && (0, _univerjs_core.getIntersectRange)(projected, vSourceRange);
|
|
1758
|
+
return intersected ? [_univerjs_core.Rectangle.getRelativeRange(intersected, vSourceRange)] : [];
|
|
1751
1759
|
});
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
const { mapFunc } = virtualRange;
|
|
1766
|
-
const sourceStartCell = {
|
|
1767
|
-
row: vSourceRange.startRow,
|
|
1768
|
-
col: vSourceRange.startColumn
|
|
1769
|
-
};
|
|
1770
|
-
_univerjs_sheets.AutoFillTools.getAutoFillRepeatRange(vSourceRange, vTargetRange).forEach((repeat) => {
|
|
1771
|
-
loopFunc(sourceStartCell, repeat.repeatStartCell, repeat.relativeRange, rangeMap, rangeDeltaMap, mapFunc);
|
|
1760
|
+
const additions = repeats.flatMap((repeat) => sourceRanges.flatMap((range) => {
|
|
1761
|
+
const copiedRange = (0, _univerjs_core.getIntersectRange)(range, repeat.relativeRange);
|
|
1762
|
+
return copiedRange ? virtualization.mapRange(_univerjs_core.Rectangle.getPositionRange(copiedRange, {
|
|
1763
|
+
startRow: repeat.repeatStartCell.row,
|
|
1764
|
+
endRow: repeat.repeatStartCell.row,
|
|
1765
|
+
startColumn: repeat.repeatStartCell.col,
|
|
1766
|
+
endColumn: repeat.repeatStartCell.col
|
|
1767
|
+
})) : [];
|
|
1768
|
+
}));
|
|
1769
|
+
if (additions.length) {
|
|
1770
|
+
rangeMap.set(rule.cfId, rule.ranges);
|
|
1771
|
+
getRangeDelta(rule.cfId).add.push(...additions);
|
|
1772
|
+
}
|
|
1772
1773
|
});
|
|
1773
1774
|
rangeDeltaMap.forEach((rangeDelta, cfId) => {
|
|
1774
1775
|
const ranges = rangeMap.get(cfId);
|
|
@@ -1828,8 +1829,7 @@ ConditionalFormattingAutoFillController = __decorate([
|
|
|
1828
1829
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
1829
1830
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.IAutoFillService)),
|
|
1830
1831
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel)),
|
|
1831
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.
|
|
1832
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeTransformService))
|
|
1832
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeTransformService))
|
|
1833
1833
|
], ConditionalFormattingAutoFillController);
|
|
1834
1834
|
|
|
1835
1835
|
//#endregion
|
|
@@ -1946,14 +1946,13 @@ const repeatByRange = (sourceRange, targetRange) => {
|
|
|
1946
1946
|
return repeatList;
|
|
1947
1947
|
};
|
|
1948
1948
|
let ConditionalFormattingPainterController = class ConditionalFormattingPainterController extends _univerjs_core.Disposable {
|
|
1949
|
-
constructor(_injector, _univerInstanceService, _formatPainterService, _sheetsSelectionsService, _conditionalFormattingRuleModel,
|
|
1949
|
+
constructor(_injector, _univerInstanceService, _formatPainterService, _sheetsSelectionsService, _conditionalFormattingRuleModel, _conditionalFormattingRangeTransformService) {
|
|
1950
1950
|
super();
|
|
1951
1951
|
this._injector = _injector;
|
|
1952
1952
|
this._univerInstanceService = _univerInstanceService;
|
|
1953
1953
|
this._formatPainterService = _formatPainterService;
|
|
1954
1954
|
this._sheetsSelectionsService = _sheetsSelectionsService;
|
|
1955
1955
|
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
1956
|
-
this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
|
|
1957
1956
|
this._conditionalFormattingRangeTransformService = _conditionalFormattingRangeTransformService;
|
|
1958
1957
|
_defineProperty(this, "_painterConfig", null);
|
|
1959
1958
|
this._initFormattingPainter();
|
|
@@ -1963,9 +1962,16 @@ let ConditionalFormattingPainterController = class ConditionalFormattingPainterC
|
|
|
1963
1962
|
redos: [],
|
|
1964
1963
|
undos: []
|
|
1965
1964
|
});
|
|
1966
|
-
const
|
|
1967
|
-
const { unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._painterConfig;
|
|
1968
|
-
const
|
|
1965
|
+
const generalApplyFunc = (targetUnitId, targetSubUnitId, targetRange) => {
|
|
1966
|
+
const { range: sourceRange, unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._painterConfig;
|
|
1967
|
+
const isSkipSheet = targetUnitId !== sourceUnitId || sourceSubUnitId !== targetSubUnitId;
|
|
1968
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
1969
|
+
const rangeDeltaMap = /* @__PURE__ */ new Map();
|
|
1970
|
+
const redos = [];
|
|
1971
|
+
const undos = [];
|
|
1972
|
+
if (!targetUnitId || !targetSubUnitId || !sourceUnitId || !sourceSubUnitId) return noopReturnFunc();
|
|
1973
|
+
const repeats = repeatByRange(sourceRange, targetRange);
|
|
1974
|
+
const targetRanges = repeats.map((repeat) => _univerjs_core.Rectangle.getPositionRange(repeat.repeatRelativeRange, repeat.startRange));
|
|
1969
1975
|
const getRangeDelta = (cfId) => {
|
|
1970
1976
|
let rangeDelta = rangeDeltaMap.get(cfId);
|
|
1971
1977
|
if (!rangeDelta) {
|
|
@@ -1977,82 +1983,38 @@ let ConditionalFormattingPainterController = class ConditionalFormattingPainterC
|
|
|
1977
1983
|
}
|
|
1978
1984
|
return rangeDelta;
|
|
1979
1985
|
};
|
|
1980
|
-
const
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
startRow: targetStartCell.row,
|
|
1988
|
-
startColumn: targetStartCell.col,
|
|
1989
|
-
endColumn: targetStartCell.col,
|
|
1990
|
-
endRow: targetStartCell.row
|
|
1991
|
-
};
|
|
1992
|
-
_univerjs_core.Range.foreach(relativeRange, (row, col) => {
|
|
1993
|
-
const sourcePositionRange = _univerjs_core.Rectangle.getPositionRange({
|
|
1994
|
-
startRow: row,
|
|
1995
|
-
startColumn: col,
|
|
1996
|
-
endColumn: col,
|
|
1997
|
-
endRow: row
|
|
1998
|
-
}, sourceRange);
|
|
1999
|
-
const targetPositionRange = _univerjs_core.Rectangle.getPositionRange({
|
|
2000
|
-
startRow: row,
|
|
2001
|
-
startColumn: col,
|
|
2002
|
-
endColumn: col,
|
|
2003
|
-
endRow: row
|
|
2004
|
-
}, targetRange);
|
|
2005
|
-
const sourceCellCf = this._conditionalFormattingViewModel.getCellCfs(sourceUnitId, sourceSubUnitId, sourcePositionRange.startRow, sourcePositionRange.startColumn);
|
|
2006
|
-
const targetCellCf = this._conditionalFormattingViewModel.getCellCfs(targetUnitId, targetSubUnitId, targetPositionRange.startRow, targetPositionRange.startColumn);
|
|
2007
|
-
if (targetCellCf) targetCellCf.forEach((cf) => {
|
|
2008
|
-
if (!rangeMap.has(cf.cfId)) {
|
|
2009
|
-
const rule = this._conditionalFormattingRuleModel.getRule(targetUnitId, targetSubUnitId, cf.cfId);
|
|
2010
|
-
if (!rule) return;
|
|
2011
|
-
rangeMap.set(cf.cfId, rule.ranges);
|
|
2012
|
-
}
|
|
2013
|
-
getRangeDelta(cf.cfId).remove.push({
|
|
2014
|
-
startRow: targetPositionRange.startRow,
|
|
2015
|
-
endRow: targetPositionRange.startRow,
|
|
2016
|
-
startColumn: targetPositionRange.startColumn,
|
|
2017
|
-
endColumn: targetPositionRange.startColumn
|
|
2018
|
-
});
|
|
2019
|
-
});
|
|
2020
|
-
if (sourceCellCf) sourceCellCf.forEach((cf) => {
|
|
2021
|
-
if (!rangeMap.has(cf.cfId)) return;
|
|
2022
|
-
getRangeDelta(cf.cfId).add.push({
|
|
2023
|
-
startRow: targetPositionRange.startRow,
|
|
2024
|
-
endRow: targetPositionRange.startRow,
|
|
2025
|
-
startColumn: targetPositionRange.startColumn,
|
|
2026
|
-
endColumn: targetPositionRange.startColumn
|
|
2027
|
-
});
|
|
2028
|
-
});
|
|
2029
|
-
});
|
|
2030
|
-
};
|
|
2031
|
-
const generalApplyFunc = (targetUnitId, targetSubUnitId, targetRange) => {
|
|
2032
|
-
const { range: sourceRange, unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._painterConfig;
|
|
2033
|
-
const isSkipSheet = targetUnitId !== sourceUnitId || sourceSubUnitId !== targetSubUnitId;
|
|
2034
|
-
const rangeMap = /* @__PURE__ */ new Map();
|
|
2035
|
-
const rangeDeltaMap = /* @__PURE__ */ new Map();
|
|
2036
|
-
const redos = [];
|
|
2037
|
-
const undos = [];
|
|
2038
|
-
if (!targetUnitId || !targetSubUnitId || !sourceUnitId || !sourceSubUnitId) return noopReturnFunc();
|
|
2039
|
-
const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(sourceUnitId, sourceSubUnitId) ?? [];
|
|
2040
|
-
ruleList === null || ruleList === void 0 || ruleList.forEach((rule) => {
|
|
2041
|
-
const { ranges, cfId } = rule;
|
|
2042
|
-
if (ranges.some((range) => _univerjs_core.Rectangle.intersects(sourceRange, range))) rangeMap.set(cfId, isSkipSheet ? [] : ranges);
|
|
1986
|
+
const targetRuleList = this._conditionalFormattingRuleModel.getSubunitRules(targetUnitId, targetSubUnitId) ?? [];
|
|
1987
|
+
const waitAddRule = /* @__PURE__ */ new Map();
|
|
1988
|
+
targetRuleList.forEach((rule) => {
|
|
1989
|
+
if (_univerjs_core.Rectangle.doAnyRangesIntersect(rule.ranges, targetRanges)) {
|
|
1990
|
+
rangeMap.set(rule.cfId, rule.ranges);
|
|
1991
|
+
getRangeDelta(rule.cfId).remove.push(...targetRanges);
|
|
1992
|
+
}
|
|
2043
1993
|
});
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
loopFunc(sourceStartCell, {
|
|
2050
|
-
row: repeat.startRange.startRow,
|
|
2051
|
-
col: repeat.startRange.startColumn
|
|
2052
|
-
}, repeat.repeatRelativeRange, rangeMap, rangeDeltaMap, {
|
|
2053
|
-
targetUnitId,
|
|
2054
|
-
targetSubUnitId
|
|
1994
|
+
const sourceRuleList = this._conditionalFormattingRuleModel.getSubunitRules(sourceUnitId, sourceSubUnitId) ?? [];
|
|
1995
|
+
(isSkipSheet ? [...sourceRuleList].reverse() : sourceRuleList).forEach((rule) => {
|
|
1996
|
+
const sourceRanges = rule.ranges.flatMap((range) => {
|
|
1997
|
+
const intersected = (0, _univerjs_core.getIntersectRange)(range, sourceRange);
|
|
1998
|
+
return intersected ? [_univerjs_core.Rectangle.getRelativeRange(intersected, sourceRange)] : [];
|
|
2055
1999
|
});
|
|
2000
|
+
const additions = repeats.flatMap((repeat) => sourceRanges.flatMap((range) => {
|
|
2001
|
+
const copiedRange = (0, _univerjs_core.getIntersectRange)(range, repeat.repeatRelativeRange);
|
|
2002
|
+
return copiedRange ? [_univerjs_core.Rectangle.getPositionRange(copiedRange, repeat.startRange)] : [];
|
|
2003
|
+
}));
|
|
2004
|
+
if (additions.length) {
|
|
2005
|
+
let targetCfId = rule.cfId;
|
|
2006
|
+
if (isSkipSheet) {
|
|
2007
|
+
targetCfId = this._conditionalFormattingRuleModel.createCfId(targetUnitId, targetSubUnitId);
|
|
2008
|
+
waitAddRule.set(targetCfId, {
|
|
2009
|
+
..._univerjs_core.Tools.deepClone(rule),
|
|
2010
|
+
cfId: targetCfId,
|
|
2011
|
+
ranges: []
|
|
2012
|
+
});
|
|
2013
|
+
rangeMap.set(targetCfId, []);
|
|
2014
|
+
}
|
|
2015
|
+
if (!rangeMap.has(targetCfId)) rangeMap.set(targetCfId, rule.ranges);
|
|
2016
|
+
getRangeDelta(targetCfId).add.push(...additions);
|
|
2017
|
+
}
|
|
2056
2018
|
});
|
|
2057
2019
|
rangeDeltaMap.forEach((rangeDelta, cfId) => {
|
|
2058
2020
|
const ranges = rangeMap.get(cfId);
|
|
@@ -2090,28 +2052,27 @@ let ConditionalFormattingPainterController = class ConditionalFormattingPainterC
|
|
|
2090
2052
|
undos.push(...(0, _univerjs_sheets_conditional_formatting.DeleteConditionalRuleMutationUndoFactory)(this._injector, params));
|
|
2091
2053
|
}
|
|
2092
2054
|
} else {
|
|
2093
|
-
const
|
|
2094
|
-
if (
|
|
2055
|
+
const waitAdd = waitAddRule.get(cfId);
|
|
2056
|
+
if (waitAdd) {
|
|
2095
2057
|
if (ranges.length) {
|
|
2096
|
-
const
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
params
|
|
2110
|
-
});
|
|
2111
|
-
undos.push((0, _univerjs_sheets_conditional_formatting.AddConditionalRuleMutationUndoFactory)(this._injector, params));
|
|
2112
|
-
}
|
|
2058
|
+
const params = {
|
|
2059
|
+
unitId: targetUnitId,
|
|
2060
|
+
subUnitId: targetSubUnitId,
|
|
2061
|
+
rule: {
|
|
2062
|
+
...waitAdd,
|
|
2063
|
+
ranges
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
redos.push({
|
|
2067
|
+
id: _univerjs_sheets_conditional_formatting.AddConditionalRuleMutation.id,
|
|
2068
|
+
params
|
|
2069
|
+
});
|
|
2070
|
+
undos.push((0, _univerjs_sheets_conditional_formatting.AddConditionalRuleMutationUndoFactory)(this._injector, params));
|
|
2113
2071
|
}
|
|
2114
|
-
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
const rule = this._conditionalFormattingRuleModel.getRule(targetUnitId, targetSubUnitId, cfId);
|
|
2075
|
+
if (rule) if (ranges.length) {
|
|
2115
2076
|
const params = {
|
|
2116
2077
|
unitId: targetUnitId,
|
|
2117
2078
|
subUnitId: targetSubUnitId,
|
|
@@ -2184,8 +2145,7 @@ ConditionalFormattingPainterController = __decorate([
|
|
|
2184
2145
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.IFormatPainterService)),
|
|
2185
2146
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
2186
2147
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel)),
|
|
2187
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.
|
|
2188
|
-
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeTransformService))
|
|
2148
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets_conditional_formatting.ConditionalFormattingRangeTransformService))
|
|
2189
2149
|
], ConditionalFormattingPainterController);
|
|
2190
2150
|
|
|
2191
2151
|
//#endregion
|
|
@@ -2408,10 +2368,10 @@ const TextInput$1 = (props) => {
|
|
|
2408
2368
|
(_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
|
|
2409
2369
|
});
|
|
2410
2370
|
if (type === _univerjs_sheets_conditional_formatting.CFValueType.formula) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2411
|
-
className: "univer-
|
|
2371
|
+
className: "univer-w-full",
|
|
2412
2372
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
|
|
2413
2373
|
ref: formulaEditorRef,
|
|
2414
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-
|
|
2374
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
|
|
2415
2375
|
initValue: formulaInitValue,
|
|
2416
2376
|
unitId,
|
|
2417
2377
|
subUnitId,
|
|
@@ -2622,7 +2582,6 @@ const ColorScaleStyleEditor = (props) => {
|
|
|
2622
2582
|
}),
|
|
2623
2583
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextInput$1, {
|
|
2624
2584
|
id: "min",
|
|
2625
|
-
className: "univer-ml-1",
|
|
2626
2585
|
value: minValue,
|
|
2627
2586
|
type: minType,
|
|
2628
2587
|
onChange: (v) => {
|
|
@@ -2641,7 +2600,6 @@ const ColorScaleStyleEditor = (props) => {
|
|
|
2641
2600
|
}
|
|
2642
2601
|
}),
|
|
2643
2602
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorPicker, {
|
|
2644
|
-
className: "univer-ml-1",
|
|
2645
2603
|
color: minColor,
|
|
2646
2604
|
onChange: (v) => {
|
|
2647
2605
|
setMinColor(v);
|
|
@@ -2690,7 +2648,6 @@ const ColorScaleStyleEditor = (props) => {
|
|
|
2690
2648
|
}),
|
|
2691
2649
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextInput$1, {
|
|
2692
2650
|
id: "median",
|
|
2693
|
-
className: "univer-ml-1",
|
|
2694
2651
|
value: medianValue,
|
|
2695
2652
|
type: medianType,
|
|
2696
2653
|
onChange: (v) => {
|
|
@@ -2708,8 +2665,7 @@ const ColorScaleStyleEditor = (props) => {
|
|
|
2708
2665
|
});
|
|
2709
2666
|
}
|
|
2710
2667
|
}),
|
|
2711
|
-
medianType !== "none"
|
|
2712
|
-
className: "univer-ml-1",
|
|
2668
|
+
medianType !== "none" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorPicker, {
|
|
2713
2669
|
color: medianColor,
|
|
2714
2670
|
onChange: (v) => {
|
|
2715
2671
|
setMedianColor(v);
|
|
@@ -2725,6 +2681,9 @@ const ColorScaleStyleEditor = (props) => {
|
|
|
2725
2681
|
maxColor
|
|
2726
2682
|
});
|
|
2727
2683
|
}
|
|
2684
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2685
|
+
"aria-hidden": true,
|
|
2686
|
+
className: "univer-size-6 univer-flex-shrink-0"
|
|
2728
2687
|
})
|
|
2729
2688
|
]
|
|
2730
2689
|
}),
|
|
@@ -2832,7 +2791,7 @@ const InputText = (props) => {
|
|
|
2832
2791
|
className: "univer-w-full",
|
|
2833
2792
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
|
|
2834
2793
|
ref: formulaEditorRef,
|
|
2835
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-
|
|
2794
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
|
|
2836
2795
|
initValue: v,
|
|
2837
2796
|
unitId,
|
|
2838
2797
|
subUnitId,
|
|
@@ -3352,7 +3311,7 @@ const FormulaStyleEditor = (props) => {
|
|
|
3352
3311
|
className: "univer-mt-3",
|
|
3353
3312
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
|
|
3354
3313
|
ref: formulaEditorRef,
|
|
3355
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-
|
|
3314
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
|
|
3356
3315
|
errorText: formulaError,
|
|
3357
3316
|
isFocus: isFocusFormulaEditor,
|
|
3358
3317
|
initValue: formula,
|
|
@@ -3826,7 +3785,7 @@ const TextInput = (props) => {
|
|
|
3826
3785
|
className: "univer-w-full",
|
|
3827
3786
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
|
|
3828
3787
|
ref: formulaEditorRef,
|
|
3829
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-
|
|
3788
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
|
|
3830
3789
|
initValue: String(props.value),
|
|
3831
3790
|
unitId,
|
|
3832
3791
|
subUnitId,
|
|
@@ -3851,8 +3810,9 @@ const createDefaultConfigItem = (iconType, index, list) => ({
|
|
|
3851
3810
|
const IconGroupList = (props) => {
|
|
3852
3811
|
const { iconType, onClick } = props;
|
|
3853
3812
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
3813
|
+
const direction = (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection());
|
|
3854
3814
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3855
|
-
dir:
|
|
3815
|
+
dir: direction,
|
|
3856
3816
|
className: "univer-w-80",
|
|
3857
3817
|
children: _univerjs_sheets_conditional_formatting.iconGroup.map((group) => {
|
|
3858
3818
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3861,6 +3821,8 @@ const IconGroupList = (props) => {
|
|
|
3861
3821
|
className: "univer-mb-2 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400",
|
|
3862
3822
|
children: localeService.t(group.title)
|
|
3863
3823
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3824
|
+
dir: direction,
|
|
3825
|
+
"data-u-comp": "cf-icon-set-group-grid",
|
|
3864
3826
|
className: "univer-grid univer-grid-cols-2 univer-gap-1",
|
|
3865
3827
|
children: group.group.map((groupItem, groupItemIndex) => {
|
|
3866
3828
|
const selected = groupItem.name === iconType;
|
|
@@ -3868,11 +3830,12 @@ const IconGroupList = (props) => {
|
|
|
3868
3830
|
type: "button",
|
|
3869
3831
|
"aria-label": `${localeService.t(group.title)} ${groupItemIndex + 1}`,
|
|
3870
3832
|
"aria-pressed": selected,
|
|
3871
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-md univer-border-0 univer-bg-transparent univer-px-2 univer-outline-none univer-transition-colors focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600
|
|
3833
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-justify-start univer-rounded-md univer-border-0 univer-bg-transparent univer-px-2 univer-outline-none univer-transition-colors focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600", selected ? "univer-bg-primary-50 univer-ring-1 univer-ring-primary-600 dark:!univer-bg-primary-900" : "hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700"),
|
|
3872
3834
|
onClick: () => {
|
|
3873
3835
|
onClick(groupItem.name);
|
|
3874
3836
|
},
|
|
3875
3837
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3838
|
+
dir: direction,
|
|
3876
3839
|
className: "univer-flex univer-items-center univer-gap-0.5",
|
|
3877
3840
|
children: groupItem.list.map((base64, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
3878
3841
|
alt: "",
|
|
@@ -4014,6 +3977,7 @@ const IconSetRuleEdit = (props) => {
|
|
|
4014
3977
|
className: "univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",
|
|
4015
3978
|
children: [
|
|
4016
3979
|
localeService.t("sheets-conditional-formatting-ui.iconSet.when"),
|
|
3980
|
+
" ",
|
|
4017
3981
|
localeService.t(`sheets-conditional-formatting-ui.symbol.${(0, _univerjs_sheets_conditional_formatting.getOppositeOperator)(preItem.operator)}`),
|
|
4018
3982
|
lessThanText,
|
|
4019
3983
|
isEnd ? "" : ` ${localeService.t("sheets-conditional-formatting-ui.iconSet.and")} `
|
|
@@ -4036,7 +4000,7 @@ const IconSetRuleEdit = (props) => {
|
|
|
4036
4000
|
})
|
|
4037
4001
|
}),
|
|
4038
4002
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4039
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-
|
|
4003
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200", _univerjs_design.borderClassName),
|
|
4040
4004
|
children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
4041
4005
|
src: icon,
|
|
4042
4006
|
className: "univer-size-4",
|
|
@@ -4056,6 +4020,7 @@ const IconSetRuleEdit = (props) => {
|
|
|
4056
4020
|
className: "univer-font-medium",
|
|
4057
4021
|
children: [
|
|
4058
4022
|
localeService.t("sheets-conditional-formatting-ui.iconSet.when"),
|
|
4023
|
+
" ",
|
|
4059
4024
|
localeService.t(`sheets-conditional-formatting-ui.symbol.${(0, _univerjs_sheets_conditional_formatting.getOppositeOperator)(preItem.operator)}`),
|
|
4060
4025
|
lessThanText,
|
|
4061
4026
|
isEnd ? "" : ` ${localeService.t("sheets-conditional-formatting-ui.iconSet.and")} `
|
|
@@ -4248,7 +4213,7 @@ const IconSet = (props) => {
|
|
|
4248
4213
|
})
|
|
4249
4214
|
}),
|
|
4250
4215
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4251
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-
|
|
4216
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600", _univerjs_design.borderClassName),
|
|
4252
4217
|
children: [previewIcon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
|
|
4253
4218
|
})
|
|
4254
4219
|
})
|
|
@@ -4889,7 +4854,7 @@ function RuleList(props) {
|
|
|
4889
4854
|
}
|
|
4890
4855
|
})).map((ele, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: ele }, index))
|
|
4891
4856
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4892
|
-
className: "univer-flex univer-justify-end univer-
|
|
4857
|
+
className: "univer-flex univer-justify-end univer-gap-2",
|
|
4893
4858
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
4894
4859
|
title: localeService.t("sheets-conditional-formatting-ui.panel.createRule"),
|
|
4895
4860
|
placement: "bottom",
|
|
@@ -4919,7 +4884,7 @@ function RuleList(props) {
|
|
|
4919
4884
|
onDragStop: handleDragStop,
|
|
4920
4885
|
onDragStart: handleDragStart,
|
|
4921
4886
|
itemRender: (rule) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4922
|
-
className: (0, _univerjs_design.clsx)("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 dark:!univer-bg-gray-700": draggingId === rule.cfId }),
|
|
4887
|
+
className: (0, _univerjs_design.clsx)("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 rtl:univer-pl-8 rtl:univer-pr-5 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-100 dark:!univer-bg-gray-700": draggingId === rule.cfId }),
|
|
4923
4888
|
onMouseMove: () => {
|
|
4924
4889
|
rule.ranges !== currentRuleRanges && setCurrentRuleRanges(rule.ranges);
|
|
4925
4890
|
},
|
|
@@ -4929,14 +4894,14 @@ function RuleList(props) {
|
|
|
4929
4894
|
},
|
|
4930
4895
|
children: [
|
|
4931
4896
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4932
|
-
className: (0, _univerjs_design.clsx)("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex", "draggableHandle"),
|
|
4897
|
+
className: (0, _univerjs_design.clsx)("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex rtl:univer-left-auto rtl:univer-right-0", "draggableHandle"),
|
|
4933
4898
|
onClick: (e) => e.stopPropagation(),
|
|
4934
4899
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.GripVerticalIcon, {})
|
|
4935
4900
|
}),
|
|
4936
4901
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4937
4902
|
className: "univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",
|
|
4938
4903
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4939
|
-
className: "univer-text-sm univer-text-gray-900 dark:!univer-text-
|
|
4904
|
+
className: "univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0",
|
|
4940
4905
|
children: getRuleDescribe(rule, localeService)
|
|
4941
4906
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4942
4907
|
className: "univer-max-w-[250px] univer-overflow-hidden univer-text-ellipsis univer-text-xs univer-text-gray-400",
|
|
@@ -4945,7 +4910,7 @@ function RuleList(props) {
|
|
|
4945
4910
|
}),
|
|
4946
4911
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Preview, { rule: rule.rule }) }),
|
|
4947
4912
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4948
|
-
className: (0, _univerjs_design.clsx)("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200", { "univer-flex univer-items-center univer-justify-center": draggingId === rule.cfId }),
|
|
4913
|
+
className: (0, _univerjs_design.clsx)("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200 rtl:univer-left-1 rtl:univer-right-auto", { "univer-flex univer-items-center univer-justify-center": draggingId === rule.cfId }),
|
|
4949
4914
|
onClick: (e) => {
|
|
4950
4915
|
e.stopPropagation();
|
|
4951
4916
|
handleDelete(rule);
|