@rjsf/semantic-ui 6.6.0 → 6.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +82 -74
- package/dist/index.cjs.map +3 -3
- package/dist/semantic-ui.esm.js +89 -119
- package/dist/semantic-ui.esm.js.map +3 -3
- package/dist/semantic-ui.umd.js +79 -72
- package/lib/AddButton/AddButton.d.ts +2 -2
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +6 -6
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +6 -6
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +6 -6
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +1 -1
- package/lib/ErrorList/ErrorList.d.ts +1 -1
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/IconButton.d.ts +15 -8
- package/lib/IconButton/IconButton.js +14 -6
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +5 -7
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +5 -6
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SemanticUIForm/SemanticUIForm.d.ts +3 -3
- package/lib/SemanticUIForm/SemanticUIForm.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +6 -6
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -2
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.d.ts +7 -7
- package/lib/util.js +9 -3
- package/lib/util.js.map +1 -1
- package/package.json +8 -8
- package/src/AddButton/AddButton.tsx +5 -3
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -10
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -20
- package/src/CheckboxWidget/CheckboxWidget.tsx +12 -20
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +11 -14
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +3 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +2 -1
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/IconButton.tsx +18 -8
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -12
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +13 -16
- package/src/RangeWidget/RangeWidget.tsx +10 -9
- package/src/SelectWidget/SelectWidget.tsx +20 -18
- package/src/SemanticUIForm/SemanticUIForm.ts +4 -3
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +10 -16
- package/src/Theme/Theme.ts +2 -2
- package/src/TitleField/TitleField.tsx +1 -1
- package/src/Widgets/Widgets.tsx +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +6 -13
- package/src/util.tsx +17 -18
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { FocusEvent, SyntheticEvent } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ariaDescribedByIds,
|
|
4
|
-
enumOptionSelectedValue,
|
|
5
|
-
enumOptionValueDecoder,
|
|
6
|
-
enumOptionValueEncoder,
|
|
7
|
-
getOptionValueFormat,
|
|
8
|
-
labelValue,
|
|
1
|
+
import type { FocusEvent, SyntheticEvent } from 'react';
|
|
2
|
+
import type {
|
|
9
3
|
EnumOptionsType,
|
|
10
4
|
FormContextType,
|
|
11
5
|
OptionValueFormat,
|
|
@@ -14,8 +8,17 @@ import {
|
|
|
14
8
|
WidgetProps,
|
|
15
9
|
UIOptionsType,
|
|
16
10
|
} from '@rjsf/utils';
|
|
11
|
+
import {
|
|
12
|
+
ariaDescribedByIds,
|
|
13
|
+
enumOptionSelectedValue,
|
|
14
|
+
enumOptionValueDecoder,
|
|
15
|
+
enumOptionValueEncoder,
|
|
16
|
+
getOptionValueFormat,
|
|
17
|
+
labelValue,
|
|
18
|
+
} from '@rjsf/utils';
|
|
17
19
|
import map from 'lodash/map';
|
|
18
|
-
import {
|
|
20
|
+
import type { DropdownProps, DropdownItemProps } from 'semantic-ui-react';
|
|
21
|
+
import { Form } from 'semantic-ui-react';
|
|
19
22
|
|
|
20
23
|
import { getSemanticProps } from '../util';
|
|
21
24
|
|
|
@@ -36,7 +39,7 @@ function createDefaultValueOptionsForDropDown<S extends StrictRJSFSchema = RJSFS
|
|
|
36
39
|
) {
|
|
37
40
|
const disabledOptions = enumDisabled || [];
|
|
38
41
|
const options: DropdownItemProps[] = map(enumOptions, ({ label, value }, index) => ({
|
|
39
|
-
disabled: disabledOptions.
|
|
42
|
+
disabled: disabledOptions.includes(value),
|
|
40
43
|
key: label,
|
|
41
44
|
text: label,
|
|
42
45
|
value: enumOptionValueEncoder(value, index, format),
|
|
@@ -99,12 +102,11 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
99
102
|
placeholder,
|
|
100
103
|
optionValueFormat,
|
|
101
104
|
);
|
|
102
|
-
const
|
|
103
|
-
onChange(enumOptionValueDecoder<S>(
|
|
104
|
-
|
|
105
|
-
const _onBlur = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
|
|
105
|
+
const handleChange = (_: SyntheticEvent<HTMLElement>, { value: enumValue }: DropdownProps) =>
|
|
106
|
+
onChange(enumOptionValueDecoder<S>(enumValue as string[], enumOptions, optionValueFormat, optEmptyVal));
|
|
107
|
+
const handleBlur = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
|
|
106
108
|
onBlur(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
107
|
-
const
|
|
109
|
+
const handleFocus = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
|
|
108
110
|
onFocus(id, enumOptionValueDecoder<S>(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
109
111
|
return (
|
|
110
112
|
<Form.Dropdown
|
|
@@ -122,9 +124,9 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
122
124
|
autoFocus={autofocus}
|
|
123
125
|
readOnly={readonly}
|
|
124
126
|
options={dropdownOptions}
|
|
125
|
-
onChange={
|
|
126
|
-
onBlur={
|
|
127
|
-
onFocus={
|
|
127
|
+
onChange={handleChange}
|
|
128
|
+
onBlur={handleBlur}
|
|
129
|
+
onFocus={handleFocus}
|
|
128
130
|
aria-describedby={ariaDescribedByIds(id)}
|
|
129
131
|
/>
|
|
130
132
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { FormProps } from '@rjsf/core';
|
|
3
|
+
import { withTheme } from '@rjsf/core';
|
|
4
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
4
5
|
|
|
5
6
|
import { generateTheme } from '../Theme';
|
|
6
7
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
|
|
2
|
+
import { getSubmitButtonOptions } from '@rjsf/utils';
|
|
2
3
|
import { Button } from 'semantic-ui-react';
|
|
3
4
|
|
|
4
5
|
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
2
2
|
|
|
3
3
|
import AddButton from '../AddButton';
|
|
4
4
|
import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate';
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
labelValue,
|
|
5
|
-
FormContextType,
|
|
6
|
-
RJSFSchema,
|
|
7
|
-
StrictRJSFSchema,
|
|
8
|
-
WidgetProps,
|
|
9
|
-
} from '@rjsf/utils';
|
|
1
|
+
import type { ChangeEvent } from 'react';
|
|
2
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
3
|
+
import { ariaDescribedByIds, labelValue } from '@rjsf/utils';
|
|
10
4
|
import { Form } from 'semantic-ui-react';
|
|
11
5
|
|
|
12
6
|
import { getSemanticProps } from '../util';
|
|
@@ -43,11 +37,11 @@ export default function TextareaWidget<
|
|
|
43
37
|
options,
|
|
44
38
|
defaultSchemaProps: { inverted: 'false' },
|
|
45
39
|
});
|
|
46
|
-
//
|
|
47
|
-
const
|
|
40
|
+
// oxlint-disable-next-line no-shadow
|
|
41
|
+
const handleChange = ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) =>
|
|
48
42
|
onChange && onChange(value === '' ? options.emptyValue : value);
|
|
49
|
-
const
|
|
50
|
-
const
|
|
43
|
+
const handleBlur = () => onBlur && onBlur(id, value);
|
|
44
|
+
const handleFocus = () => onFocus && onFocus(id, value);
|
|
51
45
|
return (
|
|
52
46
|
<Form.TextArea
|
|
53
47
|
id={id}
|
|
@@ -62,9 +56,9 @@ export default function TextareaWidget<
|
|
|
62
56
|
value={value || ''}
|
|
63
57
|
error={rawErrors.length > 0}
|
|
64
58
|
rows={options.rows || 5}
|
|
65
|
-
onChange={
|
|
66
|
-
onBlur={
|
|
67
|
-
onFocus={
|
|
59
|
+
onChange={handleChange}
|
|
60
|
+
onBlur={handleBlur}
|
|
61
|
+
onFocus={handleFocus}
|
|
68
62
|
aria-describedby={ariaDescribedByIds(id)}
|
|
69
63
|
/>
|
|
70
64
|
);
|
package/src/Theme/Theme.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ThemeProps } from '@rjsf/core';
|
|
2
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { ThemeProps } from '@rjsf/core';
|
|
2
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
3
|
import { Form as SuiForm } from 'semantic-ui-react';
|
|
4
4
|
|
|
5
5
|
import { generateTemplates } from '../Templates';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
import { Grid, Header } from 'semantic-ui-react';
|
|
3
3
|
|
|
4
4
|
import { getSemanticProps } from '../util';
|
package/src/Widgets/Widgets.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
|
|
3
3
|
import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget';
|
|
4
4
|
import CheckboxWidget from '../CheckboxWidget/CheckboxWidget';
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
buttonId,
|
|
4
|
-
FormContextType,
|
|
5
|
-
RJSFSchema,
|
|
6
|
-
StrictRJSFSchema,
|
|
7
|
-
TranslatableString,
|
|
8
|
-
WrapIfAdditionalTemplateProps,
|
|
9
|
-
} from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, WrapIfAdditionalTemplateProps } from '@rjsf/utils';
|
|
2
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString } from '@rjsf/utils';
|
|
10
3
|
import { Form, Grid } from 'semantic-ui-react';
|
|
11
4
|
|
|
12
5
|
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
@@ -64,17 +57,17 @@ export default function WrapIfAdditionalTemplate<
|
|
|
64
57
|
className='form-group'
|
|
65
58
|
hasFeedback
|
|
66
59
|
fluid
|
|
67
|
-
htmlFor={
|
|
60
|
+
htmlFor={id}
|
|
68
61
|
label={displayLabel ? keyLabel : undefined}
|
|
69
62
|
required={required}
|
|
70
63
|
defaultValue={label}
|
|
71
64
|
disabled={disabled || (readonlyAsDisabled && readonly)}
|
|
72
|
-
id={
|
|
73
|
-
name={
|
|
65
|
+
id={id}
|
|
66
|
+
name={id}
|
|
74
67
|
onBlur={!readonly ? onKeyRenameBlur : undefined}
|
|
75
68
|
style={wrapperStyle}
|
|
76
69
|
type='text'
|
|
77
|
-
|
|
70
|
+
/>
|
|
78
71
|
</Form.Group>
|
|
79
72
|
</Grid.Column>
|
|
80
73
|
<Grid.Column width={7} className='form-additional' verticalAlign='middle'>
|
package/src/util.tsx
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
import type {
|
|
3
3
|
UiSchema,
|
|
4
4
|
GenericObjectType,
|
|
5
|
-
getUiOptions,
|
|
6
5
|
FormContextType,
|
|
7
6
|
RJSFSchema,
|
|
8
7
|
StrictRJSFSchema,
|
|
9
8
|
UIOptionsType,
|
|
10
9
|
} from '@rjsf/utils';
|
|
10
|
+
import { getUiOptions } from '@rjsf/utils';
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export interface SemanticPropsTypes<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> {
|
|
13
13
|
formContext?: F;
|
|
14
14
|
uiSchema?: UiSchema<T, S, F>;
|
|
15
15
|
options?: UIOptionsType<T, S, F>;
|
|
16
16
|
defaultSchemaProps?: GenericObjectType;
|
|
17
17
|
defaultContextProps?: GenericObjectType;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
export
|
|
20
|
+
export interface SemanticErrorPropsType<
|
|
21
21
|
T = any,
|
|
22
22
|
S extends StrictRJSFSchema = RJSFSchema,
|
|
23
23
|
F extends FormContextType = any,
|
|
24
|
-
>
|
|
24
|
+
> {
|
|
25
25
|
formContext?: F;
|
|
26
26
|
uiSchema?: UiSchema<T, S, F>;
|
|
27
27
|
options?: UIOptionsType<T, S, F>;
|
|
28
28
|
defaultProps?: GenericObjectType;
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
|
|
31
31
|
export type WrapProps = GenericObjectType & {
|
|
32
32
|
wrap: boolean;
|
|
@@ -55,14 +55,13 @@ export function getSemanticProps<T = any, S extends StrictRJSFSchema = RJSFSchem
|
|
|
55
55
|
const schemaProps = getUiOptions<T, S, F>(uiSchema).semantic;
|
|
56
56
|
const optionProps = options.semantic;
|
|
57
57
|
// formContext props should overide other props
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
58
|
+
return {
|
|
59
|
+
...defaultSchemaProps,
|
|
60
|
+
...defaultContextProps,
|
|
61
|
+
...schemaProps,
|
|
62
|
+
...optionProps,
|
|
63
|
+
...formContextProps,
|
|
64
|
+
};
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
/**
|
|
@@ -89,7 +88,7 @@ export function getSemanticErrorProps<
|
|
|
89
88
|
const schemaProps = semanticOptions && semanticOptions.errorOptions;
|
|
90
89
|
const optionProps = options.semantic && (options.semantic as GenericObjectType).errorOptions;
|
|
91
90
|
|
|
92
|
-
return
|
|
91
|
+
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
/**
|
|
@@ -101,7 +100,7 @@ export function getSemanticErrorProps<
|
|
|
101
100
|
* @param {Array} omit
|
|
102
101
|
* @returns {string}
|
|
103
102
|
*/
|
|
104
|
-
export function cleanClassNames(classNameArr:
|
|
103
|
+
export function cleanClassNames(classNameArr: (string | undefined)[], omit: string[] = []) {
|
|
105
104
|
// Split each arg on whitespace, and add it to an array. Skip false-y args
|
|
106
105
|
// like "" and undefined.
|
|
107
106
|
const classList = classNameArr
|