@fw-components/formula-editor 2.0.7-formula-editor.9 → 2.0.7-formula-editor.11

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.
@@ -177,11 +177,22 @@ let FormulaEditor = class FormulaEditor extends LitElement {
177
177
  }
178
178
  }
179
179
  }
180
+ handleFocusOut(e) {
181
+ this._recommendations = null;
182
+ this.requestUpdate();
183
+ }
180
184
  render() {
181
185
  return html `
182
186
  <style>
183
187
  ${FormulaEditorStyles}
184
188
  </style>
189
+
190
+ ${this.label
191
+ ? html `<label for="wysiwyg-editor" class="formula-editor-label">
192
+ ${this.label}
193
+ </label>`
194
+ : ""}
195
+
185
196
  <div
186
197
  contenteditable
187
198
  placeholder=${this.placeholder}
@@ -190,12 +201,14 @@ let FormulaEditor = class FormulaEditor extends LitElement {
190
201
  autocomplete="off"
191
202
  @input=${this.handleChange}
192
203
  @keydown=${this.handleKeyboardEvents}
204
+ @blur=${this.handleFocusOut}
193
205
  ></div>
194
206
  ${this._recommendations
195
207
  ? html ` <suggestion-menu
196
208
  .recommendations=${this._recommendations}
197
209
  .currentSelection=${this._selectedRecommendation}
198
210
  .onClickRecommendation=${(e) => this.onClickRecommendation(e)}
211
+ @mousedown=${(e) => e.preventDefault()}
199
212
  ></suggestion-menu>`
200
213
  : html ``}
201
214
  <p>${this._calculatedResult}</p>
@@ -229,6 +242,9 @@ __decorate([
229
242
  __decorate([
230
243
  property()
231
244
  ], FormulaEditor.prototype, "placeholder", void 0);
245
+ __decorate([
246
+ property()
247
+ ], FormulaEditor.prototype, "label", void 0);
232
248
  __decorate([
233
249
  property({
234
250
  type: (Map),
@@ -1,5 +1,13 @@
1
1
  import { css } from "lit";
2
2
  export const FormulaEditorStyles = css `
3
+
4
+ .formula-editor-label {
5
+ display: block;
6
+ font-size: var(--fe-label-font-size, 0.9rem);
7
+ color: var(--fe-label-color, #343434);
8
+ margin-bottom: var(--fe-label-margin-bottom, 1px);
9
+ }
10
+
3
11
  #wysiwyg-editor {
4
12
  display: inline-block;
5
13
  padding: var(--fe-padding, 4px);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fw-components/formula-editor",
3
- "version": "2.0.7-formula-editor.9",
3
+ "version": "2.0.7-formula-editor.11",
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": "8ec9bb1e89c289c5334db8f99d1a359c731a4375"
28
+ "gitHead": "8f3f50748f055ca017d8ff6f5ac946b8949825e5"
29
29
  }