@leankylin-sheet/excel 5.2.56 → 5.2.57

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/dist/index.esm.js CHANGED
@@ -5086,7 +5086,7 @@ var getVariable = function getVariable(variables, sheetId, name) {
5086
5086
  var replaceVariablesInFormula = function replaceVariablesInFormula(formula, variables, sheetId) {
5087
5087
  if (_.isNil(variables)) return formula;
5088
5088
  return formula.replace(/\{\{(.*?)\}\}/g, function (match) {
5089
- var value = getVariable(variables, sheetId, match);
5089
+ var value = getVariable(variables, sheetId, match) || 0;
5090
5090
  if (_.isNil(value)) return match;
5091
5091
  if (typeof value === "string") return "\"".concat(value.replace(/"/g, '""'), "\"");
5092
5092
  if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
@@ -5183,15 +5183,10 @@ var setStyleAndValue = function setStyleAndValue(table, worksheet, variables) {
5183
5183
  }
5184
5184
  if (cell.f && _typeof(v) !== "object") {
5185
5185
  var formulaStr = cell.f.startsWith("=") ? cell.f.slice(1) : cell.f;
5186
- var hasVariables = cell.f.includes("{{");
5187
- if (hasVariables) {
5188
- value = v;
5189
- } else {
5190
- value = {
5191
- formula: replaceVariablesInFormula(formulaStr, variables, table.id),
5192
- result: v
5193
- };
5194
- }
5186
+ value = {
5187
+ formula: replaceVariablesInFormula(formulaStr, variables, table.id),
5188
+ result: v
5189
+ };
5195
5190
  } else {
5196
5191
  value = v;
5197
5192
  }
package/dist/index.js CHANGED
@@ -5098,7 +5098,7 @@ var getVariable = function getVariable(variables, sheetId, name) {
5098
5098
  var replaceVariablesInFormula = function replaceVariablesInFormula(formula, variables, sheetId) {
5099
5099
  if (___default['default'].isNil(variables)) return formula;
5100
5100
  return formula.replace(/\{\{(.*?)\}\}/g, function (match) {
5101
- var value = getVariable(variables, sheetId, match);
5101
+ var value = getVariable(variables, sheetId, match) || 0;
5102
5102
  if (___default['default'].isNil(value)) return match;
5103
5103
  if (typeof value === "string") return "\"".concat(value.replace(/"/g, '""'), "\"");
5104
5104
  if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
@@ -5195,15 +5195,10 @@ var setStyleAndValue = function setStyleAndValue(table, worksheet, variables) {
5195
5195
  }
5196
5196
  if (cell.f && _typeof(v) !== "object") {
5197
5197
  var formulaStr = cell.f.startsWith("=") ? cell.f.slice(1) : cell.f;
5198
- var hasVariables = cell.f.includes("{{");
5199
- if (hasVariables) {
5200
- value = v;
5201
- } else {
5202
- value = {
5203
- formula: replaceVariablesInFormula(formulaStr, variables, table.id),
5204
- result: v
5205
- };
5206
- }
5198
+ value = {
5199
+ formula: replaceVariablesInFormula(formulaStr, variables, table.id),
5200
+ result: v
5201
+ };
5207
5202
  } else {
5208
5203
  value = v;
5209
5204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/excel",
3
- "version": "5.2.56",
3
+ "version": "5.2.57",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.esm.js",