@fw-components/formula-editor 2.0.7-formula-editor.15 → 2.0.7-formula-editor.17

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.
@@ -29,6 +29,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
29
29
  this.currentCursorPosition = null;
30
30
  this.currentCursorRect = undefined;
31
31
  this.lastInputType = "undef";
32
+ this.isFocus = false;
32
33
  this.content = "";
33
34
  this.placeholder = "Type your formula...";
34
35
  this.variables = new Map();
@@ -181,10 +182,12 @@ let FormulaEditor = class FormulaEditor extends LitElement {
181
182
  }
182
183
  }
183
184
  handleFocusOut(e) {
185
+ this.isFocus = false;
184
186
  this._recommendations = null;
185
187
  this.requestUpdate();
186
188
  }
187
189
  handleFocus(e) {
190
+ this.isFocus = true;
188
191
  if (!this.content.trim()) {
189
192
  this._recommendations = Array.from(this.variables.keys());
190
193
  }
@@ -212,7 +215,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
212
215
  @blur=${this.handleFocusOut}
213
216
  @focus=${this.handleFocus}
214
217
  ></div>
215
- ${this._recommendations
218
+ ${this._recommendations && this.isFocus
216
219
  ? html ` <suggestion-menu
217
220
  .recommendations=${this._recommendations}
218
221
  .currentSelection=${this._selectedRecommendation}
@@ -245,6 +248,9 @@ __decorate([
245
248
  __decorate([
246
249
  state()
247
250
  ], FormulaEditor.prototype, "_selectedRecommendation", void 0);
251
+ __decorate([
252
+ state()
253
+ ], FormulaEditor.prototype, "isFocus", void 0);
248
254
  __decorate([
249
255
  property()
250
256
  ], FormulaEditor.prototype, "content", void 0);
@@ -9,8 +9,8 @@ export var Operator;
9
9
  export class Formula {
10
10
  constructor(name, formulaString, precision = -1) {
11
11
  this.error = null;
12
- this.name = name;
13
- this.formulaString = formulaString;
12
+ this.name = name || "";
13
+ this.formulaString = formulaString || "";
14
14
  this.precision = precision;
15
15
  }
16
16
  }
@@ -3,8 +3,8 @@ export const FormulaEditorStyles = css `
3
3
 
4
4
  .formula-editor-label {
5
5
  display: block;
6
- font-size: var(--fe-label-font-size, 0.9rem);
7
- color: var(--fe-label-color, #343434);
6
+ font-size: var(--fe-label-font-size, 0.8rem);
7
+ color: var(--fe-label-color, #515151);
8
8
  margin-bottom: var(--fe-label-margin-bottom, 1px);
9
9
  }
10
10
 
@@ -19,6 +19,7 @@ export const FormulaEditorStyles = css `
19
19
  border-radius: var(--fe-border-radius, 4px);
20
20
  overflow: auto;
21
21
  border: var(--fe-border, 2px solid black);
22
+ border-bottom: var(--fe-border-bottom, 0px solid black);
22
23
  outline: 0px solid black;
23
24
  white-space: pre-wrap;
24
25
  background-color: var(--fe-background-color, #222222);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fw-components/formula-editor",
3
- "version": "2.0.7-formula-editor.15",
3
+ "version": "2.0.7-formula-editor.17",
4
4
  "description": "A WYSIWYG type formula editor",
5
5
  "main": "dist/formula-editor/src/formula-builder.js",
6
6
  "publishConfig": {
@@ -25,5 +25,5 @@
25
25
  "@types/big.js": "^6.1.6",
26
26
  "es-dev-server": "^2.1.0"
27
27
  },
28
- "gitHead": "c544f7013f65838c0ce25819898c444386fa5602"
28
+ "gitHead": "0585773ac6796039ec5e59c265c2347994efae3a"
29
29
  }