From 2051a2a7d6c863d5df0905a9caba4f0b8876b63a Mon Sep 17 00:00:00 2001 From: frostime Date: Tue, 28 Nov 2023 21:49:25 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test:=20setting=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 10 +- src/libs/index.d.ts | 8 +- src/libs/setting-panel.svelte | 6 +- src/libs/setting-utils.ts | 4 +- src/setting-example.svelte | 190 +++++++++++++++++----------------- 5 files changed, 107 insertions(+), 111 deletions(-) diff --git a/src/index.ts b/src/index.ts index 349aca6..14ba467 100644 --- a/src/index.ts +++ b/src/index.ts @@ -172,11 +172,9 @@ export default class PluginSample extends Plugin { type: "select", title: "Readonly text", description: "Select description", - select: { - options: { - 1: "Option 1", - 2: "Option 2" - } + options: { + 1: "Option 1", + 2: "Option 2" } }); this.settingUtils.addItem({ @@ -256,7 +254,7 @@ export default class PluginSample extends Plugin { openDIYSetting(): void { let dialog = new Dialog({ title: "SettingPannel", - content: `
`, + content: `
`, width: "600px", destroyCallback: (options) => { console.log("destroyCallback", options); diff --git a/src/libs/index.d.ts b/src/libs/index.d.ts index 379d841..7b0e81a 100644 --- a/src/libs/index.d.ts +++ b/src/libs/index.d.ts @@ -5,17 +5,13 @@ interface ISettingItem { type: TSettingItemType; title: string; description?: string; - text?: { - placeholder?: string; - }; + placeholder?: string; slider?: { min: number; max: number; step: number; }; - select?: { - options: { [key: string | number]: string }; - }; + options?: { [key: string | number]: string }; button?: { label: string; callback: () => void; diff --git a/src/libs/setting-panel.svelte b/src/libs/setting-panel.svelte index f630c3a..fc5e508 100644 --- a/src/libs/setting-panel.svelte +++ b/src/libs/setting-panel.svelte @@ -3,7 +3,7 @@ Author : frostime Date : 2023-07-01 19:23:50 FilePath : /src/libs/setting-panel.svelte - LastEditTime : 2023-11-28 21:23:56 + LastEditTime : 2023-11-28 21:45:10 Description : --> - - -
-
-
-

This setting panel is provided by a svelte component

-
- - See: -
/lib/setting-pannel.svelte
-
+
+
    + {#each groups as group} +
  • { + focusGroup = group; + }} + on:keydown={() => {}} + > + {group} +
  • + {/each} +
+
+ +
+ 💡 This is our default settings.
-
+
- { - showMessage( - `Checkbox changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> - { - showMessage( - `Input changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> - { - showMessage("Button clicked"); - }} - /> - { - showMessage( - `Select changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> - { - showMessage( - `Slide changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - />
+ + +