autoql-fe-utils 1.11.10 → 1.11.12

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.
@@ -21583,26 +21583,36 @@
21583
21583
  var isValueEmpty = (value) => {
21584
21584
  return value === null || value === void 0 || value === "";
21585
21585
  };
21586
+ var validateBracketNesting = (bracketArray) => {
21587
+ let depth = 0;
21588
+ for (let i = 0; i < bracketArray.length; i++) {
21589
+ const chunk = bracketArray[i];
21590
+ if (chunk.value === "LEFT_BRACKET" /* LEFT_BRACKET */) {
21591
+ depth++;
21592
+ } else if (chunk.value === "RIGHT_BRACKET" /* RIGHT_BRACKET */) {
21593
+ depth--;
21594
+ if (depth < 0) {
21595
+ throw new ChataError("Syntax Error: Formula contains closing bracket without opening");
21596
+ }
21597
+ }
21598
+ }
21599
+ if (depth !== 0) {
21600
+ throw new ChataError("Syntax Error: Formula contains unclosed brackets");
21601
+ }
21602
+ };
21586
21603
  var convertToFunctionStr = (origColumnFnArray) => {
21587
- var _a, _b;
21588
21604
  try {
21589
21605
  let columnFnStr = "";
21590
- const numRightBrackets = (_a = origColumnFnArray.filter(
21591
- (chunk) => chunk.value === "RIGHT_BRACKET" /* RIGHT_BRACKET */
21592
- )) == null ? void 0 : _a.length;
21593
- const numLeftBrackets = (_b = origColumnFnArray.filter((chunk) => chunk.value === "LEFT_BRACKET" /* LEFT_BRACKET */)) == null ? void 0 : _b.length;
21594
- if (numRightBrackets !== numLeftBrackets) {
21595
- throw new ChataError("Syntax Error: Formula contains unclosed brackets");
21596
- }
21606
+ validateBracketNesting(origColumnFnArray);
21597
21607
  origColumnFnArray.forEach((chunk, i) => {
21598
- var _a2, _b2, _c;
21608
+ var _a, _b, _c;
21599
21609
  if (chunk.type === "operator" /* OPERATOR */) {
21600
21610
  if (i === origColumnFnArray.length - 1) {
21601
21611
  if (chunk.value !== "RIGHT_BRACKET" /* RIGHT_BRACKET */) {
21602
21612
  throw new ChataError("Syntax Error: Formula can't end with an operator");
21603
21613
  }
21604
21614
  }
21605
- columnFnStr = columnFnStr + " " + ((_b2 = (_a2 = OPERATORS[chunk.value]) == null ? void 0 : _a2.js) != null ? _b2 : "");
21615
+ columnFnStr = columnFnStr + " " + ((_b = (_a = OPERATORS[chunk.value]) == null ? void 0 : _a.js) != null ? _b : "");
21606
21616
  } else if (chunk.type === "number") {
21607
21617
  if (isValueEmpty(chunk.value)) {
21608
21618
  throw new ChataError("Syntax Error: Number input is empty");
@@ -21780,6 +21790,20 @@
21780
21790
  denEnd++;
21781
21791
  } else {
21782
21792
  while (denEnd < s.length && /[^\s(),+\-*/]/.test(s[denEnd])) denEnd++;
21793
+ if (denEnd < s.length && s[denEnd] === "(") {
21794
+ let depth = 0;
21795
+ while (denEnd < s.length) {
21796
+ if (s[denEnd] === "(") depth++;
21797
+ else if (s[denEnd] === ")") {
21798
+ depth--;
21799
+ if (depth === 0) {
21800
+ denEnd++;
21801
+ break;
21802
+ }
21803
+ }
21804
+ denEnd++;
21805
+ }
21806
+ }
21783
21807
  }
21784
21808
  if (isInProtectedRange(i)) {
21785
21809
  i = denEnd;
@@ -25301,7 +25325,7 @@
25301
25325
  colorScales,
25302
25326
  isDataAggregated
25303
25327
  }) => {
25304
- var _a, _b, _c, _d, _e, _f, _g, _h;
25328
+ var _a, _b;
25305
25329
  const commonParams = {
25306
25330
  stacked,
25307
25331
  isScaled,
@@ -25337,17 +25361,6 @@
25337
25361
  ...scaleColumnConfig,
25338
25362
  ...commonParams
25339
25363
  });
25340
- try {
25341
- console.debug("[chartHelpers] tempScale1", {
25342
- range: (_a = tempScale1.range) == null ? void 0 : _a.call(tempScale1),
25343
- domain: (_b = tempScale1.domain) == null ? void 0 : _b.call(tempScale1),
25344
- minValue: tempScale1.minValue,
25345
- maxValue: tempScale1.maxValue,
25346
- height,
25347
- width
25348
- });
25349
- } catch (e) {
25350
- }
25351
25364
  if (!hasSecondAxis) {
25352
25365
  return {
25353
25366
  scale: tempScale1
@@ -25368,7 +25381,7 @@
25368
25381
  maxValue: maxValue2,
25369
25382
  disableAutoScale: disableAutoScale != null ? disableAutoScale : disableScale2,
25370
25383
  range: tempScale1.range(),
25371
- numTicks: (_d = (_c = tempScale1.tickLabels) == null ? void 0 : _c.length) != null ? _d : void 0,
25384
+ numTicks: (_b = (_a = tempScale1.tickLabels) == null ? void 0 : _a.length) != null ? _b : void 0,
25372
25385
  ...scaleColumnConfig2,
25373
25386
  ...commonParams
25374
25387
  });
@@ -25409,23 +25422,6 @@
25409
25422
  });
25410
25423
  scale.secondScale = scale2;
25411
25424
  scale2.secondScale = scale;
25412
- try {
25413
- console.debug("[chartHelpers] pairedScales", {
25414
- scale1: {
25415
- range: (_e = scale.range) == null ? void 0 : _e.call(scale),
25416
- domain: (_f = scale.domain) == null ? void 0 : _f.call(scale),
25417
- minValue: scale.minValue,
25418
- maxValue: scale.maxValue
25419
- },
25420
- scale2: {
25421
- range: (_g = scale2.range) == null ? void 0 : _g.call(scale2),
25422
- domain: (_h = scale2.domain) == null ? void 0 : _h.call(scale2),
25423
- minValue: scale2.minValue,
25424
- maxValue: scale2.maxValue
25425
- }
25426
- });
25427
- } catch (e) {
25428
- }
25429
25425
  return { scale, scale2 };
25430
25426
  };
25431
25427
  var doesElementOverflowContainer = (element, container) => {