@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.
- package/dist/formula-editor.js +25 -28
- package/dist/suggestion-menu.js +7 -5
- package/dist/types/index.js +1 -4
- package/dist/utils/parser.js +0 -6
- package/dist/utils/queue.js +5 -3
- package/dist/utils/recommendor.js +0 -2
- package/dist/utils/stack.js +3 -1
- package/package.json +5 -5
package/dist/formula-editor.js
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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()) {
|
package/dist/suggestion-menu.js
CHANGED
|
@@ -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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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)
|
package/dist/types/index.js
CHANGED
|
@@ -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
|
}
|
package/dist/utils/parser.js
CHANGED
|
@@ -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;
|
package/dist/utils/queue.js
CHANGED
|
@@ -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;
|
package/dist/utils/stack.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.3.4-linting.
|
|
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": "
|
|
32
|
+
"gitHead": "7b4b36d9df7ba5ef69cb0fa7944aa2d07a6f6994"
|
|
33
33
|
}
|