From c1b93270e79ad234f7832e8d27a47fd6c25fedc0 Mon Sep 17 00:00:00 2001 From: David Carley Date: Thu, 18 Aug 2022 20:30:53 +0000 Subject: [PATCH] New drop-menu for picking a standard bit size. --- .../src/components/DimensionInput.svelte | 91 ---------- .../components/TextFieldWithOptions.svelte | 90 ++++++++++ .../src/dialogs/ChangeHostnameDialog.svelte | 4 +- .../src/dialogs/ManualHomeAxisDialog.svelte | 4 +- .../src/dialogs/ProbeDialog.svelte | 160 +++++++++--------- .../src/dialogs/SetAxisPositionDialog.svelte | 4 +- .../src/dialogs/SetTimeDialog.svelte | 6 +- .../src/dialogs/WifiConnectionDialog.svelte | 4 +- .../src/lib/CustomActions.ts | 9 + src/svelte-components/src/lib/RegexHelpers.ts | 90 ++++++++++ .../src/lib/customActions.ts | 4 - src/svelte-components/vite.config.ts | 1 - 12 files changed, 278 insertions(+), 189 deletions(-) delete mode 100644 src/svelte-components/src/components/DimensionInput.svelte create mode 100644 src/svelte-components/src/components/TextFieldWithOptions.svelte create mode 100644 src/svelte-components/src/lib/CustomActions.ts create mode 100644 src/svelte-components/src/lib/RegexHelpers.ts delete mode 100644 src/svelte-components/src/lib/customActions.ts diff --git a/src/svelte-components/src/components/DimensionInput.svelte b/src/svelte-components/src/components/DimensionInput.svelte deleted file mode 100644 index bec8141..0000000 --- a/src/svelte-components/src/components/DimensionInput.svelte +++ /dev/null @@ -1,91 +0,0 @@ - - -
-
- menu.setOpen(true)} - /> - -
- - - {#each options as option} - onOptionSelected(option)}> - {option.label} - - {/each} - - -
- - \ No newline at end of file diff --git a/src/svelte-components/src/components/TextFieldWithOptions.svelte b/src/svelte-components/src/components/TextFieldWithOptions.svelte new file mode 100644 index 0000000..d1d487a --- /dev/null +++ b/src/svelte-components/src/components/TextFieldWithOptions.svelte @@ -0,0 +1,90 @@ + + +
+ showMenu(true)} + on:focusout={() => showMenu(false)} + use={[[virtualKeyboardChange, (newValue) => (value = newValue)]]} + {...$$restProps} + > +
+ {#if valid} + + {/if} +
+ {helperText} +
+ + +
+ {#each options as group} + + {#each group as option} + { + value = option; + showMenu(false); + + optionSelected = true; + }} + > + {option} + + {/each} + + {/each} +
+
+
+ + diff --git a/src/svelte-components/src/dialogs/ChangeHostnameDialog.svelte b/src/svelte-components/src/dialogs/ChangeHostnameDialog.svelte index c8463a3..c04a40c 100644 --- a/src/svelte-components/src/dialogs/ChangeHostnameDialog.svelte +++ b/src/svelte-components/src/dialogs/ChangeHostnameDialog.svelte @@ -4,7 +4,7 @@ import TextField from "@smui/textfield"; import MessageDialog from "$dialogs/MessageDialog.svelte"; import * as api from "$lib/api"; - import { virtualKeyboardChangeHelper } from "$lib/customActions"; + import { virtualKeyboardChange } from "$lib/CustomActions"; // https://man7.org/linux/man-pages/man7/hostname.7.html // @@ -73,7 +73,7 @@ (hostname = newValue)]]} + use={[[virtualKeyboardChange, (newValue) => (hostname = newValue)]]} label="New Hostname" spellcheck="false" variant="filled" diff --git a/src/svelte-components/src/dialogs/ManualHomeAxisDialog.svelte b/src/svelte-components/src/dialogs/ManualHomeAxisDialog.svelte index 14c4135..b008e83 100644 --- a/src/svelte-components/src/dialogs/ManualHomeAxisDialog.svelte +++ b/src/svelte-components/src/dialogs/ManualHomeAxisDialog.svelte @@ -3,7 +3,7 @@ import TextField from "@smui/textfield"; import Button, { Label } from "@smui/button"; import { ControllerMethods } from "$lib/RegisterControllerMethods"; - import { virtualKeyboardChangeHelper } from "$lib/customActions"; + import { virtualKeyboardChange } from "$lib/CustomActions"; export let open: boolean; export let axis = ""; @@ -31,7 +31,7 @@ label="Absolute" type="number" bind:value - use={[[virtualKeyboardChangeHelper, (newValue) => (value = newValue)]]} + use={[[virtualKeyboardChange, (newValue) => (value = newValue)]]} variant="filled" style="width: 100%;" /> diff --git a/src/svelte-components/src/dialogs/ProbeDialog.svelte b/src/svelte-components/src/dialogs/ProbeDialog.svelte index cc76844..6559b08 100644 --- a/src/svelte-components/src/dialogs/ProbeDialog.svelte +++ b/src/svelte-components/src/dialogs/ProbeDialog.svelte @@ -1,5 +1,4 @@