Skip to content

Commit

Permalink
Merge pull request #1503 from alibaba/fix-validateTrigger
Browse files Browse the repository at this point in the history
Fix validate trigger
  • Loading branch information
lhbxs authored Mar 23, 2024
2 parents 142fba0 + e7f1f3b commit 001ae85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/form-render/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-render",
"version": "2.4.1",
"version": "2.4.2",
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
"keywords": [
"Form",
Expand Down
3 changes: 2 additions & 1 deletion packages/form-render/src/render-core/FieldItem/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export default (props: any) => {
const initialValue = schema.default ?? schema.defaultValue;
const classRest = { 'fr-hide-label': label === 'fr-hide-label', 'fr-inline-field': inlineSelf, 'fr-field-visibility': !visible, [schema.className] : !! schema.className };

debugger;
const formItem = (
<Form.Item
className={classnames('fr-field', classRest)}
Expand All @@ -190,7 +191,7 @@ export default (props: any) => {
wrapperCol={fieldCol}
noStyle={noStyle}
dependencies={dependencies}
validateTrigger={ validateTrigger ?? fieldRef?.current?.validator ? 'onSubmit' : 'onChange' }
validateTrigger={ validateTrigger ?? (fieldRef?.current?.validator ? 'onSubmit' : 'onChange') }
>
{fieldProps.onStatusChange ? (
<FieldWrapperStatus
Expand Down
4 changes: 2 additions & 2 deletions packages/form-render/src/widgets/fields/html/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export default function html({ value, checked, options, schema = {} } : any) {
let __html = '-';

if (schema.type === 'boolean') {
__html = checked === true || value===true ? '✔' : '✘';
__html = (value === true || checked === true) ? '✔' : '✘';
} else if (options?.length > 0) {
if (['string', 'number'].indexOf(typeof value) > -1) {
const item = options.find(item => item.value === value);
const item = options.find((item: any) => item.value === value);
__html = item?.label || '-';

} else if (Array.isArray(value)) {
Expand Down

0 comments on commit 001ae85

Please sign in to comment.