@stubber/form-fields 1.4.2 → 1.4.4

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.
@@ -107,9 +107,7 @@
107
107
  e.preventDefault();
108
108
  }
109
109
  }}
110
- type="checkbox"
111
110
  id="input_{state_key}"
112
- placeholder={label}
113
111
  name={state_key}
114
112
  bind:checked={$internal.checked}
115
113
  />
@@ -14,7 +14,12 @@
14
14
  } from "@codemirror/view";
15
15
  import { EditorState, StateField } from "@codemirror/state";
16
16
  import { history, defaultKeymap, historyKeymap } from "@codemirror/commands";
17
- import { autocompletion } from "@codemirror/autocomplete";
17
+ import {
18
+ acceptCompletion,
19
+ autocompletion,
20
+ completionKeymap,
21
+ startCompletion,
22
+ } from "@codemirror/autocomplete";
18
23
 
19
24
  import { Input } from "@stubber/ui/input";
20
25
  import { Label } from "@stubber/ui/label";
@@ -212,6 +217,28 @@
212
217
 
213
218
  $: is_string = typeof $internal?.raw === "string";
214
219
 
220
+ const custom_completion_keymap = completionKeymap
221
+ .filter((binding) => binding.key != "Enter")
222
+ .concat([
223
+ {
224
+ key: "Enter",
225
+ run: () => {
226
+ return false;
227
+ },
228
+ },
229
+ {
230
+ key: "Tab",
231
+ run: acceptCompletion,
232
+ },
233
+ {
234
+ key: "Ctrl-Space",
235
+ run: (view) => {
236
+ startCompletion(view);
237
+ },
238
+ stopPropagation: true,
239
+ },
240
+ ]);
241
+
215
242
  $: {
216
243
  // check if internal.raw is not a string
217
244
  if (is_string) {
@@ -220,12 +247,12 @@
220
247
  history({ newGroupDelay: 150 }),
221
248
  EditorView.lineWrapping,
222
249
  contentField,
223
- autocompletion({ override: [myCompletions] }),
250
+ autocompletion({ override: [myCompletions], defaultKeymap: false }),
224
251
  placeholder(label),
225
252
  EditorView.contentAttributes.of({
226
253
  spellcheck: "true",
227
254
  }),
228
- keymap.of([...defaultKeymap, ...historyKeymap]),
255
+ keymap.of([...defaultKeymap, ...historyKeymap, ...custom_completion_keymap]),
229
256
  ];
230
257
 
231
258
  if (code_language === "handlebars") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stubber/form-fields",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "An automatic form builder based on field specifications",
5
5
  "keywords": [
6
6
  "components",
@@ -61,7 +61,7 @@
61
61
  "@codemirror/lang-javascript": "^6.2.4",
62
62
  "@codemirror/state": "^6.5.2",
63
63
  "@codemirror/view": "^6.38.4",
64
- "@stubber/ui": "^1.12.3",
64
+ "@stubber/ui": "^1.13.1",
65
65
  "ag-grid-community": "^31.0.2",
66
66
  "ag-grid-enterprise": "^31.0.2",
67
67
  "codemirror": "^6.0.2",