@fileverse-dev/fortune-core 1.2.72 → 1.2.73
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.
|
@@ -8,7 +8,7 @@ export declare function getCurrentRules(fileC: Sheet[]): {
|
|
|
8
8
|
sheetIndex: number;
|
|
9
9
|
luckysheet_conditionformat_save: any[] | undefined;
|
|
10
10
|
}[];
|
|
11
|
-
export declare function setConditionRules(ctx: Context, protection: any, generalDialog: any, conditionformat: any, rules: any): void;
|
|
11
|
+
export declare function setConditionRules(ctx: Context, protection: any, generalDialog: any, conditionformat: any, rules: any, edit?: boolean, editKey?: string): void;
|
|
12
12
|
export declare function getColorGradation(color1: string, color2: string, value1: number, value2: number, value: number): string;
|
|
13
13
|
export declare function compute(ctx: Context, ruleArr: any, d: CellMatrix): any;
|
|
14
14
|
export declare function getComputeMap(ctx: Context): any;
|
|
@@ -8,6 +8,15 @@ var __assign = this && this.__assign || function () {
|
|
|
8
8
|
};
|
|
9
9
|
return __assign.apply(this, arguments);
|
|
10
10
|
};
|
|
11
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
12
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
13
|
+
if (ar || !(i in from)) {
|
|
14
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
15
|
+
ar[i] = from[i];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
19
|
+
};
|
|
11
20
|
import _ from "lodash";
|
|
12
21
|
import { getFlowdata } from "../context";
|
|
13
22
|
import { getSheetIndex } from "../utils";
|
|
@@ -116,8 +125,9 @@ export function getCurrentRules(fileC) {
|
|
|
116
125
|
}
|
|
117
126
|
return currentRules;
|
|
118
127
|
}
|
|
119
|
-
export function setConditionRules(ctx, protection, generalDialog, conditionformat, rules) {
|
|
128
|
+
export function setConditionRules(ctx, protection, generalDialog, conditionformat, rules, edit, editKey) {
|
|
120
129
|
var _a, _b;
|
|
130
|
+
console.log("rules formatttttte", rules);
|
|
121
131
|
if (!checkProtectionFormatCells(ctx)) {
|
|
122
132
|
return;
|
|
123
133
|
}
|
|
@@ -257,7 +267,12 @@ export function setConditionRules(ctx, protection, generalDialog, conditionforma
|
|
|
257
267
|
};
|
|
258
268
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
259
269
|
var ruleArr = (_b = ctx.luckysheetfile[index].luckysheet_conditionformat_save) !== null && _b !== void 0 ? _b : [];
|
|
260
|
-
|
|
270
|
+
console.log(rule, ruleArr, editKey, edit);
|
|
271
|
+
if (edit) {
|
|
272
|
+
ruleArr.splice(Number(editKey), 1, rule);
|
|
273
|
+
} else {
|
|
274
|
+
ruleArr.push(rule);
|
|
275
|
+
}
|
|
261
276
|
ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
|
|
262
277
|
ctx.luckysheetfile[index].conditionRules = __assign(__assign({}, rules), {
|
|
263
278
|
rulesType: rules.rulesType || "",
|
|
@@ -990,10 +1005,26 @@ export function compute(ctx, ruleArr, d) {
|
|
|
990
1005
|
return computeMap;
|
|
991
1006
|
}
|
|
992
1007
|
export function getComputeMap(ctx) {
|
|
1008
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
993
1009
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
994
|
-
var ruleArr = ctx.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
1010
|
+
var ruleArr = ((_a = ctx.luckysheetfile[index]) === null || _a === void 0 ? void 0 : _a.luckysheet_conditionformat_save) ? __spreadArray([], (_b = ctx.luckysheetfile[index]) === null || _b === void 0 ? void 0 : _b.luckysheet_conditionformat_save, true) : [];
|
|
995
1011
|
var data = ctx.luckysheetfile[index].data;
|
|
996
1012
|
if (_.isNil(data)) return null;
|
|
1013
|
+
if (ctx.luckysheet_select_save && ((_c = ctx.luckysheetfile[index].conditionRules) === null || _c === void 0 ? void 0 : _c.rulesValue) !== "") ruleArr.unshift({
|
|
1014
|
+
type: "default",
|
|
1015
|
+
cellrange: ctx.luckysheet_select_save,
|
|
1016
|
+
format: {
|
|
1017
|
+
textColor: (_d = ctx.luckysheetfile[index].conditionRules) === null || _d === void 0 ? void 0 : _d.textColor.color,
|
|
1018
|
+
cellColor: (_e = ctx.luckysheetfile[index].conditionRules) === null || _e === void 0 ? void 0 : _e.cellColor.color,
|
|
1019
|
+
bold: (_f = ctx.luckysheetfile[index].conditionRules) === null || _f === void 0 ? void 0 : _f.font.bold,
|
|
1020
|
+
italic: (_g = ctx.luckysheetfile[index].conditionRules) === null || _g === void 0 ? void 0 : _g.font.italic,
|
|
1021
|
+
underline: (_h = ctx.luckysheetfile[index].conditionRules) === null || _h === void 0 ? void 0 : _h.font.underline,
|
|
1022
|
+
strikethrough: (_j = ctx.luckysheetfile[index].conditionRules) === null || _j === void 0 ? void 0 : _j.font.strikethrough
|
|
1023
|
+
},
|
|
1024
|
+
conditionName: (_k = ctx.luckysheetfile[index].conditionRules) === null || _k === void 0 ? void 0 : _k.rulesType,
|
|
1025
|
+
conditionRange: [],
|
|
1026
|
+
conditionValue: [(_l = ctx.luckysheetfile[index].conditionRules) === null || _l === void 0 ? void 0 : _l.rulesValue]
|
|
1027
|
+
});
|
|
997
1028
|
var computeMap = compute(ctx, ruleArr, data);
|
|
998
1029
|
return computeMap;
|
|
999
1030
|
}
|
|
@@ -8,7 +8,7 @@ export declare function getCurrentRules(fileC: Sheet[]): {
|
|
|
8
8
|
sheetIndex: number;
|
|
9
9
|
luckysheet_conditionformat_save: any[] | undefined;
|
|
10
10
|
}[];
|
|
11
|
-
export declare function setConditionRules(ctx: Context, protection: any, generalDialog: any, conditionformat: any, rules: any): void;
|
|
11
|
+
export declare function setConditionRules(ctx: Context, protection: any, generalDialog: any, conditionformat: any, rules: any, edit?: boolean, editKey?: string): void;
|
|
12
12
|
export declare function getColorGradation(color1: string, color2: string, value1: number, value2: number, value: number): string;
|
|
13
13
|
export declare function compute(ctx: Context, ruleArr: any, d: CellMatrix): any;
|
|
14
14
|
export declare function getComputeMap(ctx: Context): any;
|
|
@@ -31,6 +31,15 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
31
31
|
};
|
|
32
32
|
return __assign.apply(this, arguments);
|
|
33
33
|
};
|
|
34
|
+
var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
|
|
35
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
36
|
+
if (ar || !(i in from)) {
|
|
37
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
38
|
+
ar[i] = from[i];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
42
|
+
};
|
|
34
43
|
function hasAlphabeticChars(value) {
|
|
35
44
|
return /[a-zA-Z]/.test(String(value));
|
|
36
45
|
}
|
|
@@ -131,8 +140,9 @@ function getCurrentRules(fileC) {
|
|
|
131
140
|
}
|
|
132
141
|
return currentRules;
|
|
133
142
|
}
|
|
134
|
-
function setConditionRules(ctx, protection, generalDialog, conditionformat, rules) {
|
|
143
|
+
function setConditionRules(ctx, protection, generalDialog, conditionformat, rules, edit, editKey) {
|
|
135
144
|
var _a, _b;
|
|
145
|
+
console.log("rules formatttttte", rules);
|
|
136
146
|
if (!(0, _protection.checkProtectionFormatCells)(ctx)) {
|
|
137
147
|
return;
|
|
138
148
|
}
|
|
@@ -272,7 +282,12 @@ function setConditionRules(ctx, protection, generalDialog, conditionformat, rule
|
|
|
272
282
|
};
|
|
273
283
|
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
274
284
|
var ruleArr = (_b = ctx.luckysheetfile[index].luckysheet_conditionformat_save) !== null && _b !== void 0 ? _b : [];
|
|
275
|
-
|
|
285
|
+
console.log(rule, ruleArr, editKey, edit);
|
|
286
|
+
if (edit) {
|
|
287
|
+
ruleArr.splice(Number(editKey), 1, rule);
|
|
288
|
+
} else {
|
|
289
|
+
ruleArr.push(rule);
|
|
290
|
+
}
|
|
276
291
|
ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
|
|
277
292
|
ctx.luckysheetfile[index].conditionRules = __assign(__assign({}, rules), {
|
|
278
293
|
rulesType: rules.rulesType || "",
|
|
@@ -1005,10 +1020,26 @@ function compute(ctx, ruleArr, d) {
|
|
|
1005
1020
|
return computeMap;
|
|
1006
1021
|
}
|
|
1007
1022
|
function getComputeMap(ctx) {
|
|
1023
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1008
1024
|
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
1009
|
-
var ruleArr = ctx.luckysheetfile[index].luckysheet_conditionformat_save;
|
|
1025
|
+
var ruleArr = ((_a = ctx.luckysheetfile[index]) === null || _a === void 0 ? void 0 : _a.luckysheet_conditionformat_save) ? __spreadArray([], (_b = ctx.luckysheetfile[index]) === null || _b === void 0 ? void 0 : _b.luckysheet_conditionformat_save, true) : [];
|
|
1010
1026
|
var data = ctx.luckysheetfile[index].data;
|
|
1011
1027
|
if (_lodash.default.isNil(data)) return null;
|
|
1028
|
+
if (ctx.luckysheet_select_save && ((_c = ctx.luckysheetfile[index].conditionRules) === null || _c === void 0 ? void 0 : _c.rulesValue) !== "") ruleArr.unshift({
|
|
1029
|
+
type: "default",
|
|
1030
|
+
cellrange: ctx.luckysheet_select_save,
|
|
1031
|
+
format: {
|
|
1032
|
+
textColor: (_d = ctx.luckysheetfile[index].conditionRules) === null || _d === void 0 ? void 0 : _d.textColor.color,
|
|
1033
|
+
cellColor: (_e = ctx.luckysheetfile[index].conditionRules) === null || _e === void 0 ? void 0 : _e.cellColor.color,
|
|
1034
|
+
bold: (_f = ctx.luckysheetfile[index].conditionRules) === null || _f === void 0 ? void 0 : _f.font.bold,
|
|
1035
|
+
italic: (_g = ctx.luckysheetfile[index].conditionRules) === null || _g === void 0 ? void 0 : _g.font.italic,
|
|
1036
|
+
underline: (_h = ctx.luckysheetfile[index].conditionRules) === null || _h === void 0 ? void 0 : _h.font.underline,
|
|
1037
|
+
strikethrough: (_j = ctx.luckysheetfile[index].conditionRules) === null || _j === void 0 ? void 0 : _j.font.strikethrough
|
|
1038
|
+
},
|
|
1039
|
+
conditionName: (_k = ctx.luckysheetfile[index].conditionRules) === null || _k === void 0 ? void 0 : _k.rulesType,
|
|
1040
|
+
conditionRange: [],
|
|
1041
|
+
conditionValue: [(_l = ctx.luckysheetfile[index].conditionRules) === null || _l === void 0 ? void 0 : _l.rulesValue]
|
|
1042
|
+
});
|
|
1012
1043
|
var computeMap = compute(ctx, ruleArr, data);
|
|
1013
1044
|
return computeMap;
|
|
1014
1045
|
}
|