@fileverse-dev/fortune-core 1.2.70 → 1.2.72-condition-1

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;
@@ -116,8 +116,9 @@ export function getCurrentRules(fileC) {
116
116
  }
117
117
  return currentRules;
118
118
  }
119
- export function setConditionRules(ctx, protection, generalDialog, conditionformat, rules) {
119
+ export function setConditionRules(ctx, protection, generalDialog, conditionformat, rules, edit, editKey) {
120
120
  var _a, _b;
121
+ console.log("rules formatttttte", rules);
121
122
  if (!checkProtectionFormatCells(ctx)) {
122
123
  return;
123
124
  }
@@ -257,7 +258,12 @@ export function setConditionRules(ctx, protection, generalDialog, conditionforma
257
258
  };
258
259
  var index = getSheetIndex(ctx, ctx.currentSheetId);
259
260
  var ruleArr = (_b = ctx.luckysheetfile[index].luckysheet_conditionformat_save) !== null && _b !== void 0 ? _b : [];
260
- ruleArr === null || ruleArr === void 0 ? void 0 : ruleArr.push(rule);
261
+ console.log(rule, ruleArr, editKey, edit);
262
+ if (edit) {
263
+ ruleArr.splice(Number(editKey), 1, rule);
264
+ } else {
265
+ ruleArr.push(rule);
266
+ }
261
267
  ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
262
268
  ctx.luckysheetfile[index].conditionRules = __assign(__assign({}, rules), {
263
269
  rulesType: rules.rulesType || "",
@@ -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;
@@ -131,8 +131,9 @@ function getCurrentRules(fileC) {
131
131
  }
132
132
  return currentRules;
133
133
  }
134
- function setConditionRules(ctx, protection, generalDialog, conditionformat, rules) {
134
+ function setConditionRules(ctx, protection, generalDialog, conditionformat, rules, edit, editKey) {
135
135
  var _a, _b;
136
+ console.log("rules formatttttte", rules);
136
137
  if (!(0, _protection.checkProtectionFormatCells)(ctx)) {
137
138
  return;
138
139
  }
@@ -272,7 +273,12 @@ function setConditionRules(ctx, protection, generalDialog, conditionformat, rule
272
273
  };
273
274
  var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
274
275
  var ruleArr = (_b = ctx.luckysheetfile[index].luckysheet_conditionformat_save) !== null && _b !== void 0 ? _b : [];
275
- ruleArr === null || ruleArr === void 0 ? void 0 : ruleArr.push(rule);
276
+ console.log(rule, ruleArr, editKey, edit);
277
+ if (edit) {
278
+ ruleArr.splice(Number(editKey), 1, rule);
279
+ } else {
280
+ ruleArr.push(rule);
281
+ }
276
282
  ctx.luckysheetfile[index].luckysheet_conditionformat_save = ruleArr;
277
283
  ctx.luckysheetfile[index].conditionRules = __assign(__assign({}, rules), {
278
284
  rulesType: rules.rulesType || "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.70",
3
+ "version": "1.2.72-condition-1",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",