@fileverse-dev/fortune-core 1.2.73 → 1.2.74

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/es/context.js CHANGED
@@ -153,6 +153,7 @@ export function defaultContext(refs) {
153
153
  },
154
154
  dataVerificationDropDownList: false,
155
155
  conditionRules: {
156
+ editKey: null,
156
157
  rulesType: "",
157
158
  rulesValue: "",
158
159
  textColor: {
@@ -127,7 +127,6 @@ export function getCurrentRules(fileC) {
127
127
  }
128
128
  export function setConditionRules(ctx, protection, generalDialog, conditionformat, rules, edit, editKey) {
129
129
  var _a, _b;
130
- console.log("rules formatttttte", rules);
131
130
  if (!checkProtectionFormatCells(ctx)) {
132
131
  return;
133
132
  }
@@ -1005,26 +1004,32 @@ export function compute(ctx, ruleArr, d) {
1005
1004
  return computeMap;
1006
1005
  }
1007
1006
  export function getComputeMap(ctx) {
1008
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1007
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1009
1008
  var index = getSheetIndex(ctx, ctx.currentSheetId);
1010
1009
  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) : [];
1011
1010
  var data = ctx.luckysheetfile[index].data;
1012
1011
  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
- });
1012
+ if (ctx.luckysheet_select_save && ((_c = ctx.luckysheetfile[index].conditionRules) === null || _c === void 0 ? void 0 : _c.rulesValue) !== "") {
1013
+ var editKey = (_d = ctx.luckysheetfile[index].conditionRules) === null || _d === void 0 ? void 0 : _d.editKey;
1014
+ if (editKey !== null) {
1015
+ ruleArr.splice(Number(editKey), 1);
1016
+ }
1017
+ ruleArr.push({
1018
+ type: "default",
1019
+ cellrange: ctx.luckysheet_select_save,
1020
+ format: {
1021
+ textColor: (_e = ctx.luckysheetfile[index].conditionRules) === null || _e === void 0 ? void 0 : _e.textColor.color,
1022
+ cellColor: (_f = ctx.luckysheetfile[index].conditionRules) === null || _f === void 0 ? void 0 : _f.cellColor.color,
1023
+ bold: (_g = ctx.luckysheetfile[index].conditionRules) === null || _g === void 0 ? void 0 : _g.font.bold,
1024
+ italic: (_h = ctx.luckysheetfile[index].conditionRules) === null || _h === void 0 ? void 0 : _h.font.italic,
1025
+ underline: (_j = ctx.luckysheetfile[index].conditionRules) === null || _j === void 0 ? void 0 : _j.font.underline,
1026
+ strikethrough: (_k = ctx.luckysheetfile[index].conditionRules) === null || _k === void 0 ? void 0 : _k.font.strikethrough
1027
+ },
1028
+ conditionName: (_l = ctx.luckysheetfile[index].conditionRules) === null || _l === void 0 ? void 0 : _l.rulesType,
1029
+ conditionRange: [],
1030
+ conditionValue: [(_m = ctx.luckysheetfile[index].conditionRules) === null || _m === void 0 ? void 0 : _m.rulesValue]
1031
+ });
1032
+ }
1028
1033
  var computeMap = compute(ctx, ruleArr, data);
1029
1034
  return computeMap;
1030
1035
  }
package/es/types.d.ts CHANGED
@@ -134,6 +134,7 @@ export type Image = {
134
134
  src: string;
135
135
  };
136
136
  export type ConditionRulesProps = {
137
+ editKey?: string | null;
137
138
  rulesType: string;
138
139
  rulesValue: string;
139
140
  textColor: {
package/lib/context.js CHANGED
@@ -165,6 +165,7 @@ function defaultContext(refs) {
165
165
  },
166
166
  dataVerificationDropDownList: false,
167
167
  conditionRules: {
168
+ editKey: null,
168
169
  rulesType: "",
169
170
  rulesValue: "",
170
171
  textColor: {
@@ -142,7 +142,6 @@ function getCurrentRules(fileC) {
142
142
  }
143
143
  function setConditionRules(ctx, protection, generalDialog, conditionformat, rules, edit, editKey) {
144
144
  var _a, _b;
145
- console.log("rules formatttttte", rules);
146
145
  if (!(0, _protection.checkProtectionFormatCells)(ctx)) {
147
146
  return;
148
147
  }
@@ -1020,26 +1019,32 @@ function compute(ctx, ruleArr, d) {
1020
1019
  return computeMap;
1021
1020
  }
1022
1021
  function getComputeMap(ctx) {
1023
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1022
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1024
1023
  var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1025
1024
  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) : [];
1026
1025
  var data = ctx.luckysheetfile[index].data;
1027
1026
  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
- });
1027
+ if (ctx.luckysheet_select_save && ((_c = ctx.luckysheetfile[index].conditionRules) === null || _c === void 0 ? void 0 : _c.rulesValue) !== "") {
1028
+ var editKey = (_d = ctx.luckysheetfile[index].conditionRules) === null || _d === void 0 ? void 0 : _d.editKey;
1029
+ if (editKey !== null) {
1030
+ ruleArr.splice(Number(editKey), 1);
1031
+ }
1032
+ ruleArr.push({
1033
+ type: "default",
1034
+ cellrange: ctx.luckysheet_select_save,
1035
+ format: {
1036
+ textColor: (_e = ctx.luckysheetfile[index].conditionRules) === null || _e === void 0 ? void 0 : _e.textColor.color,
1037
+ cellColor: (_f = ctx.luckysheetfile[index].conditionRules) === null || _f === void 0 ? void 0 : _f.cellColor.color,
1038
+ bold: (_g = ctx.luckysheetfile[index].conditionRules) === null || _g === void 0 ? void 0 : _g.font.bold,
1039
+ italic: (_h = ctx.luckysheetfile[index].conditionRules) === null || _h === void 0 ? void 0 : _h.font.italic,
1040
+ underline: (_j = ctx.luckysheetfile[index].conditionRules) === null || _j === void 0 ? void 0 : _j.font.underline,
1041
+ strikethrough: (_k = ctx.luckysheetfile[index].conditionRules) === null || _k === void 0 ? void 0 : _k.font.strikethrough
1042
+ },
1043
+ conditionName: (_l = ctx.luckysheetfile[index].conditionRules) === null || _l === void 0 ? void 0 : _l.rulesType,
1044
+ conditionRange: [],
1045
+ conditionValue: [(_m = ctx.luckysheetfile[index].conditionRules) === null || _m === void 0 ? void 0 : _m.rulesValue]
1046
+ });
1047
+ }
1043
1048
  var computeMap = compute(ctx, ruleArr, data);
1044
1049
  return computeMap;
1045
1050
  }
package/lib/types.d.ts CHANGED
@@ -134,6 +134,7 @@ export type Image = {
134
134
  src: string;
135
135
  };
136
136
  export type ConditionRulesProps = {
137
+ editKey?: string | null;
137
138
  rulesType: string;
138
139
  rulesValue: string;
139
140
  textColor: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.73",
3
+ "version": "1.2.74",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",