@fw-components/formula-editor 2.0.7-formula-editor.28 → 2.0.7-formula-editor.29
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.
|
@@ -34,11 +34,11 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
34
34
|
}
|
|
35
35
|
this._adjustTextAreaHeight();
|
|
36
36
|
}
|
|
37
|
-
if (_changedProperties.has("variables")
|
|
37
|
+
if (_changedProperties.has("variables")) {
|
|
38
38
|
this._parser = new Parser(this.variables, this.minSuggestionLen);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
onRecommendationClick(recommendation) {
|
|
42
42
|
this.parseInput(recommendation);
|
|
43
43
|
}
|
|
44
44
|
handleContentUpdate(event) {
|
|
@@ -104,7 +104,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
104
104
|
if (event.code === "Tab") {
|
|
105
105
|
event.preventDefault();
|
|
106
106
|
if (this.recommendations?.length === 1) {
|
|
107
|
-
this.suggestionMenu.
|
|
107
|
+
this.suggestionMenu.handleRecommendationSelect();
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
const direction = event.shiftKey ? "up" : "down";
|
|
@@ -118,7 +118,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
118
118
|
}
|
|
119
119
|
else if (event.code === "Enter") {
|
|
120
120
|
event.preventDefault();
|
|
121
|
-
this.suggestionMenu.
|
|
121
|
+
this.suggestionMenu.handleRecommendationSelect();
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
render() {
|
|
@@ -144,7 +144,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
144
144
|
? html `<suggestion-menu
|
|
145
145
|
.recommendations=${this.recommendations}
|
|
146
146
|
.currentSelection=${this._selectedRecommendation}
|
|
147
|
-
.
|
|
147
|
+
.onRecommendationClick=${this.onRecommendationClick.bind(this)}
|
|
148
148
|
></suggestion-menu>`
|
|
149
149
|
: ''}
|
|
150
150
|
`;
|
|
@@ -11,7 +11,7 @@ let SuggestionMenu = class SuggestionMenu extends LitElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.recommendations = [];
|
|
14
|
-
this.
|
|
14
|
+
this.onRecommendationClick = () => { };
|
|
15
15
|
this._selectedRecommendationIndex = -1;
|
|
16
16
|
}
|
|
17
17
|
scrollToSelectedRecommendation(index) {
|
|
@@ -35,11 +35,11 @@ let SuggestionMenu = class SuggestionMenu extends LitElement {
|
|
|
35
35
|
this._selectedRecommendationIndex = newIndex;
|
|
36
36
|
this.scrollToSelectedRecommendation(newIndex);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
handleRecommendationSelect(index = this._selectedRecommendationIndex) {
|
|
39
39
|
const recommendation = this.recommendations[index];
|
|
40
40
|
if (!recommendation)
|
|
41
41
|
return;
|
|
42
|
-
this.
|
|
42
|
+
this.onRecommendationClick(recommendation);
|
|
43
43
|
this._selectedRecommendationIndex = -1;
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
@@ -48,7 +48,7 @@ let SuggestionMenu = class SuggestionMenu extends LitElement {
|
|
|
48
48
|
<ul class="wysiwyg-suggestion-menu" @mousedown=${(e) => e.preventDefault()}>
|
|
49
49
|
${this.recommendations.map((recommendation, index) => html `<li
|
|
50
50
|
class="${this._selectedRecommendationIndex === index ? "selected" : ""}"
|
|
51
|
-
@click=${(e) => this.
|
|
51
|
+
@click=${(e) => this.handleRecommendationSelect(index)}
|
|
52
52
|
>${recommendation}</li>`)}
|
|
53
53
|
</ul>
|
|
54
54
|
`;
|
|
@@ -59,7 +59,7 @@ __decorate([
|
|
|
59
59
|
], SuggestionMenu.prototype, "recommendations", void 0);
|
|
60
60
|
__decorate([
|
|
61
61
|
property()
|
|
62
|
-
], SuggestionMenu.prototype, "
|
|
62
|
+
], SuggestionMenu.prototype, "onRecommendationClick", void 0);
|
|
63
63
|
__decorate([
|
|
64
64
|
state()
|
|
65
65
|
], SuggestionMenu.prototype, "_selectedRecommendationIndex", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.0.7-formula-editor.
|
|
3
|
+
"version": "2.0.7-formula-editor.29",
|
|
4
4
|
"description": "A WYSIWYG type formula editor",
|
|
5
5
|
"main": "dist/formula-editor/src/formula-editor.js",
|
|
6
6
|
"exports": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"@types/big.js": "^6.1.6",
|
|
32
32
|
"es-dev-server": "^2.1.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "75ad0a4f9846f3b4d68bd1ce6b5ae0488afe3b1d"
|
|
35
35
|
}
|