-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3723 from illacloud/feat/add-signature-widget-aft…
…er-mobile feat: add signature
- Loading branch information
Showing
18 changed files
with
1,564 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
apps/builder/src/widgetLibrary/Mobile/SignatureWidget/eventHandlerConfig.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import i18n from "@/i18n/config" | ||
import { EventHandlerConfig } from "@/widgetLibrary/interface" | ||
|
||
export const SIGNATURE_EVENT_HANDLER_CONFIG: EventHandlerConfig = { | ||
events: [ | ||
{ | ||
label: i18n.t( | ||
"editor.inspect.setter_content.widget_action_type_name.change", | ||
), | ||
value: "change", | ||
}, | ||
], | ||
methods: ["clearValue", "validate", "clearValidation", "setDisabled"], | ||
} |
3 changes: 3 additions & 0 deletions
3
apps/builder/src/widgetLibrary/Mobile/SignatureWidget/index.tsx
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { SIGNATURE_WIDGET_CONFIG } from "./widgetConfig" | ||
export { SIGNATURE_PANEL_CONFIG } from "./panelConfig" | ||
export { SIGNATURE_EVENT_HANDLER_CONFIG } from "./eventHandlerConfig" |
27 changes: 27 additions & 0 deletions
27
apps/builder/src/widgetLibrary/Mobile/SignatureWidget/interface.tsx
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { PADDING_MODE } from "@illa-public/public-types" | ||
import { ValidateMessageOldProps } from "@/widgetLibrary/PC/PublicSector/InvalidMessage/interface" | ||
import LabelProps from "@/widgetLibrary/PC/PublicSector/Label/interface" | ||
import { TooltipWrapperProps } from "@/widgetLibrary/PC/PublicSector/TooltipWrapper/interface" | ||
import { BaseWidgetProps } from "@/widgetLibrary/interface" | ||
|
||
export interface WrappedSignatureProps { | ||
penColor?: string | ||
guideColor?: string | ||
text?: string | ||
disabled?: boolean | ||
value?: string | ||
handleUpdateSignature: (value?: string, dataURI?: string) => void | ||
} | ||
|
||
export interface SignatureWidgetProps | ||
extends WrappedSignatureProps, | ||
BaseWidgetProps, | ||
LabelProps, | ||
TooltipWrapperProps, | ||
Omit<ValidateMessageOldProps, "value"> { | ||
validateMessage: string | ||
padding?: { | ||
size: string | ||
mode: PADDING_MODE | ||
} | ||
} |
268 changes: 268 additions & 0 deletions
268
apps/builder/src/widgetLibrary/Mobile/SignatureWidget/panelConfig.tsx
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 |
---|---|---|
@@ -0,0 +1,268 @@ | ||
import { HorizontalEndIcon, HorizontalStartIcon } from "@illa-design/react" | ||
import RadioIcon from "@/assets/radius-icon.svg?react" | ||
import i18n from "@/i18n/config" | ||
import { PanelConfig } from "@/page/App/components/InspectPanel/interface" | ||
import { VALIDATION_TYPES } from "@/utils/validationFactory" | ||
import { generatorEventHandlerConfig } from "@/widgetLibrary/PC/PublicSector/utils/generatorEventHandlerConfig" | ||
import { SIGNATURE_EVENT_HANDLER_CONFIG } from "./eventHandlerConfig" | ||
|
||
const baseWidgetName = "signature" | ||
export const SIGNATURE_PANEL_CONFIG: PanelConfig[] = [ | ||
{ | ||
id: `${baseWidgetName}-basic`, | ||
groupName: i18n.t("editor.inspect.setter_group.basic"), | ||
children: [ | ||
{ | ||
id: `${baseWidgetName}-basic-Text`, | ||
labelName: i18n.t("editor.inspect.setter_label.text"), | ||
attrName: "text", | ||
setterType: "INPUT_SETTER", | ||
expectedType: VALIDATION_TYPES.STRING, | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-label`, | ||
groupName: i18n.t("editor.inspect.setter_group.label"), | ||
children: [ | ||
{ | ||
id: `${baseWidgetName}-label-label`, | ||
labelName: i18n.t("editor.inspect.setter_label.label"), | ||
attrName: "label", | ||
setterType: "INPUT_SETTER", | ||
expectedType: VALIDATION_TYPES.STRING, | ||
}, | ||
{ | ||
id: `${baseWidgetName}-label-caption`, | ||
labelName: i18n.t("editor.inspect.setter_label.caption"), | ||
attrName: "labelCaption", | ||
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"), | ||
attrName: "labelPosition", | ||
setterType: "RADIO_GROUP_SETTER", | ||
bindAttrName: ["labelHidden"], | ||
shown: (value) => !value, | ||
options: [ | ||
{ label: i18n.t("widget.public.left"), value: "left" }, | ||
{ label: i18n.t("widget.public.top"), value: "top" }, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-label-alignment`, | ||
labelName: i18n.t("editor.inspect.setter_label.label_alignment"), | ||
attrName: "labelAlign", | ||
setterType: "RADIO_GROUP_SETTER", | ||
bindAttrName: ["labelHidden"], | ||
shown: (value) => !value, | ||
options: [ | ||
{ | ||
label: <HorizontalStartIcon />, | ||
value: "left", | ||
}, | ||
{ | ||
label: <HorizontalEndIcon />, | ||
value: "right", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-label-labelWidth`, | ||
labelName: i18n.t("editor.inspect.setter_label.label_width"), | ||
attrName: "labelWidth", | ||
expectedType: VALIDATION_TYPES.NUMBER, | ||
setterType: "INPUT_SETTER", | ||
bindAttrName: ["labelHidden", "labelPosition"], | ||
shown: (hidden, position) => !hidden && position !== "top", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-interaction`, | ||
groupName: i18n.t("editor.inspect.setter_group.interaction"), | ||
children: [ | ||
{ | ||
...generatorEventHandlerConfig( | ||
baseWidgetName, | ||
SIGNATURE_EVENT_HANDLER_CONFIG.events, | ||
), | ||
}, | ||
{ | ||
id: `${baseWidgetName}-interaction-disabled`, | ||
labelName: i18n.t("editor.inspect.setter_label.disabled"), | ||
labelDesc: i18n.t("editor.inspect.setter_tooltip.disabled"), | ||
placeholder: "{{false}}", | ||
attrName: "disabled", | ||
setterType: "INPUT_SETTER", | ||
expectedType: VALIDATION_TYPES.BOOLEAN, | ||
bindAttrName: ["submit"], | ||
shown: (value) => !value, | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-adornments`, | ||
groupName: i18n.t("editor.inspect.setter_group.adornments"), | ||
children: [ | ||
{ | ||
id: `${baseWidgetName}-adornments-tooltip`, | ||
labelName: i18n.t("editor.inspect.setter_label.tooltip"), | ||
labelDesc: i18n.t("editor.inspect.setter_tooltip.tooltip"), | ||
attrName: "tooltipText", | ||
expectedType: VALIDATION_TYPES.STRING, | ||
setterType: "INPUT_SETTER", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-validation`, | ||
groupName: i18n.t("editor.inspect.setter_group.validation"), | ||
children: [ | ||
{ | ||
id: `${baseWidgetName}-validation-required`, | ||
labelName: i18n.t("editor.inspect.setter_label.required_field"), | ||
labelDesc: i18n.t("editor.inspect.setter_tooltip.required_field"), | ||
setterType: "DYNAMIC_SWITCH_SETTER", | ||
expectedType: VALIDATION_TYPES.BOOLEAN, | ||
useCustomLayout: true, | ||
openDynamic: true, | ||
attrName: "required", | ||
}, | ||
{ | ||
id: `${baseWidgetName}-validation-custom`, | ||
labelName: i18n.t("editor.inspect.setter_label.custom_rule"), | ||
labelDesc: i18n.t("editor.inspect.setter_tooltip.custom_rule"), | ||
setterType: "INPUT_SETTER", | ||
attrName: "customRule", | ||
expectedType: VALIDATION_TYPES.STRING, | ||
}, | ||
{ | ||
id: `${baseWidgetName}-validation-hide-message`, | ||
labelName: i18n.t( | ||
"editor.inspect.setter_label.hide_validation_message", | ||
), | ||
labelDesc: i18n.t( | ||
"editor.inspect.setter_tooltip.hide_validation_message", | ||
), | ||
setterType: "DYNAMIC_SWITCH_SETTER", | ||
expectedType: VALIDATION_TYPES.BOOLEAN, | ||
useCustomLayout: true, | ||
openDynamic: true, | ||
attrName: "hideValidationMessage", | ||
}, | ||
{ | ||
id: `${baseWidgetName}-validation-form-data-key`, | ||
labelName: i18n.t("editor.inspect.setter_label.form_data_key"), | ||
labelDesc: i18n.t("editor.inspect.setter_tooltip.form_data_key"), | ||
setterType: "INPUT_SETTER", | ||
expectedType: VALIDATION_TYPES.STRING, | ||
attrName: "formDataKey", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-layout`, | ||
groupName: i18n.t("editor.inspect.setter_group.layout"), | ||
children: [ | ||
{ | ||
id: `${baseWidgetName}-layout-hidden`, | ||
setterType: "DYNAMIC_SWITCH_SETTER", | ||
openDynamic: true, | ||
labelName: i18n.t("editor.inspect.setter_label.hidden"), | ||
labelDesc: i18n.t("editor.inspect.setter_tooltip.hidden"), | ||
useCustomLayout: true, | ||
attrName: "hidden", | ||
expectedType: VALIDATION_TYPES.BOOLEAN, | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-style`, | ||
groupName: i18n.t("editor.inspect.setter_group.style"), | ||
children: [ | ||
{ | ||
id: `${baseWidgetName}-styles-border`, | ||
setterType: "BORDER_SETTER", | ||
useCustomLayout: true, | ||
attrName: "border", | ||
}, | ||
{ | ||
id: `${baseWidgetName}-styles-style`, | ||
setterType: "STYLE_CONTAINER_SETTER", | ||
labelName: i18n.t("editor.inspect.setter_label.style"), | ||
attrName: "style", | ||
useCustomLayout: true, | ||
childrenSetter: [ | ||
{ | ||
id: `${baseWidgetName}-style-radius`, | ||
labelName: i18n.t("editor.inspect.setter_label.radius"), | ||
attrName: "radius", | ||
setterType: "MEASURE_CHECK_INPUT_SETTER", | ||
useCustomLayout: true, | ||
icon: <RadioIcon />, | ||
defaultValue: "4px", | ||
}, | ||
{ | ||
id: `${baseWidgetName}-style-shadow`, | ||
labelName: i18n.t("editor.inspect.setter_label.shadow.shadow"), | ||
attrName: "shadow", | ||
setterType: "SHADOW_SELECT_SETTER", | ||
useCustomLayout: true, | ||
defaultValue: "small", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-style-list`, | ||
setterType: "STYLE_CONTAINER_SETTER", | ||
labelName: i18n.t("editor.inspect.setter_label.colors"), | ||
attrName: "styles", | ||
useCustomLayout: true, | ||
childrenSetter: [ | ||
{ | ||
id: `${baseWidgetName}-style-background`, | ||
labelName: i18n.t("editor.inspect.setter_label.background"), | ||
attrName: "backgroundColor", | ||
setterType: "COLOR_PICKER_SETTER", | ||
useCustomLayout: true, | ||
defaultValue: "#ffffffff", | ||
}, | ||
// TODO: WTF i18n | ||
{ | ||
id: `${baseWidgetName}-style-penColor`, | ||
labelName: i18n.t("penColor"), | ||
attrName: "penColor", | ||
setterType: "COLOR_PICKER_SETTER", | ||
useCustomLayout: true, | ||
defaultValue: "grayBlue", | ||
}, | ||
{ | ||
id: `${baseWidgetName}-style-contentColor`, | ||
labelName: i18n.t("contentColor"), | ||
attrName: "guideColor", | ||
setterType: "COLOR_PICKER_SETTER", | ||
useCustomLayout: true, | ||
defaultValue: "grayBlue", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: `${baseWidgetName}-styles-padding`, | ||
setterType: "PADDING_INPUT_SETTER", | ||
labelName: i18n.t("editor.inspect.setter_group.padding"), | ||
attrName: "padding", | ||
useCustomLayout: true, | ||
}, | ||
], | ||
}, | ||
] |
Oops, something went wrong.