From 16a419f2a56a188d6eb3d326860970f54b5c065c Mon Sep 17 00:00:00 2001 From: smallSohoSolo Date: Fri, 28 Oct 2022 16:15:12 +0800 Subject: [PATCH 01/24] fix: resource choose logo bug --- .../components/Actions/ActionPanel/ResourceChoose/index.tsx | 5 ++++- .../components/Actions/ActionPanel/ResourceChoose/style.ts | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx b/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx index a7680ccd0d..8bf771b2f2 100644 --- a/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx @@ -2,6 +2,7 @@ import { FC, useState } from "react" import { createNewStyle, itemContainer, + itemLogo, itemText, resourceChooseContainerStyle, resourceTitleStyle, @@ -110,7 +111,9 @@ export const ResourceChoose: FC = () => { return ( diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/style.ts b/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/style.ts index 40c1669d34..f288599870 100644 --- a/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/style.ts +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/style.ts @@ -27,6 +27,10 @@ export const itemContainer = css` align-items: center; ` +export const itemLogo = css` + flex-shrink: 0; +` + export const itemText = css` margin-left: 8px; flex-shrink: 1; From f780e28b74262b3de1f7acf40d654e5d50f5630d Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 28 Oct 2022 16:23:23 +0800 Subject: [PATCH 02/24] fix: action result style error --- apps/builder/src/i18n/locale/en-US.json | 2 +- .../ActionPanel/ResourceChoose/index.tsx | 6 ++- .../ActionPanel/actionPanelContext.tsx | 6 +++ .../components/Actions/ActionPanel/index.tsx | 37 ++++++++++++------- .../Actions/ActionPanel/interface.ts | 4 ++ illa-design | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 apps/builder/src/page/App/components/Actions/ActionPanel/actionPanelContext.tsx diff --git a/apps/builder/src/i18n/locale/en-US.json b/apps/builder/src/i18n/locale/en-US.json index c693c478b3..cd97c5ef47 100644 --- a/apps/builder/src/i18n/locale/en-US.json +++ b/apps/builder/src/i18n/locale/en-US.json @@ -553,7 +553,7 @@ "overFlow": "OverFlow", "pattern": "Pattern", "pending": "Pending", - "pageSize": "Rows per page", + "pageSize": "PageSize", "placeholder": "Placeholder", "prefix_text": "Prefix text", "radius": "Radius", diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx b/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx index a7680ccd0d..05f4f1c141 100644 --- a/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/ResourceChoose/index.tsx @@ -1,4 +1,4 @@ -import { FC, useState } from "react" +import { FC, useContext, useState } from "react" import { createNewStyle, itemContainer, @@ -28,6 +28,7 @@ import { getCachedAction, getSelectedAction, } from "@/redux/config/configSelector" +import { ActionPanelContext } from "@/page/App/components/Actions/ActionPanel/actionPanelContext" export const ResourceChoose: FC = () => { const { t } = useTranslation() @@ -40,6 +41,8 @@ export const ResourceChoose: FC = () => { const action = useSelector(getCachedAction)!! const selectedAction = useSelector(getSelectedAction)!! + const { onChangeSelectedResource } = useContext(ActionPanelContext) + //maybe empty const currentSelectResource = resourceList.find( (r) => r.resourceId === action.resourceId, @@ -74,6 +77,7 @@ export const ResourceChoose: FC = () => { : getInitialContent(resource.resourceType), }), ) + onChangeSelectedResource?.() } }} addonAfter={{ diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/actionPanelContext.tsx b/apps/builder/src/page/App/components/Actions/ActionPanel/actionPanelContext.tsx new file mode 100644 index 0000000000..afbc3c430e --- /dev/null +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/actionPanelContext.tsx @@ -0,0 +1,6 @@ +import { createContext } from "react" +import { ActionPanelContextProps } from "@/page/App/components/Actions/ActionPanel/interface" + +export const ActionPanelContext = createContext({}) + +ActionPanelContext.displayName = "ActionPanelContext" diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/index.tsx b/apps/builder/src/page/App/components/Actions/ActionPanel/index.tsx index ce38ad2aa2..94fbb0417f 100644 --- a/apps/builder/src/page/App/components/Actions/ActionPanel/index.tsx +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/index.tsx @@ -14,6 +14,7 @@ import { ActionResultType } from "@/page/App/components/Actions/ActionPanel/Acti import { RedisPanel } from "@/page/App/components/Actions/ActionPanel/RedisPanel" import { MongoDbPanel } from "@/page/App/components/Actions/ActionPanel/MongoDbPanel" import { ActionPanelContainerProps } from "@/page/App/components/Actions/ActionPanel/interface" +import { ActionPanelContext } from "@/page/App/components/Actions/ActionPanel/actionPanelContext" export const ActionPanel: FC = (props) => { const { maxHeight } = props @@ -46,27 +47,35 @@ export const ActionPanel: FC = (props) => { } }, [cachedAction]) + const clearActionResult = () => { + setActionResult(undefined) + if (contentRef.current) { + contentRef.current.style.paddingBottom = "48px" + } + } + if (cachedAction === null || cachedAction === undefined) { return <> } return (
- -
- {panel} -
- { - setActionResult(undefined) - if (contentRef.current) { - contentRef.current.style.paddingBottom = "48px" - } + + > + +
+ {panel} +
+ +
) } diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/interface.ts b/apps/builder/src/page/App/components/Actions/ActionPanel/interface.ts index b4a5851534..cf9575ff9d 100644 --- a/apps/builder/src/page/App/components/Actions/ActionPanel/interface.ts +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/interface.ts @@ -1,3 +1,7 @@ export interface ActionPanelContainerProps { maxHeight?: number } + +export interface ActionPanelContextProps { + onChangeSelectedResource?: () => void +} diff --git a/illa-design b/illa-design index dcd326bf37..6322c19abc 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit dcd326bf3786b8f0112226603e8df77c2f232fc8 +Subproject commit 6322c19abcef0b54b8d67ddd3e39db86e6a90629 From dc1cd2415c47c4fee37ef5ffc5a1ef4367c4a9b0 Mon Sep 17 00:00:00 2001 From: smallSohoSolo Date: Fri, 28 Oct 2022 16:48:35 +0800 Subject: [PATCH 03/24] fix: design pointer --- illa-design | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/illa-design b/illa-design index dcd326bf37..6322c19abc 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit dcd326bf3786b8f0112226603e8df77c2f232fc8 +Subproject commit 6322c19abcef0b54b8d67ddd3e39db86e6a90629 From 30fa8c2f66b6a277bf9bc84ef0595277cc0e69b1 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 28 Oct 2022 17:51:38 +0800 Subject: [PATCH 04/24] feat: update i18n --- apps/builder/src/i18n/locale/en-US.json | 21 +++++++++++-------- apps/builder/src/i18n/locale/zh-CN.json | 21 +++++++++++-------- .../ButtonWidget/panelConfig.tsx | 2 +- .../DividerWidget/panelConfig.tsx | 2 +- .../EditableWidget/panelConfig.tsx | 7 +++++++ .../EditableWidget/widgetConfig.tsx | 4 ++-- .../SwitchWidget/panelConfig.tsx | 4 +++- .../TimelineWidget/panelConfig.tsx | 5 +++-- illa-design | 2 +- 9 files changed, 42 insertions(+), 26 deletions(-) diff --git a/apps/builder/src/i18n/locale/en-US.json b/apps/builder/src/i18n/locale/en-US.json index cd97c5ef47..56415183eb 100644 --- a/apps/builder/src/i18n/locale/en-US.json +++ b/apps/builder/src/i18n/locale/en-US.json @@ -608,26 +608,27 @@ "action": "Your actions to components trigger queries, control components, or call the data in your resources. Multiple async actions will be executed in parallel.", "component_default_value": "The initial value of the component. You can dynamically change the initial value by typing JavaScript in {{}}.", "custom_rule": "Create your validation logic here. The rules should be made in JavaScript and covered by {{}}.", - "date_format": "A valid date format string. See [dayJS](https://day.js.org/docs/en/parse/string-format)", + "date_format": "A valid date format string. See [dayJS](https://day.js.org/docs/en/parse/string-format).", "default_value": "The initial value of the input box. You can dynamically change the initial value of the input field by typing JavaScript in {{}}.", "disabled": "Control the status of whether the component is disabled. The component cannot be modified or focused when it is disabled.", "disabled_submit": "When disabled, the components that call the form.submit() method will also be disabled.", - "download": "Show download button in toolbar", - "filter": "Show filter button in toolbar", + "download": "Show download button in toolbar.", + "filter": "Show filter button in toolbar.", "form_data_key": "Specify a key of a wrapping form component when constructing the data attribute.", "hidden": "Dynamically control whether the component is hidden. You can change the hidden status through dynamical boolean value.", "hide_validation_message": "You can hide the error message by switching the hidden status when the input value is incorrect. You can dynamically change the hidden status by JavaScript.", "input_default_value": "The initial value of the input box. You can dynamically change the initial value of the input field by typing JavaScript in {{}}.", "loading": "Whether the component should show a loading indicator.", - "map_data_option": "Use either an array of values or an object of keys mapped to arrays. Each item in your data source is mapped to each option", - "only_run_when": "Conditions that must be met before the event executes", + "map_data_option": "Use either an array of values or an object of keys mapped to arrays. Each item in your data source is mapped to each option.", + "only_run_when": "Conditions that must be met before the event executes.", "placeholder": "The value will be shown when the input field is empty.", - "progress_percentage": "The percentage value is between 0 and 100", - "read_only": "Control the status of whether the component is read only. A read only component can be selected and focused but cannont be modified.", + "progress_percentage": "The percentage value is between 0 and 100.", + "read_only": "Control the status of whether the component is read only. A read only component can be selected and focused but cannot be modified.", "required_field": "Valid only when the switch is on.", "switch_default_value": "Set the initial status of the switch. You can dynamically change the default value by JavaScript.", - "text_value": "You can choose to enter value either in Markdown mode or Plain text mode. Only links in markdown mode can be recognized", + "text_value": "You can choose to enter value either in Markdown mode or Plain text mode. Only links in markdown mode can be recognized.", "timeline_direction": "Change the direction of the timeline.", + "timeline_pending": "Whether to show a node with a pending status.", "tooltip": "User can enter component tooltip here. The tooltip will be shown when it is focused. Markdown format is supported." }, "tab_title": "Inspect", @@ -931,7 +932,9 @@ "text_model": "Plain text" }, "timeline": { - "name": "Timeline" + "name": "Timeline", + "vertical": "vertical", + "horizontal": "horizontal" } } } diff --git a/apps/builder/src/i18n/locale/zh-CN.json b/apps/builder/src/i18n/locale/zh-CN.json index 09b6ea5266..77f723c66c 100644 --- a/apps/builder/src/i18n/locale/zh-CN.json +++ b/apps/builder/src/i18n/locale/zh-CN.json @@ -552,7 +552,7 @@ "only_run_when": "先决条件", "overFlow": "翻页方式", "pattern": "模式", - "pending": "等待", + "pending": "待处理节点", "pageSize": "每页行数", "placeholder": "占位符", "prefix_text": "前缀文本", @@ -612,22 +612,23 @@ "default_value": "输入框的默认值。您可以使用模版语法在框中输入JavaScript语句动态改变输入框的默认值。", "disabled": "控制组件是否为禁用状态。当组件为禁用状态时,组件不能被修改。", "disabled_submit": "禁用提交时,调用form.submit()方法的组件也会被禁用。", - "download": "在工具栏显示下载按钮", - "filter": "在工具栏显示筛选按钮", + "download": "在工具栏显示下载按钮。", + "filter": "在工具栏显示筛选按钮。", "form_data_key": "在构建数据属性时,指定一个包装表单组件的键。", - "hidden": "动态控制组件是否为隐藏状态。您可以在此处输入动态改变的Boolean值改变组件的隐藏状态", + "hidden": "动态控制组件是否为隐藏状态。您可以在此处输入动态改变的Boolean值改变组件的隐藏状态。", "hide_validation_message": "当验证输入有误时隐藏错误信息。您可以通过编写 JavaScript 对是否隐藏进行动态修改。", "input_default_value": "输入框的默认值。您可以使用模版语法在框中输入 JavaScript 语句动态改变输入框的默认值。", "loading": "控制组件是否为加载状态。", - "map_data_option": "使用数值或由键值组成的对象映射成选项。数据源中的每个项都映射到每个选项", - "only_run_when": "在此输入该事件执行前必须满足的条件", + "map_data_option": "使用数值或由键值组成的对象映射成选项。数据源中的每个项都映射到每个选项。", + "only_run_when": "在此输入该事件执行前必须满足的条件。", "placeholder": "当输入中没有值时,展示的信息。", - "progress_percentage": "进度条的数值范围为 0-100", + "progress_percentage": "进度条的数值范围为 0-100。", "read_only": "控制组件是否为只读状态。只读组件的内容可以被选中和聚焦,但不能被修改。", "required_field": "在开关开启后对输入框执行验证。", "switch_default_value": "设置开关的初始状态。您可以通过 JavaScript 动态改变开关的初始状态。", "text_value": "您可以选择在 Markdown 模式或纯文本模式下输入值。只有在 Markdown 模式下可以输入链接。", - "timeline_direction": "切换时间轴的方向", + "timeline_direction": "切换时间轴的方向。", + "timeline_pending": "是否显示一个待处理状态的节点。", "tooltip": "用户可以在输入框输入提示内容,当鼠标放在组件上,展示提示信息,支持Markdown格式。" }, "tab_title": "属性", @@ -931,7 +932,9 @@ "text_model": "纯文本" }, "timeline": { - "name": "时间线" + "name": "时间线", + "vertical": "纵向", + "horizontal": "横向" } } } diff --git a/apps/builder/src/widgetLibrary/ButtonWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/ButtonWidget/panelConfig.tsx index b00a79620d..bb04ffcfb2 100644 --- a/apps/builder/src/widgetLibrary/ButtonWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/ButtonWidget/panelConfig.tsx @@ -117,7 +117,7 @@ export const BUTTON_PANEL_CONFIG: PanelConfig[] = [ { id: `${baseWidgetName}-style-list`, setterType: "LIST_SETTER", - labelName: i18n.t("editor.inspect.setter_label.color"), + labelName: i18n.t("editor.inspect.setter_label.colors"), attrName: "styles", useCustomLayout: true, childrenSetter: [ diff --git a/apps/builder/src/widgetLibrary/DividerWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/DividerWidget/panelConfig.tsx index c107709fbb..e12d667665 100644 --- a/apps/builder/src/widgetLibrary/DividerWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/DividerWidget/panelConfig.tsx @@ -45,7 +45,7 @@ export const DIVIDER_PANEL_CONFIG: PanelConfig[] = [ }, { id: `${baseWidgetName}-layout`, - groupName: i18n.t("editor.inspect.setter_group.label"), + groupName: i18n.t("editor.inspect.setter_group.layout"), children: [ { id: `${baseWidgetName}-layout-hidden`, diff --git a/apps/builder/src/widgetLibrary/EditableWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/EditableWidget/panelConfig.tsx index 373004fe10..ad7e64c787 100644 --- a/apps/builder/src/widgetLibrary/EditableWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/EditableWidget/panelConfig.tsx @@ -49,6 +49,13 @@ export const EDITABLE_TEXT_PANEL_CONFIG: PanelConfig[] = [ expectedType: VALIDATION_TYPES.STRING, setterType: "INPUT_SETTER", }, + { + id: `${baseWidgetName}-label-hidden`, + labelName: i18n.t("editor.inspect.setter_label.hidden_label"), + attrName: "labelHidden", + setterType: "DYNAMIC_SWITCH_SETTER", + useCustomLayout: true, + }, { id: `${baseWidgetName}-label-position`, labelName: i18n.t("editor.inspect.setter_label.label_position"), diff --git a/apps/builder/src/widgetLibrary/EditableWidget/widgetConfig.tsx b/apps/builder/src/widgetLibrary/EditableWidget/widgetConfig.tsx index ff121419c6..4d9301a9cf 100644 --- a/apps/builder/src/widgetLibrary/EditableWidget/widgetConfig.tsx +++ b/apps/builder/src/widgetLibrary/EditableWidget/widgetConfig.tsx @@ -9,7 +9,7 @@ export const EDITABLE_TEXT_WIDGET_CONFIG: WidgetConfig = { icon: , keywords: ["Editable Text", "可编辑文本"], sessionType: "INPUTS", - w: 10, + w: 24, h: 5, defaults: { label: "Label", @@ -18,6 +18,6 @@ export const EDITABLE_TEXT_WIDGET_CONFIG: WidgetConfig = { labelWidth: "{{33}}", colorScheme: "blue", hidden: false, - placeholder: "enter sth", + value: "editable text for display", }, } diff --git a/apps/builder/src/widgetLibrary/SwitchWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/SwitchWidget/panelConfig.tsx index 5230bafa7a..1e079f8fd7 100644 --- a/apps/builder/src/widgetLibrary/SwitchWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/SwitchWidget/panelConfig.tsx @@ -14,7 +14,9 @@ export const SWITCH_PANEL_CONFIG: PanelConfig[] = [ { id: `${baseWidgetName}-basic-defaultValue`, labelName: i18n.t("editor.inspect.setter_label.default_value"), - labelDesc: i18n.t("editor.inspect.setter_tooltip.switch_default_value"), + labelDesc: i18n.t( + "editor.inspect.setter_tooltip.component_default_value", + ), attrName: "value", setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.BOOLEAN, diff --git a/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx index e45833ee0b..1c93195e90 100644 --- a/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx @@ -23,9 +23,9 @@ export const TIMELINE_PANEL_CONFIG: PanelConfig[] = [ setterType: "RADIO_GROUP_SETTER", attrName: "direction", options: [ - { label: "vertical", value: "vertical" }, + { label: i18n.t("widget.timeline.vertical"), value: "vertical" }, { - label: "horizontal", + label: i18n.t("widget.timeline.horizontal"), value: "horizontal", }, ], @@ -33,6 +33,7 @@ export const TIMELINE_PANEL_CONFIG: PanelConfig[] = [ { id: `${baseWidgetName}-pending`, labelName: i18n.t("editor.inspect.setter_label.pending"), + labelDesc: i18n.t("editor.inspect.setter_tooltip.timeline_direction"), attrName: "pending", setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.BOOLEAN, diff --git a/illa-design b/illa-design index 6322c19abc..80e30a382b 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit 6322c19abcef0b54b8d67ddd3e39db86e6a90629 +Subproject commit 80e30a382b12a18f37aff28b8fd006fd986b46d5 From 3d0b1cfe428ed06197824143e4c893309d353b7c Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 28 Oct 2022 18:36:20 +0800 Subject: [PATCH 05/24] feat: update i18n --- .../BarProgressWidget/panelConfig.tsx | 14 +++++++------- .../CheckboxGroupWidget/panelConfig.tsx | 2 +- .../CircleProgressWidget/panelConfig.tsx | 14 +++++++------- .../DateRangeWidget/panelConfig.tsx | 4 ++-- .../widgetLibrary/DateTimeWidget/panelConfig.tsx | 2 ++ .../src/widgetLibrary/DateWidget/panelConfig.tsx | 2 ++ .../src/widgetLibrary/ImageWidget/image.tsx | 3 ++- .../src/widgetLibrary/ImageWidget/interface.ts | 1 + .../widgetLibrary/ImageWidget/panelConfig.tsx | 15 ++++++++++++++- .../widgetLibrary/InputWidget/widgetConfig.tsx | 1 + .../NumberInputWidget/panelConfig.tsx | 16 ++++++++-------- 11 files changed, 47 insertions(+), 27 deletions(-) diff --git a/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx index 0af2b9df70..4d67d7728d 100644 --- a/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx @@ -18,6 +18,13 @@ export const BAR_PROGRESS_PANEL_CONFIG: PanelConfig[] = [ setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.STRING, }, + { + id: `${baseWidgetName}-basic-hidden`, + labelName: i18n.t("editor.inspect.setter_label.hide_value_label"), + attrName: "labelHidden", + setterType: "DYNAMIC_SWITCH_SETTER", + useCustomLayout: true, + }, ], }, { @@ -38,13 +45,6 @@ export const BAR_PROGRESS_PANEL_CONFIG: PanelConfig[] = [ setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.STRING, }, - { - id: `${baseWidgetName}-label-hidden`, - labelName: i18n.t("editor.inspect.setter_label.hidden_label"), - attrName: "labelHidden", - setterType: "DYNAMIC_SWITCH_SETTER", - useCustomLayout: true, - }, { id: `${baseWidgetName}-label-position`, labelName: i18n.t("editor.inspect.setter_label.label_position"), diff --git a/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx index 2f32848438..469cd74cc5 100644 --- a/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx @@ -277,7 +277,7 @@ export const CHECKBOX_GROUP_PANEL_CONFIG: PanelConfig[] = [ }, { id: `${baseWidgetName}-layout-direction`, - labelName: i18n.t("editor.inspect.setter_label.label_alignment"), + labelName: i18n.t("editor.inspect.setter_label.group_layout"), setterType: "RADIO_GROUP_SETTER", attrName: "direction", options: [ diff --git a/apps/builder/src/widgetLibrary/CircleProgressWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/CircleProgressWidget/panelConfig.tsx index c0a9e5c482..ec4565a5b1 100644 --- a/apps/builder/src/widgetLibrary/CircleProgressWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/CircleProgressWidget/panelConfig.tsx @@ -22,19 +22,19 @@ export const CIRCLE_PROGRESS_PANEL_CONFIG: PanelConfig[] = [ setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.STRING, }, - ], - }, - { - id: `${baseWidgetName}-adornments`, - groupName: i18n.t("editor.inspect.setter_group.adornments"), - children: [ { - id: `${baseWidgetName}-adornments-showText`, + id: `${baseWidgetName}-basic-showText`, labelName: i18n.t("editor.inspect.setter_label.hide_value_label"), attrName: "showText", setterType: "DYNAMIC_SWITCH_SETTER", useCustomLayout: true, }, + ], + }, + { + id: `${baseWidgetName}-adornments`, + groupName: i18n.t("editor.inspect.setter_group.adornments"), + children: [ { id: `${baseWidgetName}-adornments-tooltip`, labelName: i18n.t("editor.inspect.setter_label.tooltip"), diff --git a/apps/builder/src/widgetLibrary/DateRangeWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/DateRangeWidget/panelConfig.tsx index 025239b173..ef9a7ba239 100644 --- a/apps/builder/src/widgetLibrary/DateRangeWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/DateRangeWidget/panelConfig.tsx @@ -50,14 +50,14 @@ export const DATE_RANGE_PANEL_CONFIG: PanelConfig[] = [ id: `${baseWidgetName}-basic-max-date`, labelName: i18n.t("editor.inspect.setter_label.max_date"), attrName: "maxDate", - placeholder: "2022-05-30", + placeholder: "2032-01-01", setterType: "INPUT_SETTER", }, { id: `${baseWidgetName}-basic-min-date`, labelName: i18n.t("editor.inspect.setter_label.min_date"), attrName: "minDate", - placeholder: "2022-05-01", + placeholder: "2022-01-01", setterType: "INPUT_SETTER", }, ], diff --git a/apps/builder/src/widgetLibrary/DateTimeWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/DateTimeWidget/panelConfig.tsx index 170554bbb1..6a6e0de858 100644 --- a/apps/builder/src/widgetLibrary/DateTimeWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/DateTimeWidget/panelConfig.tsx @@ -42,6 +42,7 @@ export const DATE_TIME_PANEL_CONFIG: PanelConfig[] = [ labelName: i18n.t("editor.inspect.setter_label.max_date"), attrName: "maxDate", setterType: "INPUT_SETTER", + placeholder: "2032-01-01", expectedType: VALIDATION_TYPES.STRING, }, { @@ -49,6 +50,7 @@ export const DATE_TIME_PANEL_CONFIG: PanelConfig[] = [ labelName: i18n.t("editor.inspect.setter_label.min_date"), attrName: "minDate", setterType: "INPUT_SETTER", + placeholder: "2022-01-01", expectedType: VALIDATION_TYPES.STRING, }, { diff --git a/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx index 2cceb55f75..d05e0f9acd 100644 --- a/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx @@ -42,6 +42,7 @@ export const DATE_PANEL_CONFIG: PanelConfig[] = [ labelName: i18n.t("editor.inspect.setter_label.max_date"), attrName: "maxDate", setterType: "INPUT_SETTER", + placeholder: "2032-01-01", expectedType: VALIDATION_TYPES.STRING, }, { @@ -49,6 +50,7 @@ export const DATE_PANEL_CONFIG: PanelConfig[] = [ labelName: i18n.t("editor.inspect.setter_label.min_date"), attrName: "minDate", setterType: "INPUT_SETTER", + placeholder: "2022-01-01", expectedType: VALIDATION_TYPES.STRING, }, ], diff --git a/apps/builder/src/widgetLibrary/ImageWidget/image.tsx b/apps/builder/src/widgetLibrary/ImageWidget/image.tsx index 3e4bffe1e6..2990f26c4c 100644 --- a/apps/builder/src/widgetLibrary/ImageWidget/image.tsx +++ b/apps/builder/src/widgetLibrary/ImageWidget/image.tsx @@ -7,7 +7,7 @@ import { TooltipWrapper } from "@/widgetLibrary/PublicSector/TooltipWrapper" export const WrappedImage = forwardRef( (props, ref) => { - const { imageSrc, altText, radius, objectFit } = props + const { imageSrc, altText, radius, objectFit, handleOnClick } = props return ( ( width="100%" css={ImageWrapperStyle} draggable={false} + onClick={handleOnClick} /> ) }, diff --git a/apps/builder/src/widgetLibrary/ImageWidget/interface.ts b/apps/builder/src/widgetLibrary/ImageWidget/interface.ts index 66cbfcaaca..63c7a397dc 100644 --- a/apps/builder/src/widgetLibrary/ImageWidget/interface.ts +++ b/apps/builder/src/widgetLibrary/ImageWidget/interface.ts @@ -7,6 +7,7 @@ export interface WrappedImageProps imageSrc?: ImageProps["src"] altText?: ImageProps["alt"] objectFit?: "fill" | "contain" | "cover" | "none" | "scale-down" + handleOnClick: () => void } export interface ImageWidgetProps diff --git a/apps/builder/src/widgetLibrary/ImageWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/ImageWidget/panelConfig.tsx index 4b33cf9016..20d0945aa7 100644 --- a/apps/builder/src/widgetLibrary/ImageWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/ImageWidget/panelConfig.tsx @@ -2,6 +2,8 @@ import { PanelConfig } from "@/page/App/components/InspectPanel/interface" import { VALIDATION_TYPES } from "@/utils/validationFactory" import i18n from "@/i18n/config" import { ReactComponent as RadioIcon } from "@/assets/radius-icon.svg" +import { generatorEventHandlerConfig } from "@/widgetLibrary/PublicSector/utils/generatorEventHandlerConfig" +import { IMAGE_EVENT_HANDLER_CONFIG } from "@/widgetLibrary/ImageWidget/eventHandlerConfig" const baseWidgetName = "input" export const IMAGE_PANEL_CONFIG: PanelConfig[] = [ @@ -28,13 +30,24 @@ export const IMAGE_PANEL_CONFIG: PanelConfig[] = [ { id: `${baseWidgetName}-basic-scale-type`, labelName: i18n.t("editor.inspect.setter_label.scale_type"), - labelDesc: i18n.t("editor.inspect.setter_label.scale_type"), attrName: "objectFit", setterType: "BASE_SELECT_SETTER", options: ["container", "cover", "fill", "none", "scale-down"], }, ], }, + { + id: `${baseWidgetName}-interaction`, + groupName: i18n.t("editor.inspect.setter_group.interaction"), + children: [ + { + ...generatorEventHandlerConfig( + baseWidgetName, + IMAGE_EVENT_HANDLER_CONFIG.events, + ), + }, + ], + }, { id: `${baseWidgetName}-adornments`, groupName: i18n.t("editor.inspect.setter_group.adornments"), diff --git a/apps/builder/src/widgetLibrary/InputWidget/widgetConfig.tsx b/apps/builder/src/widgetLibrary/InputWidget/widgetConfig.tsx index 2c18b33631..8d19f26ad8 100644 --- a/apps/builder/src/widgetLibrary/InputWidget/widgetConfig.tsx +++ b/apps/builder/src/widgetLibrary/InputWidget/widgetConfig.tsx @@ -21,5 +21,6 @@ export const INPUT_WIDGET_CONFIG: WidgetConfig = { colorScheme: "blue", hidden: false, formDataKey: "input", + placeholder: "input sth", }, } diff --git a/apps/builder/src/widgetLibrary/NumberInputWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/NumberInputWidget/panelConfig.tsx index d9b11a65ad..68949f1b41 100644 --- a/apps/builder/src/widgetLibrary/NumberInputWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/NumberInputWidget/panelConfig.tsx @@ -135,6 +135,14 @@ export const NUMBER_INPUT_PANEL_CONFIG: PanelConfig[] = [ INPUT_NUMBER_EVENT_HANDLER_CONFIG.events, ), }, + { + id: `${widgetBaseName}-interaction-loading`, + labelName: i18n.t("editor.inspect.setter_label.loading"), + labelDesc: i18n.t("editor.inspect.setter_tooltip.loading"), + attrName: "loading", + setterType: "INPUT_SETTER", + expectedType: VALIDATION_TYPES.BOOLEAN, + }, { id: `${widgetBaseName}-interaction-disabled`, labelName: i18n.t("editor.inspect.setter_label.disabled"), @@ -167,14 +175,6 @@ export const NUMBER_INPUT_PANEL_CONFIG: PanelConfig[] = [ setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.STRING, }, - { - id: `${widgetBaseName}-adornments-loading`, - labelName: i18n.t("editor.inspect.setter_label.loading"), - labelDesc: i18n.t("editor.inspect.setter_tooltip.loading"), - attrName: "loading", - setterType: "INPUT_SETTER", - expectedType: VALIDATION_TYPES.BOOLEAN, - }, { id: `${widgetBaseName}-adornments-prefix`, labelName: i18n.t("editor.inspect.setter_label.prefix_text"), From 2e9ed5f5ed9c6b7219a9c741ad1738840016e596 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 28 Oct 2022 19:26:47 +0800 Subject: [PATCH 06/24] fix: timeLine config --- apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx index 1c93195e90..12da43d028 100644 --- a/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/TimelineWidget/panelConfig.tsx @@ -33,7 +33,7 @@ export const TIMELINE_PANEL_CONFIG: PanelConfig[] = [ { id: `${baseWidgetName}-pending`, labelName: i18n.t("editor.inspect.setter_label.pending"), - labelDesc: i18n.t("editor.inspect.setter_tooltip.timeline_direction"), + labelDesc: i18n.t("editor.inspect.setter_tooltip.timeline_pending"), attrName: "pending", setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.BOOLEAN, From fff54901154239d4f757ac708c0e687da4c80a5a Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 28 Oct 2022 19:49:43 +0800 Subject: [PATCH 07/24] chore: update --- illa-design | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/illa-design b/illa-design index 80e30a382b..388c62a5b8 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit 80e30a382b12a18f37aff28b8fd006fd986b46d5 +Subproject commit 388c62a5b832d581452e6d98938ef1e3760974a0 From 2439e4661b6cbf17d4534518f7d699e791453af6 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Mon, 31 Oct 2022 16:40:10 +0800 Subject: [PATCH 08/24] feat: change date panelConfig --- .../BarProgressWidget/panelConfig.tsx | 18 +++++++++--------- .../widgetLibrary/DateWidget/panelConfig.tsx | 16 ++++++++-------- illa-design | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx index 4d67d7728d..72754366a1 100644 --- a/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/BarProgressWidget/panelConfig.tsx @@ -19,9 +19,9 @@ export const BAR_PROGRESS_PANEL_CONFIG: PanelConfig[] = [ expectedType: VALIDATION_TYPES.STRING, }, { - id: `${baseWidgetName}-basic-hidden`, + id: `${baseWidgetName}-basic-showText`, labelName: i18n.t("editor.inspect.setter_label.hide_value_label"), - attrName: "labelHidden", + attrName: "showText", setterType: "DYNAMIC_SWITCH_SETTER", useCustomLayout: true, }, @@ -38,6 +38,13 @@ export const BAR_PROGRESS_PANEL_CONFIG: PanelConfig[] = [ setterType: "INPUT_SETTER", expectedType: VALIDATION_TYPES.STRING, }, + { + id: `${baseWidgetName}-label-hidden`, + labelName: i18n.t("editor.inspect.setter_label.hidden_label"), + attrName: "labelHidden", + setterType: "DYNAMIC_SWITCH_SETTER", + useCustomLayout: true, + }, { id: `${baseWidgetName}-label-caption`, labelName: i18n.t("editor.inspect.setter_label.caption"), @@ -90,13 +97,6 @@ export const BAR_PROGRESS_PANEL_CONFIG: PanelConfig[] = [ id: `${baseWidgetName}-adornments`, groupName: i18n.t("editor.inspect.setter_group.adornments"), children: [ - { - id: `${baseWidgetName}-adornments-showText`, - labelName: i18n.t("editor.inspect.setter_label.hide_value_label"), - attrName: "showText", - setterType: "DYNAMIC_SWITCH_SETTER", - useCustomLayout: true, - }, { id: `${baseWidgetName}-adornments-tooltip`, labelName: i18n.t("editor.inspect.setter_label.tooltip"), diff --git a/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx index d05e0f9acd..bbfee5595e 100644 --- a/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/DateWidget/panelConfig.tsx @@ -131,6 +131,14 @@ export const DATE_PANEL_CONFIG: PanelConfig[] = [ DATE_EVENT_HANDLER_CONFIG.events, ), }, + { + id: `${baseWidgetName}-interaction-loading`, + labelName: i18n.t("editor.inspect.setter_label.loading"), + labelDesc: i18n.t("editor.inspect.setter_tooltip.loading"), + attrName: "loading", + setterType: "INPUT_SETTER", + expectedType: VALIDATION_TYPES.BOOLEAN, + }, { id: `${baseWidgetName}-interaction-disabled`, labelName: i18n.t("editor.inspect.setter_label.disabled"), @@ -170,14 +178,6 @@ export const DATE_PANEL_CONFIG: PanelConfig[] = [ setterType: "DYNAMIC_SWITCH_SETTER", expectedType: VALIDATION_TYPES.BOOLEAN, }, - { - id: `${baseWidgetName}-interaction-loading`, - labelName: i18n.t("editor.inspect.setter_label.loading"), - labelDesc: i18n.t("editor.inspect.setter_tooltip.loading"), - attrName: "loading", - setterType: "INPUT_SETTER", - expectedType: VALIDATION_TYPES.BOOLEAN, - }, ], }, { diff --git a/illa-design b/illa-design index 388c62a5b8..0b002d6ac2 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit 388c62a5b832d581452e6d98938ef1e3760974a0 +Subproject commit 0b002d6ac2de7ebbd738bca044aaad5ad26b419c From b8ad7a34ecaa184c16f369d71a923305b8220a68 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Mon, 31 Oct 2022 16:40:30 +0800 Subject: [PATCH 09/24] chore: update --- illa-design | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/illa-design b/illa-design index 0b002d6ac2..11cd0767ea 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit 0b002d6ac2de7ebbd738bca044aaad5ad26b419c +Subproject commit 11cd0767eac56102359234b9ea46c1e9d798a358 From a568a194965302a8e7c9d95dcc23ad4149db73bb Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Tue, 1 Nov 2022 19:16:56 +0800 Subject: [PATCH 10/24] fix: dragBar max height --- .../Actions/ActionPanel/ActionResult/index.tsx | 5 +++-- apps/builder/src/page/App/components/Actions/index.tsx | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/builder/src/page/App/components/Actions/ActionPanel/ActionResult/index.tsx b/apps/builder/src/page/App/components/Actions/ActionPanel/ActionResult/index.tsx index bb16709e76..1ea2521367 100644 --- a/apps/builder/src/page/App/components/Actions/ActionPanel/ActionResult/index.tsx +++ b/apps/builder/src/page/App/components/Actions/ActionPanel/ActionResult/index.tsx @@ -64,8 +64,9 @@ export const ActionResult: FC = (props) => { setDragMaxHeight(ele?.scrollHeight + 40) } if (placeholderRef?.current && ele?.clientHeight) { - placeholderRef.current.style.paddingBottom = `${ele?.clientHeight + - 48}px` + placeholderRef.current.style.paddingBottom = `${ + ele?.clientHeight + 48 + }px` } }} mode={"JSON"} diff --git a/apps/builder/src/page/App/components/Actions/index.tsx b/apps/builder/src/page/App/components/Actions/index.tsx index b98200bf1d..d38c177056 100644 --- a/apps/builder/src/page/App/components/Actions/index.tsx +++ b/apps/builder/src/page/App/components/Actions/index.tsx @@ -9,14 +9,19 @@ import { FocusManager } from "@/utils/focusManager" const ActionEditorDefaultHeight = 300 export const ActionEditor: FC> = (props) => { - const panelRef = useRef(null) + const panelRef = useRef(null) const [maxHeight, setMaxHeight] = useState() return (
{ + panelRef.current = ele + if (ele?.offsetHeight) { + setMaxHeight(ele?.offsetHeight - 100) + } + }} onClick={() => { FocusManager.switchFocus("action") }} From f02dc5f58efda7ca0145398c66c01c19d081584e Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Wed, 2 Nov 2022 14:40:32 +0800 Subject: [PATCH 11/24] fix: default Value --- .../src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx index 469cd74cc5..507db486d6 100644 --- a/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx @@ -109,7 +109,7 @@ export const CHECKBOX_GROUP_PANEL_CONFIG: PanelConfig[] = [ ), attrName: "value", setterType: "INPUT_SETTER", - expectedType: VALIDATION_TYPES.STRING, + expectedType: VALIDATION_TYPES.ARRAY, }, ], }, From 4d323594eeaf1215b52ba7e31788976e218d3b20 Mon Sep 17 00:00:00 2001 From: AruSeito Date: Wed, 2 Nov 2022 15:41:30 +0800 Subject: [PATCH 12/24] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fix=20calc=20tree?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executionTreeFactory.ts | 41 ++++++++++++++----- .../CheckboxGroupWidget/panelConfig.tsx | 2 +- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts b/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts index ed37dae1e8..170652fca4 100644 --- a/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts +++ b/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts @@ -33,6 +33,7 @@ export class ExecutionTreeFactory { oldRawTree: RawTreeShape = {} as RawTreeShape hasCyclical: boolean = false executedTree: RawTreeShape = {} as RawTreeShape + oldExecutedTree: RawTreeShape = {} as RawTreeShape errorTree: Record = {} debuggerData: Record = {} allKeys: Record = {} @@ -53,6 +54,7 @@ export class ExecutionTreeFactory { this.errorTree = errorTree this.debuggerData = debuggerData this.executedTree = this.validateTree(evaluatedTree) + this.oldExecutedTree = evaluatedTree return { dependencyTree: this.dependenciesState, evaluatedTree: this.executedTree, @@ -103,15 +105,6 @@ export class ExecutionTreeFactory { this.executedTree = resultExecutedTree } - applyDifferencesToRawTree(differences: Diff[]) { - const resultRawTree = cloneDeep(this.oldRawTree) - for (const d of differences) { - if (!Array.isArray(d.path) || d.path.length === 0) continue - applyChange(resultRawTree, undefined, d) - } - return resultRawTree - } - calcSubTreeSortOrder(differences: Diff[], rawTree: RawTreeShape) { const changePaths: Set = new Set() for (const diff of differences) { @@ -248,6 +241,7 @@ export class ExecutionTreeFactory { this.mergeDebugDataTree(debuggerData, path) this.executedTree = this.validateTree(evaluatedTree) + this.oldExecutedTree = evaluatedTree return { dependencyTree: this.dependenciesState, evaluatedTree: this.executedTree, @@ -256,6 +250,29 @@ export class ExecutionTreeFactory { } } + getUpdatePathFromDifferences( + differences: Diff, Record>[], + ) { + const updatePaths: string[] = [] + for (const d of differences) { + if (!Array.isArray(d.path) || d.path.length === 0) continue + updatePaths.push(d.path.join(".")) + } + return updatePaths + } + + updateRawTreeByUpdatePaths( + paths: string[], + executionTree: Record, + ) { + const currentRawTree = cloneDeep(this.oldRawTree) + paths.forEach((path) => { + const value = get(executionTree, path, undefined) + set(currentRawTree, path, value) + }) + return currentRawTree + } + updateTreeFromExecution(executionTree: Record) { const currentExecutionTree = cloneDeep(executionTree) const differences: Diff, Record>[] = @@ -265,7 +282,11 @@ export class ExecutionTreeFactory { evaluatedTree: this.executedTree, } } - const currentRawTree = this.applyDifferencesToRawTree(differences) + const updatePaths = this.getUpdatePathFromDifferences(differences) + const currentRawTree = this.updateRawTreeByUpdatePaths( + updatePaths, + currentExecutionTree, + ) const orderPath = this.calcSubTreeSortOrder(differences, currentRawTree) const { evaluatedTree, errorTree, debuggerData } = this.executeTree( currentRawTree, diff --git a/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx index 469cd74cc5..507db486d6 100644 --- a/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/CheckboxGroupWidget/panelConfig.tsx @@ -109,7 +109,7 @@ export const CHECKBOX_GROUP_PANEL_CONFIG: PanelConfig[] = [ ), attrName: "value", setterType: "INPUT_SETTER", - expectedType: VALIDATION_TYPES.STRING, + expectedType: VALIDATION_TYPES.ARRAY, }, ], }, From c2947881a286a1811254d70ca00b672d5fbec663 Mon Sep 17 00:00:00 2001 From: AruSeito Date: Wed, 2 Nov 2022 15:42:51 +0800 Subject: [PATCH 13/24] =?UTF-8?q?fix:=20=F0=9F=90=9B=20remove=20unuse=20at?= =?UTF-8?q?tr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/utils/executionTreeHelper/executionTreeFactory.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts b/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts index 170652fca4..ad05b3e710 100644 --- a/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts +++ b/apps/builder/src/utils/executionTreeHelper/executionTreeFactory.ts @@ -33,7 +33,6 @@ export class ExecutionTreeFactory { oldRawTree: RawTreeShape = {} as RawTreeShape hasCyclical: boolean = false executedTree: RawTreeShape = {} as RawTreeShape - oldExecutedTree: RawTreeShape = {} as RawTreeShape errorTree: Record = {} debuggerData: Record = {} allKeys: Record = {} @@ -54,7 +53,6 @@ export class ExecutionTreeFactory { this.errorTree = errorTree this.debuggerData = debuggerData this.executedTree = this.validateTree(evaluatedTree) - this.oldExecutedTree = evaluatedTree return { dependencyTree: this.dependenciesState, evaluatedTree: this.executedTree, @@ -241,7 +239,6 @@ export class ExecutionTreeFactory { this.mergeDebugDataTree(debuggerData, path) this.executedTree = this.validateTree(evaluatedTree) - this.oldExecutedTree = evaluatedTree return { dependencyTree: this.dependenciesState, evaluatedTree: this.executedTree, From aa2d6bf716cad3bed7b0cccc3325c5fe6e5f3c0f Mon Sep 17 00:00:00 2001 From: AruSeito Date: Wed, 2 Nov 2022 17:03:14 +0800 Subject: [PATCH 14/24] =?UTF-8?q?fix:=20=F0=9F=90=9B=20remove=20auto=20scr?= =?UTF-8?q?oll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/page/App/components/DotPanel/renderComponentCanvas.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/builder/src/page/App/components/DotPanel/renderComponentCanvas.tsx b/apps/builder/src/page/App/components/DotPanel/renderComponentCanvas.tsx index c577372c69..20d7db5035 100644 --- a/apps/builder/src/page/App/components/DotPanel/renderComponentCanvas.tsx +++ b/apps/builder/src/page/App/components/DotPanel/renderComponentCanvas.tsx @@ -222,9 +222,6 @@ export const RenderComponentCanvas: FC<{ ) { const finalNumber = landingY / UNIT_HEIGHT + item.h + safeRowNumber setRowNumber(finalNumber) - containerRef.current?.scrollTo({ - top: bounds.height, - }) } let childrenNodes = dragInfo.childrenNodes.filter( From 5911d789073c2152eeeb7ede54ca9fbe0f4cbb6b Mon Sep 17 00:00:00 2001 From: smallSohoSolo Date: Wed, 2 Nov 2022 19:18:46 +0800 Subject: [PATCH 15/24] feat: add sentry --- apps/builder/.env.cloud | 1 + apps/builder/package.json | 4 +- apps/builder/src/env.d.ts | 1 + apps/builder/src/main.tsx | 10 ++++ .../src/page/App/components/Actions/api.ts | 15 ++--- apps/builder/src/redux/config/configState.ts | 5 +- apps/builder/src/utils/copyManager.ts | 6 +- .../executionTreeHelper/generateRawAction.ts | 3 +- .../utils/executionTreeHelper/interface.ts | 3 +- apps/builder/vite.config.ts | 2 +- illa-design | 2 +- yarn.lock | 55 ++++++++++++++++++- 12 files changed, 82 insertions(+), 25 deletions(-) diff --git a/apps/builder/.env.cloud b/apps/builder/.env.cloud index 7a95b6dcc2..44de108ce7 100644 --- a/apps/builder/.env.cloud +++ b/apps/builder/.env.cloud @@ -1,3 +1,4 @@ VITE_API_BASE_URL=http://localhost:9999/api/v1 +VITE_SENTRY_ENV=prod VITE_INSTANCE_ID=CLOUD NODE_ENV=production \ No newline at end of file diff --git a/apps/builder/package.json b/apps/builder/package.json index 6e641c1dde..7749b16239 100644 --- a/apps/builder/package.json +++ b/apps/builder/package.json @@ -61,7 +61,9 @@ "remark-gfm": "^3.0.1", "tern": "^0.24.3", "toposort": "^2.0.2", - "uuid": "^8.3.2" + "uuid": "^8.3.2", + "@sentry/react": "^7.17.3", + "@sentry/tracing": "^7.17.3" }, "devDependencies": { "@changesets/changelog-github": "^0.4.2", diff --git a/apps/builder/src/env.d.ts b/apps/builder/src/env.d.ts index 485eea87fb..a8f7ee07f5 100644 --- a/apps/builder/src/env.d.ts +++ b/apps/builder/src/env.d.ts @@ -1,6 +1,7 @@ interface ImportMetaEnv { readonly VITE_API_BASE_URL: string readonly VITE_INSTANCE_ID: string + readonly VITE_SENTRY_ENV: string } interface ImportMeta { diff --git a/apps/builder/src/main.tsx b/apps/builder/src/main.tsx index df2bfef579..4662a05d60 100644 --- a/apps/builder/src/main.tsx +++ b/apps/builder/src/main.tsx @@ -6,6 +6,16 @@ import store from "./store" import "@/i18n/config" import "@/utils/dayjs" +import * as Sentry from "@sentry/react" +import { BrowserTracing } from "@sentry/tracing" + +Sentry.init({ + dsn: "http://bc9865122a714315921fbb995643f7cb@sentry.illasoft.com/1", + integrations: [new BrowserTracing()], + environment: import.meta.env.VITE_SENTRY_ENV, + tracesSampleRate: 1.0, +}) + ReactDOM.render( diff --git a/apps/builder/src/page/App/components/Actions/api.ts b/apps/builder/src/page/App/components/Actions/api.ts index b9ac1ac4cf..0d1ebba366 100644 --- a/apps/builder/src/page/App/components/Actions/api.ts +++ b/apps/builder/src/page/App/components/Actions/api.ts @@ -1,6 +1,5 @@ import { ActionContent, - ActionEvents, ActionItem, } from "@/redux/currentApp/action/actionState" import { omit } from "@illa-design/system" @@ -19,15 +18,13 @@ function getBaseActionUrl() { return `/apps/${appId}/actions` } -export function onCopyActionItem( - action: ActionItem, -) { +export function onCopyActionItem(action: ActionItem) { const baseActionUrl = getBaseActionUrl() const newAction = omit(action, ["displayName", "actionId"]) const displayName = DisplayNameGenerator.generateDisplayName( action.actionType, ) - const data: Partial> = { + const data: Partial> = { ...newAction, displayName, } @@ -37,7 +34,7 @@ export function onCopyActionItem( method: "POST", data, }, - ({ data }: { data: ActionItem }) => { + ({ data }: { data: ActionItem }) => { Message.success( i18n.t("editor.action.action_list.message.success_created"), ) @@ -55,9 +52,7 @@ export function onCopyActionItem( ) } -export function onDeleteActionItem( - action: ActionItem, -) { +export function onDeleteActionItem(action: ActionItem) { const baseActionUrl = getBaseActionUrl() const { actionId, displayName } = action @@ -66,7 +61,7 @@ export function onDeleteActionItem( url: `${baseActionUrl}/${actionId}`, method: "DELETE", }, - ({ data }: { data: ActionItem }) => { + ({ data }: { data: ActionItem }) => { DisplayNameGenerator.removeDisplayName(displayName) store.dispatch(actionActions.removeActionItemReducer(displayName)) Message.success( diff --git a/apps/builder/src/redux/config/configState.ts b/apps/builder/src/redux/config/configState.ts index eeb697bb1e..d908f081ee 100644 --- a/apps/builder/src/redux/config/configState.ts +++ b/apps/builder/src/redux/config/configState.ts @@ -1,6 +1,5 @@ import { ActionContent, - ActionEvents, ActionItem, } from "@/redux/currentApp/action/actionState" @@ -14,8 +13,8 @@ export interface ConfigState { showDot: boolean scale: number selectedComponents: string[] - selectedAction: ActionItem | null - cachedAction: ActionItem | null + selectedAction: ActionItem | null + cachedAction: ActionItem | null expandedKeys: string[] mode: IllaMode freezeCanvas: boolean diff --git a/apps/builder/src/utils/copyManager.ts b/apps/builder/src/utils/copyManager.ts index a836e67ff3..fb5832efe3 100644 --- a/apps/builder/src/utils/copyManager.ts +++ b/apps/builder/src/utils/copyManager.ts @@ -2,7 +2,6 @@ import { FocusManager } from "@/utils/focusManager" import { ComponentNode } from "@/redux/currentApp/editor/components/componentsState" import { ActionContent, - ActionEvents, ActionItem, } from "@/redux/currentApp/action/actionState" import store from "@/store" @@ -13,10 +12,9 @@ import { DisplayNameGenerator } from "@/utils/generators/generateDisplayName" export class CopyManager { static currentCopyComponentNodes: ComponentNode[] | null = null - static currentCopyAction: ActionItem | null = - null + static currentCopyAction: ActionItem | null = null - static copyAction(action: ActionItem) { + static copyAction(action: ActionItem) { this.currentCopyAction = action } diff --git a/apps/builder/src/utils/executionTreeHelper/generateRawAction.ts b/apps/builder/src/utils/executionTreeHelper/generateRawAction.ts index f963e6b528..01adc6c5ca 100644 --- a/apps/builder/src/utils/executionTreeHelper/generateRawAction.ts +++ b/apps/builder/src/utils/executionTreeHelper/generateRawAction.ts @@ -1,6 +1,5 @@ import { ActionContent, - ActionEvents, ActionItem, } from "@/redux/currentApp/action/actionState" import { isObject } from "@/utils/typeHelper" @@ -44,7 +43,7 @@ export const generateDynamicAttrPaths = ( } export const generateRawAction = ( - action: ActionItem, + action: ActionItem, ): RawAction => { let $dynamicAttrPaths: string[] = [] const { diff --git a/apps/builder/src/utils/executionTreeHelper/interface.ts b/apps/builder/src/utils/executionTreeHelper/interface.ts index 893f874173..70bdaa6a6f 100644 --- a/apps/builder/src/utils/executionTreeHelper/interface.ts +++ b/apps/builder/src/utils/executionTreeHelper/interface.ts @@ -1,6 +1,5 @@ import { ActionContent, - ActionEvents, ActionItem, } from "@/redux/currentApp/action/actionState" import { BuilderInfo } from "@/redux/builderInfo/builderInfoState" @@ -12,7 +11,7 @@ export interface RawTreeShape { currentUserInfo: CurrenUserInfoSeedShape } -type ActionSeedShape = ActionItem[] +type ActionSeedShape = ActionItem[] export interface WidgetShape { [key: string]: string diff --git a/apps/builder/vite.config.ts b/apps/builder/vite.config.ts index f168ac14d0..39675533bc 100644 --- a/apps/builder/vite.config.ts +++ b/apps/builder/vite.config.ts @@ -36,7 +36,7 @@ export default defineConfig((props) => { }, }, build: { - sourcemap: false, + sourcemap: true, }, server: { proxy: { diff --git a/illa-design b/illa-design index 11cd0767ea..78d4f9df2e 160000 --- a/illa-design +++ b/illa-design @@ -1 +1 @@ -Subproject commit 11cd0767eac56102359234b9ea46c1e9d798a358 +Subproject commit 78d4f9df2e97a45e58c39890b9737985d4a20a3b diff --git a/yarn.lock b/yarn.lock index 94d33a5272..f4949c621b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2066,6 +2066,59 @@ estree-walker "^2.0.1" picomatch "^2.2.2" +"@sentry/browser@7.17.3": + version "7.17.3" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.17.3.tgz#4e67b2d8d90df11b37f29061fec3259eedca0a4a" + integrity sha512-Oi7ZNMzCbUXaWwkFcwXIWhfNiTy8s0EukoaKzwSdIhU5pLH9HFizXMl/qrBdxC6keTtckTwS9c+w2xDnqln1fg== + dependencies: + "@sentry/core" "7.17.3" + "@sentry/types" "7.17.3" + "@sentry/utils" "7.17.3" + tslib "^1.9.3" + +"@sentry/core@7.17.3": + version "7.17.3" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.17.3.tgz#2b45c0507f1ef7018335b9bb61ed6b3f16accfad" + integrity sha512-PSboa9aOVnvZU+C6/shKlHUA7zjAl6z5BKRHF8mEljEYql6bh0HfJJKXtBHMz1sWnmzMa/qABSKLpnP5ZQlJNw== + dependencies: + "@sentry/types" "7.17.3" + "@sentry/utils" "7.17.3" + tslib "^1.9.3" + +"@sentry/react@^7.17.3": + version "7.17.3" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.17.3.tgz#4064d8c4ae82fbb5b6310e62b4acb04bb03a38ab" + integrity sha512-C+kDWbA769jeT5g4O2FlAU9uXVmHS+cQ8CjSY8HT1VqnN4ltUg//i6A+a30StPZVHJVtpShf0UQl8v8Ztehr/g== + dependencies: + "@sentry/browser" "7.17.3" + "@sentry/types" "7.17.3" + "@sentry/utils" "7.17.3" + hoist-non-react-statics "^3.3.2" + tslib "^1.9.3" + +"@sentry/tracing@^7.17.3": + version "7.17.3" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.17.3.tgz#7680d3e365d1df51943f0c360345e17f59ea784a" + integrity sha512-ZBYq1AuE2dadxbuY7j3xpf9BNP/Uu7rjuvLoCmQeFrjJ4W80jqIfdUYmWCN6EaVhhAgh7J+1RQL+c79ONkPFQQ== + dependencies: + "@sentry/core" "7.17.3" + "@sentry/types" "7.17.3" + "@sentry/utils" "7.17.3" + tslib "^1.9.3" + +"@sentry/types@7.17.3": + version "7.17.3" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.17.3.tgz#ec66ea7b6881ae243255546680722488e7ff23bf" + integrity sha512-+buEJo/4TKErjwF8Tq3XXKFZx4Utpvqs52e7i7Sur2qfyBNwRgBILceQvdnzw86JNZT2myeYmrfVbsaxAk7ilA== + +"@sentry/utils@7.17.3": + version "7.17.3" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.17.3.tgz#aafa67ed372f00be2e1bb490fa62d9d2d06a4c2f" + integrity sha512-Sd7BwVn6IClvaXbZaj/LnEcrMm8yjQtZkTVSrM2Vlv1lLeaH61JxSAFU6QntF+f/cCfZ7wSdNhWOfW3qZJ7t3Q== + dependencies: + "@sentry/types" "7.17.3" + tslib "^1.9.3" + "@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.3": version "1.8.3" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -11201,7 +11254,7 @@ tslib@2.3.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== -tslib@^1.8.1: +tslib@^1.8.1, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== From dbb9f34e567eee8da56cda2a76958c7d62ab460a Mon Sep 17 00:00:00 2001 From: smallSohoSolo Date: Thu, 3 Nov 2022 10:33:19 +0800 Subject: [PATCH 16/24] feat: remove non-cloud env sentry --- apps/builder/src/main.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/builder/src/main.tsx b/apps/builder/src/main.tsx index 4662a05d60..667c693d0b 100644 --- a/apps/builder/src/main.tsx +++ b/apps/builder/src/main.tsx @@ -9,12 +9,14 @@ import "@/utils/dayjs" import * as Sentry from "@sentry/react" import { BrowserTracing } from "@sentry/tracing" -Sentry.init({ - dsn: "http://bc9865122a714315921fbb995643f7cb@sentry.illasoft.com/1", - integrations: [new BrowserTracing()], - environment: import.meta.env.VITE_SENTRY_ENV, - tracesSampleRate: 1.0, -}) +if (import.meta.env.VITE_INSTANCE_ID === "CLOUD") { + Sentry.init({ + dsn: "http://bc9865122a714315921fbb995643f7cb@sentry.illasoft.com/1", + integrations: [new BrowserTracing()], + environment: import.meta.env.VITE_SENTRY_ENV, + tracesSampleRate: 1.0, + }) +} ReactDOM.render( From 784e2fa4db7c0ff7d5ec4590b89dd3dd662ed3b4 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Thu, 3 Nov 2022 11:01:26 +0800 Subject: [PATCH 17/24] feat: update select panelConfig --- apps/builder/src/widgetLibrary/SelectWidget/panelConfig.tsx | 2 +- apps/builder/src/widgetLibrary/SelectWidget/select.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/builder/src/widgetLibrary/SelectWidget/panelConfig.tsx b/apps/builder/src/widgetLibrary/SelectWidget/panelConfig.tsx index 893c6078c4..306ac2cf19 100644 --- a/apps/builder/src/widgetLibrary/SelectWidget/panelConfig.tsx +++ b/apps/builder/src/widgetLibrary/SelectWidget/panelConfig.tsx @@ -155,7 +155,7 @@ export const SELECT_PANEL_CONFIG: PanelConfig[] = [ shown: (value) => !value, options: [ { label: i18n.t("widget.public.left"), value: "left" }, - { label: i18n.t("widget.public.right"), value: "right" }, + { label: i18n.t("widget.public.top"), value: "top" }, ], }, { diff --git a/apps/builder/src/widgetLibrary/SelectWidget/select.tsx b/apps/builder/src/widgetLibrary/SelectWidget/select.tsx index 410eb8aefc..bd91d7840f 100644 --- a/apps/builder/src/widgetLibrary/SelectWidget/select.tsx +++ b/apps/builder/src/widgetLibrary/SelectWidget/select.tsx @@ -32,7 +32,6 @@ export const WrappedSelect: FC = (props) => { const onChangeSelectValue = useCallback( (value: unknown) => { - console.log("value", value) new Promise((resolve) => { const message = getValidateMessage(value) handleUpdateMultiExecutionResult([ From ed430c471e35192a066bced35f7e56e9f8ed5b6b Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Thu, 3 Nov 2022 11:23:00 +0800 Subject: [PATCH 18/24] fix: update dateTime component height --- .../src/widgetLibrary/DateRangeWidget/dateRange.tsx | 9 ++------- .../src/widgetLibrary/DateTimeWidget/dateTime.tsx | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/apps/builder/src/widgetLibrary/DateRangeWidget/dateRange.tsx b/apps/builder/src/widgetLibrary/DateRangeWidget/dateRange.tsx index 1596f757b2..442677f3e1 100644 --- a/apps/builder/src/widgetLibrary/DateRangeWidget/dateRange.tsx +++ b/apps/builder/src/widgetLibrary/DateRangeWidget/dateRange.tsx @@ -148,12 +148,6 @@ export const DateRangeWidget: FC = (props) => { [getValidateMessage, handleUpdateDsl], ) - useEffect(() => { - if (wrapperRef.current) { - updateComponentHeight(wrapperRef.current?.clientHeight) - } - }, [labelPosition, validateMessage, updateComponentHeight]) - useEffect(() => { handleUpdateGlobalData(displayName, { startValue, @@ -215,7 +209,8 @@ export const DateRangeWidget: FC = (props) => { if (wrapperRef.current) { updateComponentHeight(wrapperRef.current?.clientHeight) } - }, [required, labelPosition, updateComponentHeight]) + }, [required, labelPosition, validateMessage, updateComponentHeight]) + return (
diff --git a/apps/builder/src/widgetLibrary/DateTimeWidget/dateTime.tsx b/apps/builder/src/widgetLibrary/DateTimeWidget/dateTime.tsx index ce175c2f73..da10808931 100644 --- a/apps/builder/src/widgetLibrary/DateTimeWidget/dateTime.tsx +++ b/apps/builder/src/widgetLibrary/DateTimeWidget/dateTime.tsx @@ -199,7 +199,7 @@ export const DateTimeWidget: FC = (props) => { }, [labelPosition, validateMessage, updateComponentHeight]) return ( -
+