File tree Expand file tree Collapse file tree 2 files changed +29
-11
lines changed
Expand file tree Collapse file tree 2 files changed +29
-11
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2024 by frostime. All Rights Reserved.
3+ * @Author : frostime
4+ * @Date : 2024-04-19 18:30:12
5+ * @FilePath : /src/libs/index.d.ts
6+ * @LastEditTime : 2024-04-30 15:53:15
7+ * @Description :
8+ */
19type TSettingItemType = "checkbox" | "select" | "textinput" | "textarea" | "number" | "slider" | "button" | "hint" ;
2- interface ISettingItem {
10+
11+ interface ISettingItemCore {
12+ type : TSettingItemType ;
313 key : string ;
414 value : any ;
5- type : TSettingItemType ;
6- title : string ;
7- description ?: string ;
815 placeholder ?: string ;
916 slider ?: {
1017 min : number ;
1118 max : number ;
1219 step : number ;
1320 } ;
1421 options ?: { [ key : string | number ] : string } ;
15- action ?: {
16- callback : ( ) => void ;
17- }
1822 button ?: {
1923 label : string ;
2024 callback : ( ) => void ;
2125 }
26+ }
27+
28+ interface ISettingItem extends ISettingItemCore {
29+ title : string ;
30+ description : string ;
31+ }
32+
33+
34+ //Interface for setting-utils
35+ interface ISettingUtilsItem extends ISettingItem {
36+ direction ?: "row" | "column" ;
37+ action ?: {
38+ callback : ( ) => void ;
39+ }
2240 createElement ?: ( currentVal : any ) => HTMLElement ;
2341}
Original file line number Diff line number Diff line change 33 * @Author : frostime
44 * @Date : 2023-12-17 18:28:19
55 * @FilePath : /src/libs/setting-utils.ts
6- * @LastEditTime : 2024-04-29 17:17:19
6+ * @LastEditTime : 2024-04-30 15:50:07
77 * @Description :
88 */
99
@@ -56,7 +56,7 @@ export class SettingUtils {
5656 name : string ;
5757 file : string ;
5858
59- settings : Map < string , ISettingItem > = new Map ( ) ;
59+ settings : Map < string , ISettingItemCore > = new Map ( ) ;
6060 elements : Map < string , HTMLElement > = new Map ( ) ;
6161
6262 constructor ( args : {
@@ -214,7 +214,7 @@ export class SettingUtils {
214214 return data ;
215215 }
216216
217- addItem ( item : ISettingItem ) {
217+ addItem ( item : ISettingUtilsItem ) {
218218 this . settings . set ( item . key , item ) ;
219219 if ( item . createElement === undefined ) {
220220 let itemElement = this . createDefaultElement ( item ) ;
@@ -242,7 +242,7 @@ export class SettingUtils {
242242 }
243243 }
244244
245- createDefaultElement ( item : ISettingItem ) {
245+ createDefaultElement ( item : ISettingUtilsItem ) {
246246 let itemElement : HTMLElement ;
247247 switch ( item . type ) {
248248 case 'checkbox' :
You can’t perform that action at this time.
0 commit comments