@fileverse-dev/fortune-core 1.2.72-condition-1 → 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,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";
@@ -996,10 +1005,26 @@ export function compute(ctx, ruleArr, d) {
996
1005
  return computeMap;
997
1006
  }
998
1007
  export function getComputeMap(ctx) {
1008
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
999
1009
  var index = getSheetIndex(ctx, ctx.currentSheetId);
1000
- 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) : [];
1001
1011
  var data = ctx.luckysheetfile[index].data;
1002
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
+ });
1003
1028
  var computeMap = compute(ctx, ruleArr, data);
1004
1029
  return computeMap;
1005
1030
  }
@@ -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
  }
@@ -1011,10 +1020,26 @@ function compute(ctx, ruleArr, d) {
1011
1020
  return computeMap;
1012
1021
  }
1013
1022
  function getComputeMap(ctx) {
1023
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1014
1024
  var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
1015
- 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) : [];
1016
1026
  var data = ctx.luckysheetfile[index].data;
1017
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
+ });
1018
1043
  var computeMap = compute(ctx, ruleArr, data);
1019
1044
  return computeMap;
1020
1045
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.2.72-condition-1",
3
+ "version": "1.2.73",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",