@fw-components/formula-editor 2.3.4-linting.0 → 2.3.4-linting.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.
@@ -10,34 +10,31 @@ import { getFormulaTokens } from "./utils/get-formula-tokens.js";
10
10
  import { Parser } from "./utils/parser.js";
11
11
  import { FormulaEditorStyles } from "./styles/editor.js";
12
12
  let FormulaEditor = class FormulaEditor extends LitElement {
13
- /**
14
- * Formula Parser
15
- */
16
- _parser;
17
- recommendations = [];
18
- currentCursorPosition = 0;
19
- /**
20
- * user input event type
21
- */
22
- lastInputType = "";
23
- _selectedRecommendation = "";
24
- isFocused = false;
25
- /**
26
- * Text area input value
27
- */
28
- formulaString = "";
29
- placeholder = "Type your formula...";
30
- recommendationLabels = new Map();
31
- label = "";
32
- variables = new Map();
33
- variableType = "";
34
- minSuggestionLen = 2;
35
- errorString = "";
36
- formulaRegex = /.*/;
37
- allowedNumbers = true;
38
- allowedOperators = new Set();
39
- editor;
40
- suggestionMenu;
13
+ constructor() {
14
+ super(...arguments);
15
+ this.recommendations = [];
16
+ this.currentCursorPosition = 0;
17
+ /**
18
+ * user input event type
19
+ */
20
+ this.lastInputType = "";
21
+ this._selectedRecommendation = "";
22
+ this.isFocused = false;
23
+ /**
24
+ * Text area input value
25
+ */
26
+ this.formulaString = "";
27
+ this.placeholder = "Type your formula...";
28
+ this.recommendationLabels = new Map();
29
+ this.label = "";
30
+ this.variables = new Map();
31
+ this.variableType = "";
32
+ this.minSuggestionLen = 2;
33
+ this.errorString = "";
34
+ this.formulaRegex = /.*/;
35
+ this.allowedNumbers = true;
36
+ this.allowedOperators = new Set();
37
+ }
41
38
  updated(_changedProperties) {
42
39
  if (_changedProperties.has("formulaString")) {
43
40
  if (!this.formulaString?.trim()) {
@@ -8,11 +8,13 @@ import { html, LitElement } from "lit";
8
8
  import { customElement, property, query, state } from "lit/decorators.js";
9
9
  import { SuggestionMenuStyles } from "./styles/suggestion-menu";
10
10
  let SuggestionMenu = class SuggestionMenu extends LitElement {
11
- recommendations = [];
12
- recommendationLabels = new Map();
13
- onRecommendationClick = () => { };
14
- _currentFocusedIndex = -1;
15
- suggestionList;
11
+ constructor() {
12
+ super(...arguments);
13
+ this.recommendations = [];
14
+ this.recommendationLabels = new Map();
15
+ this.onRecommendationClick = () => { };
16
+ this._currentFocusedIndex = -1;
17
+ }
16
18
  scrollToSelectedRecommendation(index) {
17
19
  const listItem = this.suggestionList?.querySelectorAll("li")[index];
18
20
  if (!listItem)
@@ -6,12 +6,9 @@ export var Expectation;
6
6
  })(Expectation || (Expectation = {}));
7
7
  export class Formula {
8
8
  constructor(name, formulaString, precision = -1) {
9
+ this.error = null;
9
10
  this.name = name || "";
10
11
  this.formulaString = formulaString || "";
11
12
  this.precision = precision;
12
13
  }
13
- name;
14
- formulaString;
15
- precision;
16
- error = null;
17
14
  }
@@ -6,12 +6,6 @@ import { Stack } from "./stack.js";
6
6
  import Big from "big.js";
7
7
  import { Expectation } from "../types";
8
8
  export class Parser {
9
- _recommender;
10
- variables;
11
- formulaRegex;
12
- allowedNumbers;
13
- allowedOperators;
14
- variableType;
15
9
  constructor(variables, minSuggestionLen, formulaRegex = /[A-Za-z0-9_#@.]+|[-+(),*^/\s]/g, allowedNumbers = true, allowedOperators = mathematicalOperators, variableType = "") {
16
10
  this.variables = variables;
17
11
  this.formulaRegex = formulaRegex;
@@ -1,7 +1,9 @@
1
1
  export class Queue {
2
- _elements = {};
3
- _head = 0;
4
- _tail = 0;
2
+ constructor() {
3
+ this._elements = {};
4
+ this._head = 0;
5
+ this._tail = 0;
6
+ }
5
7
  enqueue(item) {
6
8
  this._elements[this._tail] = item;
7
9
  this._tail++;
@@ -1,7 +1,5 @@
1
1
  import { matchSorter } from "match-sorter";
2
2
  export class Recommender {
3
- _wordLimitForSuggestions;
4
- variableList;
5
3
  constructor(variables, minSuggestionLen) {
6
4
  this._wordLimitForSuggestions = minSuggestionLen > 0 ? minSuggestionLen : 1;
7
5
  this.variableList = variables;
@@ -1,5 +1,7 @@
1
1
  export class Stack {
2
- _elements = [];
2
+ constructor() {
3
+ this._elements = [];
4
+ }
3
5
  push(item) {
4
6
  this._elements.push(item);
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fw-components/formula-editor",
3
- "version": "2.3.4-linting.0",
3
+ "version": "2.3.4-linting.1",
4
4
  "description": "A WYSIWYG type formula editor",
5
5
  "main": "dist/formula-editor/src/formula-editor.js",
6
6
  "exports": {
@@ -21,13 +21,13 @@
21
21
  "@fw-components/styles": "^2.3.4-linting.0",
22
22
  "big.js": "^7.0.1",
23
23
  "lit": "^3.3.1",
24
- "match-sorter": "^8.1.0",
25
- "typescript": "^5.9.3"
24
+ "match-sorter": "^8.1.0"
26
25
  },
27
26
  "author": "The Fundwave Authors",
28
27
  "license": "ISC",
29
28
  "devDependencies": {
30
- "@types/big.js": "^6.2.2"
29
+ "@types/big.js": "^6.2.2",
30
+ "typescript": "^5.9.3"
31
31
  },
32
- "gitHead": "d3ffaee5f92e119b0a93114e1753021065271a67"
32
+ "gitHead": "7b4b36d9df7ba5ef69cb0fa7944aa2d07a6f6994"
33
33
  }