Skip to content

Commit

Permalink
Merge branch 'beta' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangtaofeng committed Feb 18, 2024
2 parents 776da1e + 02fa4eb commit 95187d1
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 52 deletions.
6 changes: 3 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
<br>
<p align="center">
<a href="https://cloud.illacloud.com?utm_source=github&utm_medium=readme&utm_campaign=github-readme">
<img width="800" alt="GitHub - Readme - jp" src="https://github.com/illacloud/illa-builder/assets/112603073/bbeaaa07-f8e8-45ae-9aaf-6dde05b7926c">
<img width="800" alt="GitHub - Readme - jp" src="https://github.com/illacloud/illa-builder/assets/112603073/f3e7105a-b50d-461b-b3b7-a031c43d9465">
</a>
</p>


[![Discord](https://img.shields.io/badge/chat-Discord-7289DA?logo=discord)](https://discord.gg/illacloud)
[![Twitter](https://img.shields.io/badge/Twitter-1DA1F2?logo=x&logoColor=white)](https://twitter.com/illa_cloud)
[![Discussions](https://img.shields.io/badge/discussions-GitHub-333333?logo=github)](https://github.com/orgs/illacloud/discussions)
Expand Down Expand Up @@ -96,7 +95,8 @@ ILLA CLI 使您能够以超乎想象的速度部署 ILLA Builder。 [单击此

加入微信群:

![IMG_5405](https://github.com/illacloud/illa-builder/assets/112603073/9fd62305-13d0-487c-b9cd-ed7fb88d7448)
![IMG_5468](https://github.com/illacloud/illa-builder/assets/112603073/bbdc47f4-97bd-4258-bc89-893ce28cbe53)



Discord与Github社区入口
Expand Down
2 changes: 1 addition & 1 deletion README-DE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<br>
<p align="center">
<a href="https://cloud.illacloud.com?utm_source=github&utm_medium=readme&utm_campaign=github-readme">
<img width="800" alt="GitHub - Readme - jp" src="https://github.com/illacloud/illa-builder/assets/112603073/4c9b27c1-b3c4-4c55-99c4-4e3cb529d236">
<img width="800" alt="GitHub - Readme - jp" src="https://github.com/illacloud/illa-builder/assets/112603073/1a4b64ac-1384-4eaf-9b3c-9b0b278b40fe">
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion README-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<br>
<p align="center">
<a href="https://cloud.illacloud.com?utm_source=github&utm_medium=readme&utm_campaign=github-readme">
<img width="800" alt="GitHub - Readme - jp" src="https://github.com/illacloud/illa-builder/assets/112603073/797f4934-3bf2-4b91-8877-e370e5fda142">
<img width="800" alt="GitHub - Readme - jp" src="https://github.com/illacloud/illa-builder/assets/112603073/eeb65cb6-e307-4f16-9a7a-2fcb9d3a37a3">
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ English | <a href="https://github.com/illacloud/illa-builder/blob/beta/README-CN
<br>
<p align="center">
<a href="https://cloud.illacloud.com?utm_source=github&utm_medium=readme&utm_campaign=github-readme">
<img width="800" alt="Github(1)" src="https://github.com/illacloud/illa-builder/assets/112603073/37e2cc1b-efeb-4a95-9719-76022ac49191">
<img width="800" alt="Github(1)" src="https://github.com/illacloud/illa-builder/assets/112603073/fdc4c02b-e412-4c41-8240-8077d4447ebc">
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"author": "ILLA Cloud <[email protected]>",
"license": "Apache-2.0",
"version": "4.4.13",
"version": "4.5.2",
"scripts": {
"dev": "vite --strictPort --force",
"build-cloud": "NODE_OPTIONS=--max-old-space-size=12288 vite build --mode cloud",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const fixedLikeInputComponentDefaultValue = (
...component,
props: {
...component.props,
value: "",
value: undefined,
defaultValue: component.props?.defaultValue || "",
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const INPUT_WIDGET_CONFIG: WidgetConfig = {
resizeDirection: RESIZE_DIRECTION.HORIZONTAL,
version: 0,
defaults: {
value: "",
value: undefined,
defaultValue: "",
label: "Label",
labelAlign: "left",
Expand Down
64 changes: 43 additions & 21 deletions apps/builder/src/widgetLibrary/JsonEditorWidget/jsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,33 @@ export const JsonEditorWidget: FC<JsonEditorWidgetProps> = (props) => {
const cacheValue = useRef(value)

const debounceUpdateOnChange = useRef(
debounce((value: unknown) => {
if (typeof value === "string") {
handleUpdateMultiExecutionResult([
{
displayName,
value: {
value: value,
debounce(
(
value: unknown,
triggerEventHandler: JsonEditorWidgetProps["triggerEventHandler"],
) => {
if (typeof value === "string") {
handleUpdateMultiExecutionResult([
{
displayName,
value: {
value: value,
},
},
},
])
}
}, 180),
])
triggerEventHandler("change")
}
},
180,
),
)

const updateOnChange = useCallback((value: unknown) => {
debounceUpdateOnChange.current(value)
}, [])
const updateOnChange = useCallback(
(value: unknown) => {
debounceUpdateOnChange.current(value, triggerEventHandler)
},
[triggerEventHandler],
)

const handleOnFocus = useCallback(() => {
triggerEventHandler("focus")
Expand All @@ -49,22 +59,34 @@ export const JsonEditorWidget: FC<JsonEditorWidgetProps> = (props) => {
triggerEventHandler("blur")
}, [triggerEventHandler])

const handleOnChange = useCallback(() => {
triggerEventHandler("change")
}, [triggerEventHandler])

useEffect(() => {
if (cacheDefaultValue.current !== defaultValue) {
cacheDefaultValue.current = defaultValue
}
}, [defaultValue, handleOnChange])
}, [defaultValue])

useEffect(() => {
if (
cacheDefaultValue.current === defaultValue &&
cacheValue.current !== cacheDefaultValue.current
) {
handleUpdateMultiExecutionResult([
{
displayName,
value: {
value: defaultValue,
},
},
])
cacheValue.current = defaultValue
}
}, [defaultValue, displayName, handleUpdateMultiExecutionResult])

useEffect(() => {
if (cacheValue.current !== value) {
handleOnChange()
cacheValue.current = value
}
}, [handleOnChange, value])
}, [value])

useEffect(() => {
updateComponentRuntimeProps({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ export const JSON_EDITOR_WIDGET_CONFIG: WidgetConfig = {
defaults: {
colorScheme: "grayBlue",
hidden: false,
value: `[{
language: "en-US",
userConfig: { "0-16": "planA", "17-24": "planB", "25+": "planC" },
},
{
language: "ja-JP",
userConfig: { "0-16": "planD", "17-24": "planE", "25+": "planF" },
}]`,
value: undefined,
defaultValue: `[{
language: "en-US",
userConfig: { "0-16": "planA", "17-24": "planB", "25+": "planC" },
Expand Down
25 changes: 15 additions & 10 deletions apps/builder/src/widgetLibrary/NumberInputWidget/numberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,20 @@ export const NumberInputWidget: FC<NumberInputWidgetProps> = (props) => {
)

useEffect(() => {
setNumberInputValue(defaultValue)
handleUpdateMultiExecutionResult([
{
displayName,
value: {
value: defaultValue || "",
if (
typeof defaultValue === "undefined" ||
typeof defaultValue === "number"
) {
setNumberInputValue(defaultValue)
handleUpdateMultiExecutionResult([
{
displayName,
value: {
value: (defaultValue as unknown) === "" ? undefined : defaultValue,
},
},
},
])
])
}
}, [defaultValue, displayName, handleUpdateMultiExecutionResult])

const debounceOnChange = useRef(
Expand All @@ -127,7 +132,7 @@ export const NumberInputWidget: FC<NumberInputWidgetProps> = (props) => {
{
displayName,
value: {
value: value === undefined ? "" : value,
value: (value as unknown) === "" ? undefined : value,
validateMessage: message,
},
},
Expand Down Expand Up @@ -193,7 +198,7 @@ export const NumberInputWidget: FC<NumberInputWidgetProps> = (props) => {
numberInputRef.current?.focus()
},
setValue: (value: number) => {
if (typeof value === "number") {
if (typeof value === "number" || typeof value === "undefined") {
handleOnChange(value)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const NUMBER_INPUT_WIDGET_CONFIG: WidgetConfig = {
defaults: {
label: "Label",
defaultValue: "",
value: "",
value: undefined,
labelAlign: "left",
labelPosition: "left",
labelWidth: "{{33}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const SLIDER_WIDGET_CONFIG: WidgetConfig = {
resizeDirection: RESIZE_DIRECTION.HORIZONTAL,
version: 0,
defaults: {
value: "{{2}}",
value: undefined,
defaultValue: "{{2}}",
min: "{{0}}",
max: "{{10}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const TEXTAREA_WIDGET_CONFIG: WidgetConfig = {
h: 8,
version: 0,
defaults: {
value: "",
value: undefined,
defaultValue: "",
label: "Label",
labelAlign: "left",
Expand Down

0 comments on commit 95187d1

Please sign in to comment.