-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
2,411 additions
and
1,618 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"time": 1716954165673, | ||
"version": "2024.5.29.11" | ||
"time": 1716963368552, | ||
"version": "2024.5.29.14" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 35 additions & 28 deletions
63
packages/CSDN优化/src/setting/common-components/ui-button.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,42 @@ | ||
/** | ||
* 获取button按钮配置 | ||
* @param text 左边的文字 | ||
* @param description 左边的文字下面的描述 | ||
* @param buttonText 按钮的文字 | ||
* @param buttonIcon 按钮图标 | ||
* @param buttonIsRightIcon 按钮是否在右边 | ||
* @param buttonIconIsLoading 按钮图标是否旋转 | ||
* @param buttonType 按钮类型 | ||
* @param clickCallBack 点击回调 | ||
* @returns | ||
*/ | ||
const UIButton = function ( | ||
text: string, | ||
description: string | undefined, | ||
buttonText: string, | ||
buttonIcon: PopsIcon | undefined, | ||
buttonIsRightIcon: boolean | undefined, | ||
buttonIconIsLoading: boolean | undefined, | ||
buttonType: PopsButtonStyleType, | ||
clickCallBack?: ((event: MouseEvent | PointerEvent) => void) | undefined, | ||
text: string, | ||
description: string | undefined, | ||
buttonText: string | (() => string), | ||
buttonIcon: PopsIcon | undefined, | ||
buttonIsRightIcon: boolean | undefined, | ||
buttonIconIsLoading: boolean | undefined, | ||
buttonType: PopsButtonStyleType, | ||
clickCallBack?: ((event: MouseEvent | PointerEvent) => void) | undefined | ||
): PopsPanelButtonDetails { | ||
let result: PopsPanelButtonDetails = { | ||
text: text, | ||
type: "button", | ||
description: description, | ||
buttonIcon: buttonIcon, | ||
buttonIsRightIcon: buttonIsRightIcon, | ||
buttonIconIsLoading: buttonIconIsLoading, | ||
buttonType: buttonType, | ||
buttonText: buttonText, | ||
callback(event: MouseEvent | PointerEvent) { | ||
if (typeof clickCallBack === "function") { | ||
clickCallBack(event); | ||
} | ||
}, | ||
afterAddToUListCallBack: void 0, | ||
}; | ||
return result; | ||
let result: PopsPanelButtonDetails = { | ||
text: text, | ||
type: "button", | ||
description: description, | ||
buttonIcon: buttonIcon, | ||
buttonIsRightIcon: buttonIsRightIcon, | ||
buttonIconIsLoading: buttonIconIsLoading, | ||
buttonType: buttonType, | ||
buttonText: buttonText, | ||
callback(event: MouseEvent | PointerEvent) { | ||
if (typeof clickCallBack === "function") { | ||
clickCallBack(event); | ||
} | ||
}, | ||
afterAddToUListCallBack: void 0, | ||
}; | ||
return result; | ||
}; | ||
|
||
export { | ||
UIButton | ||
} | ||
export { UIButton }; |
95 changes: 50 additions & 45 deletions
95
packages/CSDN优化/src/setting/common-components/ui-input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,60 @@ | ||
import { PopsPanel } from "@/setting/setting"; | ||
import { ATTRIBUTE_DEFAULT_VALUE, ATTRIBUTE_KEY } from "../config"; | ||
|
||
|
||
/** | ||
* 获取输入框配置 | ||
* @param {string} text 文字 | ||
* @param {string|undefined} description 描述 | ||
* @param {string} [placeholder=""] 提示 | ||
* @param {string} key 键 | ||
* @param {boolean} defaultValue 默认值 | ||
* @param {?(event:Event,value: string)=>boolean} changeCallBack 输入回调 | ||
* @returns {PopsPanelInputDetails} | ||
* @param text 左边的文字 | ||
* @param key 键 | ||
* @param defaultValue 默认值 | ||
* @param description 左边的文字下面的描述 | ||
* @param changeCallBack 输入框内容改变时的回调 | ||
* @param placeholder 输入框的默认提示内容 | ||
* @param isNumber 是否是数字框 | ||
* @param isPassword 是否是密码框 | ||
* @returns | ||
*/ | ||
const UIInput = function ( | ||
text: string, | ||
key: string, | ||
defaultValue: string, | ||
description?: string | undefined, | ||
changeCallBack?: ((event: InputEvent, value: string, valueAsNumber?: number | undefined) => void | boolean) | undefined, | ||
placeholder = "", | ||
isNumber?: boolean, | ||
isPassword?: boolean, | ||
text: string, | ||
key: string, | ||
defaultValue: string, | ||
description?: string | undefined, | ||
changeCallBack?: | ||
| (( | ||
event: InputEvent, | ||
value: string, | ||
valueAsNumber?: number | undefined | ||
) => void | boolean) | ||
| undefined, | ||
placeholder = "", | ||
isNumber?: boolean, | ||
isPassword?: boolean | ||
) { | ||
let result: PopsPanelInputDetails = { | ||
text: text, | ||
type: "input", | ||
isNumber: Boolean(isNumber), | ||
isPassword: Boolean(isPassword), | ||
attributes: {} as { [key: string]: any }, | ||
description: description, | ||
getValue() { | ||
let localValue = PopsPanel.getValue(key, defaultValue); | ||
return localValue; | ||
}, | ||
callback(event, value) { | ||
if (typeof changeCallBack === "function") { | ||
if (changeCallBack(event, value)) { | ||
return; | ||
} | ||
} | ||
PopsPanel.setValue(key, value); | ||
}, | ||
placeholder: placeholder, | ||
}; | ||
if (result.attributes) { | ||
result.attributes[ATTRIBUTE_KEY] = key; | ||
result.attributes[ATTRIBUTE_DEFAULT_VALUE] = Boolean(defaultValue); | ||
} | ||
return result; | ||
let result: PopsPanelInputDetails = { | ||
text: text, | ||
type: "input", | ||
isNumber: Boolean(isNumber), | ||
isPassword: Boolean(isPassword), | ||
attributes: {} as { [key: string]: any }, | ||
description: description, | ||
getValue() { | ||
let localValue = PopsPanel.getValue(key, defaultValue); | ||
return localValue; | ||
}, | ||
callback(event, value) { | ||
if (typeof changeCallBack === "function") { | ||
if (changeCallBack(event, value)) { | ||
return; | ||
} | ||
} | ||
PopsPanel.setValue(key, value); | ||
}, | ||
placeholder: placeholder, | ||
}; | ||
if (result.attributes) { | ||
result.attributes[ATTRIBUTE_KEY] = key; | ||
result.attributes[ATTRIBUTE_DEFAULT_VALUE] = defaultValue; | ||
} | ||
return result; | ||
}; | ||
|
||
export { | ||
UIInput | ||
} | ||
export { UIInput }; |
113 changes: 63 additions & 50 deletions
113
packages/CSDN优化/src/setting/common-components/ui-select.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,69 @@ | ||
import { PopsPanel } from "@/setting/setting"; | ||
import { ATTRIBUTE_DEFAULT_VALUE, ATTRIBUTE_KEY } from "../config"; | ||
|
||
/** | ||
* 下拉列表 | ||
* @param text 左边的文字 | ||
* @param key 键 | ||
* @param defaultValue 默认值 | ||
* @param data 下拉列表的数据 | ||
* @param callback 选择列表的某一项的回调 | ||
* @param description 左边的文字下面的描述 | ||
* @returns | ||
*/ | ||
const UISelect = function <T extends any>( | ||
text: string, | ||
key: string, | ||
defaultValue: T, | ||
data: ({ | ||
value: T; | ||
text: string; | ||
disable?(value: T): boolean; | ||
}[]) | (() => { | ||
value: T; | ||
text: string; | ||
disable?(value: T): boolean; | ||
}[]), | ||
callback?: (event: PointerEvent | TouchEvent, isSelectedValue: T, isSelectedText: string) => void, | ||
description?: string, | ||
text: string, | ||
key: string, | ||
defaultValue: T, | ||
data: | ||
| { | ||
value: T; | ||
text: string; | ||
disable?(value: T): boolean; | ||
}[] | ||
| (() => { | ||
value: T; | ||
text: string; | ||
disable?(value: T): boolean; | ||
}[]), | ||
callback?: ( | ||
event: PointerEvent | TouchEvent, | ||
isSelectedValue: T, | ||
isSelectedText: string | ||
) => void, | ||
description?: string | ||
): PopsPanelSelectDetails<T> { | ||
let selectData: { | ||
value: T; | ||
text: string; | ||
disable?(value: T): boolean; | ||
}[] = []; | ||
if (typeof data === "function") { | ||
selectData = data(); | ||
} else { | ||
selectData = data; | ||
} | ||
let result: PopsPanelSelectDetails<T> = { | ||
text: text, | ||
type: "select", | ||
description: description, | ||
attributes: {} as { [key: string]: any }, | ||
getValue() { | ||
return PopsPanel.getValue(key, defaultValue); | ||
}, | ||
callback(event, isSelectedValue, isSelectedText) { | ||
PopsPanel.setValue(key, isSelectedValue); | ||
if (typeof callback === "function") { | ||
callback(event, isSelectedValue, isSelectedText); | ||
} | ||
}, | ||
data: selectData, | ||
} | ||
if (result.attributes) { | ||
result.attributes[ATTRIBUTE_KEY] = key; | ||
result.attributes[ATTRIBUTE_DEFAULT_VALUE] = | ||
Boolean(defaultValue); | ||
} | ||
return result | ||
} | ||
let selectData: { | ||
value: T; | ||
text: string; | ||
disable?(value: T): boolean; | ||
}[] = []; | ||
if (typeof data === "function") { | ||
selectData = data(); | ||
} else { | ||
selectData = data; | ||
} | ||
let result: PopsPanelSelectDetails<T> = { | ||
text: text, | ||
type: "select", | ||
description: description, | ||
attributes: {} as { [key: string]: any }, | ||
getValue() { | ||
return PopsPanel.getValue(key, defaultValue); | ||
}, | ||
callback(event, isSelectedValue, isSelectedText) { | ||
PopsPanel.setValue(key, isSelectedValue); | ||
if (typeof callback === "function") { | ||
callback(event, isSelectedValue, isSelectedText); | ||
} | ||
}, | ||
data: selectData, | ||
}; | ||
if (result.attributes) { | ||
result.attributes[ATTRIBUTE_KEY] = key; | ||
result.attributes[ATTRIBUTE_DEFAULT_VALUE] = defaultValue; | ||
} | ||
return result; | ||
}; | ||
|
||
export { | ||
UISelect | ||
} | ||
export { UISelect }; |
Oops, something went wrong.