mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
support onDebounceSave
This commit is contained in:
parent
f31aa86542
commit
c1d4192d6e
@ -13,10 +13,10 @@ import getSettingsList from "schemas/settings"
|
|||||||
import menuGroupsDecorators from "schemas/settingsMenuGroupsDecorators"
|
import menuGroupsDecorators from "schemas/settingsMenuGroupsDecorators"
|
||||||
import groupsDecorators from "schemas/settingsGroupsDecorators"
|
import groupsDecorators from "schemas/settingsGroupsDecorators"
|
||||||
|
|
||||||
const SettingsList = await getSettingsList()
|
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
|
const SettingsList = await getSettingsList()
|
||||||
|
|
||||||
const extraMenuItems = [
|
const extraMenuItems = [
|
||||||
{
|
{
|
||||||
id: "donate",
|
id: "donate",
|
||||||
@ -72,6 +72,7 @@ const SettingItem = (props) => {
|
|||||||
const [value, setValue] = React.useState(null)
|
const [value, setValue] = React.useState(null)
|
||||||
const [delayedValue, setDelayedValue] = React.useState(null)
|
const [delayedValue, setDelayedValue] = React.useState(null)
|
||||||
const [disabled, setDisabled] = React.useState(false)
|
const [disabled, setDisabled] = React.useState(false)
|
||||||
|
const componentRef = React.useRef(null)
|
||||||
|
|
||||||
let SettingComponent = item.component
|
let SettingComponent = item.component
|
||||||
|
|
||||||
@ -137,6 +138,12 @@ const SettingItem = (props) => {
|
|||||||
setDelayedValue(null)
|
setDelayedValue(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (componentRef.current) {
|
||||||
|
if (typeof componentRef.current.onDebounceSave === "function") {
|
||||||
|
await componentRef.current.onDebounceSave(updateValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setValue(updateValue)
|
setValue(updateValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +351,8 @@ const SettingItem = (props) => {
|
|||||||
? <div> Loading... </div>
|
? <div> Loading... </div>
|
||||||
: React.createElement(SettingComponent, {
|
: React.createElement(SettingComponent, {
|
||||||
...item.props,
|
...item.props,
|
||||||
ctx: elementsCtx
|
ctx: elementsCtx,
|
||||||
|
ref: componentRef,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user