You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/01/26 09:35:04 UTC
(incubator-answer) branch feat/1.2.5/ui updated: fix: className same to class_name
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch feat/1.2.5/ui
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/1.2.5/ui by this push:
new 0b95a1c4 fix: className same to class_name
0b95a1c4 is described below
commit 0b95a1c4fd7d6e5e17aab82eb35d0bab318e61d4
Author: shuai <li...@sifou.com>
AuthorDate: Fri Jan 26 17:34:53 2024 +0800
fix: className same to class_name
---
ui/src/components/SchemaForm/README.md | 3 ++-
ui/src/components/SchemaForm/index.tsx | 9 ++++++---
ui/src/components/SchemaForm/types.ts | 3 ++-
ui/src/pages/Admin/SettingsUsers/index.tsx | 2 +-
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ui/src/components/SchemaForm/README.md b/ui/src/components/SchemaForm/README.md
index c5e42e04..13149ae4 100644
--- a/ui/src/components/SchemaForm/README.md
+++ b/ui/src/components/SchemaForm/README.md
@@ -183,8 +183,9 @@ export interface BaseUIOptions {
empty?: string;
// Will be appended to the className of the form component itself
className?: classnames.Argument;
+ class_name?: classnames.Argument;
// The className that will be attached to a form field container
- fieldClassName?: classnames.Argument;
+ field_class_name?: classnames.Argument;
// Make a form component render into simplified mode
readOnly?: boolean;
simplify?: boolean;
diff --git a/ui/src/components/SchemaForm/index.tsx b/ui/src/components/SchemaForm/index.tsx
index cc251134..2bb91e31 100644
--- a/ui/src/components/SchemaForm/index.tsx
+++ b/ui/src/components/SchemaForm/index.tsx
@@ -260,16 +260,19 @@ const SchemaForm: ForwardRefRenderFunction<FormRef, FormProps> = (
uiSchema?.[key] || {};
formData ||= {};
const fieldState = formData[key];
+ if (uiOpt?.class_name) {
+ uiOpt.className = uiOpt.class_name;
+ }
const uiSimplify = widget === 'legend' || uiOpt?.simplify;
- let groupClassName: BaseUIOptions['fieldClassName'] = uiOpt?.simplify
+ let groupClassName: BaseUIOptions['field_class_name'] = uiOpt?.simplify
? 'mb-2'
: 'mb-3';
if (widget === 'legend') {
groupClassName = 'mb-0';
}
- if (uiOpt?.fieldClassName) {
- groupClassName = uiOpt.fieldClassName;
+ if (uiOpt?.field_class_name) {
+ groupClassName = uiOpt.field_class_name;
}
const readOnly = uiOpt?.readOnly || false;
diff --git a/ui/src/components/SchemaForm/types.ts b/ui/src/components/SchemaForm/types.ts
index 794761a0..8347b98f 100644
--- a/ui/src/components/SchemaForm/types.ts
+++ b/ui/src/components/SchemaForm/types.ts
@@ -58,8 +58,9 @@ export interface BaseUIOptions {
empty?: string;
// Will be appended to the className of the form component itself
className?: classnames.Argument;
+ class_name?: classnames.Argument;
// The className that will be attached to a **form field container**
- fieldClassName?: classnames.Argument;
+ field_class_name?: classnames.Argument;
// Make a form component render into simplified mode
readOnly?: boolean;
simplify?: boolean;
diff --git a/ui/src/pages/Admin/SettingsUsers/index.tsx b/ui/src/pages/Admin/SettingsUsers/index.tsx
index 106c5923..a83c2e3b 100644
--- a/ui/src/pages/Admin/SettingsUsers/index.tsx
+++ b/ui/src/pages/Admin/SettingsUsers/index.tsx
@@ -137,7 +137,7 @@ const Index: FC = () => {
'ui:widget': 'switch',
'ui:options': {
label: t('allow_update_location.label'),
- fieldClassName: 'mb-3',
+ field_class_name: 'mb-3',
simplify: true,
},
},