@rjsf/semantic-ui 6.6.2 → 6.7.0
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/LICENSE.md +201 -0
- package/dist/index.cjs +206 -187
- package/dist/index.cjs.map +4 -4
- package/dist/semantic-ui.esm.js +139 -118
- package/dist/semantic-ui.esm.js.map +4 -4
- package/dist/semantic-ui.umd.js +54 -40
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +2 -2
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +4 -4
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.d.ts +6 -0
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js +14 -0
- package/lib/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.js.map +1 -0
- package/lib/CyclicSchemaExpandTemplate/index.d.ts +2 -0
- package/lib/CyclicSchemaExpandTemplate/index.js +3 -0
- package/lib/CyclicSchemaExpandTemplate/index.js.map +1 -0
- package/lib/DescriptionField/DescriptionField.d.ts +1 -1
- package/lib/ErrorList/ErrorList.d.ts +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/IconButton.d.ts +6 -6
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +3 -3
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +6 -5
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +1 -1
- package/lib/Templates/Templates.js +2 -0
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +3 -3
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/util.js +4 -3
- package/lib/util.js.map +1 -1
- package/package.json +25 -23
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +2 -2
- package/src/CheckboxWidget/CheckboxWidget.tsx +4 -4
- package/src/CyclicSchemaExpandTemplate/CyclicSchemaExpandTemplate.tsx +25 -0
- package/src/CyclicSchemaExpandTemplate/index.ts +2 -0
- package/src/RangeWidget/RangeWidget.tsx +3 -3
- package/src/SelectWidget/SelectWidget.tsx +28 -22
- package/src/Templates/Templates.ts +2 -0
- package/src/TextareaWidget/TextareaWidget.tsx +3 -3
- package/src/util.tsx +3 -3
package/lib/util.js
CHANGED
|
@@ -34,10 +34,11 @@ export function getSemanticProps({ formContext = {}, uiSchema = {}, options = {}
|
|
|
34
34
|
* @returns {any}
|
|
35
35
|
*/
|
|
36
36
|
export function getSemanticErrorProps({ formContext = {}, uiSchema = {}, options = {}, defaultProps = { size: 'small', pointing: 'above' }, }) {
|
|
37
|
-
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const formContextProps = (_a = formContext.semantic) === null || _a === void 0 ? void 0 : _a.errorOptions;
|
|
38
39
|
const semanticOptions = getUiOptions(uiSchema).semantic;
|
|
39
|
-
const schemaProps = semanticOptions
|
|
40
|
-
const optionProps = options.semantic
|
|
40
|
+
const schemaProps = semanticOptions === null || semanticOptions === void 0 ? void 0 : semanticOptions.errorOptions;
|
|
41
|
+
const optionProps = (_b = options.semantic) === null || _b === void 0 ? void 0 : _b.errorOptions;
|
|
41
42
|
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
42
43
|
}
|
|
43
44
|
/**
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA0B3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAoF,EAClH,WAAW,GAAG,EAAO,EACrB,QAAQ,GAAG,EAAE,EACb,OAAO,GAAG,EAAE,EACZ,kBAAkB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EACrD,mBAAmB,GAAG,EAAE,GACI;IAC5B,MAAM,gBAAgB,GAAG,WAAW,CAAC,QAAQ,CAAC;IAC9C,MAAM,WAAW,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC,QAAQ,CAAC;IAC7D,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrC,+CAA+C;IAC/C,OAAO;QACL,GAAG,kBAAkB;QACrB,GAAG,mBAAmB;QACtB,GAAG,WAAW;QACd,GAAG,WAAW;QACd,GAAG,gBAAgB;KACpB,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU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/index.d.ts",
|
|
@@ -42,19 +42,6 @@
|
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=20"
|
|
44
44
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build:ts": "tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
47
|
-
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --sourcemap --packages=external --format=cjs",
|
|
48
|
-
"build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/semantic-ui.esm.js --sourcemap --packages=external --format=esm",
|
|
49
|
-
"build:umd": "rollup dist/semantic-ui.esm.js --format=umd --file=dist/semantic-ui.umd.js --name=@rjsf/semantic-ui",
|
|
50
|
-
"build": "npm run build:ts && npm run build:cjs && npm run build:esm && npm run build:umd",
|
|
51
|
-
"cs-check": "oxfmt --check \"{src,test}/**/*.{ts,tsx}\"",
|
|
52
|
-
"cs-format": "oxfmt \"{src,test}/**/*.{ts,tsx}\"",
|
|
53
|
-
"lint": "oxlint src test",
|
|
54
|
-
"precommit": "lint-staged",
|
|
55
|
-
"test": "vitest run",
|
|
56
|
-
"test:update": "vitest run --update"
|
|
57
|
-
},
|
|
58
45
|
"lint-staged": {
|
|
59
46
|
"{src,test}/**/*.ts(x)": [
|
|
60
47
|
"oxlint --fix",
|
|
@@ -62,18 +49,18 @@
|
|
|
62
49
|
]
|
|
63
50
|
},
|
|
64
51
|
"peerDependencies": {
|
|
65
|
-
"@rjsf/core": "^6.6.x",
|
|
66
|
-
"@rjsf/utils": "^6.6.x",
|
|
67
52
|
"react": ">=18",
|
|
68
|
-
"semantic-ui-react": "^2.1.3"
|
|
53
|
+
"semantic-ui-react": "^2.1.3",
|
|
54
|
+
"@rjsf/core": "^6.7.0",
|
|
55
|
+
"@rjsf/utils": "^6.7.0"
|
|
69
56
|
},
|
|
70
57
|
"devDependencies": {
|
|
71
|
-
"@rjsf/core": "6.6.2",
|
|
72
|
-
"@rjsf/snapshot-tests": "6.6.2",
|
|
73
|
-
"@rjsf/utils": "6.6.2",
|
|
74
|
-
"@rjsf/validator-ajv8": "6.6.2",
|
|
75
58
|
"atob": "^2.1.2",
|
|
76
|
-
"semantic-ui-react": "^2.1.5"
|
|
59
|
+
"semantic-ui-react": "^2.1.5",
|
|
60
|
+
"@rjsf/snapshot-tests": "^6.7.0",
|
|
61
|
+
"@rjsf/core": "^6.7.0",
|
|
62
|
+
"@rjsf/utils": "^6.7.0",
|
|
63
|
+
"@rjsf/validator-ajv8": "^6.7.0"
|
|
77
64
|
},
|
|
78
65
|
"publishConfig": {
|
|
79
66
|
"access": "public"
|
|
@@ -100,6 +87,21 @@
|
|
|
100
87
|
},
|
|
101
88
|
"license": "Apache-2.0",
|
|
102
89
|
"dependencies": {
|
|
90
|
+
"@fluentui/react-component-ref": "^0.63.1",
|
|
91
|
+
"lodash": "^4.18.1",
|
|
103
92
|
"semantic-ui-css": "^2.5.0"
|
|
93
|
+
},
|
|
94
|
+
"scripts": {
|
|
95
|
+
"build:ts": "tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
96
|
+
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --sourcemap --packages=external --format=cjs",
|
|
97
|
+
"build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/semantic-ui.esm.js --sourcemap --packages=external --format=esm",
|
|
98
|
+
"build:umd": "rollup dist/semantic-ui.esm.js --format=umd --file=dist/semantic-ui.umd.js --name=@rjsf/semantic-ui",
|
|
99
|
+
"build": "pnpm run build:ts && pnpm run build:cjs && pnpm run build:esm && pnpm run build:umd",
|
|
100
|
+
"cs-check": "oxfmt --check \"{src,test}/**/*.{ts,tsx}\"",
|
|
101
|
+
"cs-format": "oxfmt \"{src,test}/**/*.{ts,tsx}\"",
|
|
102
|
+
"lint": "oxlint src test",
|
|
103
|
+
"precommit": "lint-staged",
|
|
104
|
+
"test": "vitest run",
|
|
105
|
+
"test:update": "vitest run --update"
|
|
104
106
|
}
|
|
105
|
-
}
|
|
107
|
+
}
|
|
@@ -49,8 +49,8 @@ export default function BaseInputTemplate<
|
|
|
49
49
|
});
|
|
50
50
|
const handleChange = ({ target: { value: newValue } }: ChangeEvent<HTMLInputElement>) =>
|
|
51
51
|
onChange(newValue === '' ? options.emptyValue : newValue);
|
|
52
|
-
const handleBlur = () => onBlur
|
|
53
|
-
const handleFocus = () => onFocus
|
|
52
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
53
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
54
54
|
const handleClear = useCallback(
|
|
55
55
|
(e: MouseEvent) => {
|
|
56
56
|
e.preventDefault();
|
|
@@ -22,7 +22,7 @@ export default function CheckboxWidget<
|
|
|
22
22
|
value,
|
|
23
23
|
disabled,
|
|
24
24
|
readonly,
|
|
25
|
-
label
|
|
25
|
+
label,
|
|
26
26
|
hideLabel,
|
|
27
27
|
autofocus,
|
|
28
28
|
onChange,
|
|
@@ -52,9 +52,9 @@ export default function CheckboxWidget<
|
|
|
52
52
|
// "const" or "enum" keywords
|
|
53
53
|
const required = schemaRequiresTrueValue<S>(schema);
|
|
54
54
|
const checked = value === 'true' || value === true;
|
|
55
|
-
const handleChange = (_: FormEvent<HTMLInputElement>, data: CheckboxProps) => onChange
|
|
56
|
-
const handleBlur: React.FocusEventHandler<HTMLInputElement> = () => onBlur
|
|
57
|
-
const handleFocus: React.FocusEventHandler<HTMLInputElement> = () => onFocus
|
|
55
|
+
const handleChange = (_: FormEvent<HTMLInputElement>, data: CheckboxProps) => onChange?.(data.checked);
|
|
56
|
+
const handleBlur: React.FocusEventHandler<HTMLInputElement> = () => onBlur?.(id, value);
|
|
57
|
+
const handleFocus: React.FocusEventHandler<HTMLInputElement> = () => onFocus?.(id, value);
|
|
58
58
|
const description = options.description ?? schema.description;
|
|
59
59
|
|
|
60
60
|
return (
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CyclicSchemaExpandProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
import { ID_KEY, TranslatableString } from '@rjsf/utils';
|
|
3
|
+
import { Button } from 'semantic-ui-react';
|
|
4
|
+
|
|
5
|
+
/** The `CyclicSchemaExpandTemplate` is the template to use to render the cyclic schema expand message and controls
|
|
6
|
+
*
|
|
7
|
+
* @param props - The `CyclicSchemaExpandProps` for this component
|
|
8
|
+
*/
|
|
9
|
+
export default function CyclicSchemaExpandTemplate<
|
|
10
|
+
T = any,
|
|
11
|
+
S extends StrictRJSFSchema = RJSFSchema,
|
|
12
|
+
F extends FormContextType = any,
|
|
13
|
+
>(props: CyclicSchemaExpandProps<T, S, F>) {
|
|
14
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
15
|
+
const { translateString } = registry;
|
|
16
|
+
const buttonId = `${fieldPathId[ID_KEY]}-button`;
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ marginTop: '1rem', marginBottom: '1rem' }}>
|
|
19
|
+
<p style={{ color: 'red' }}>{translateString(TranslatableString.CycleDetected, [name])}</p>
|
|
20
|
+
<Button id={buttonId} type='button' size='mini' onClick={() => onExpand(fieldPathId[ID_KEY])}>
|
|
21
|
+
{translateString(TranslatableString.ExpandButton)}
|
|
22
|
+
</Button>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -39,9 +39,9 @@ export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSc
|
|
|
39
39
|
|
|
40
40
|
// oxlint-disable-next-line no-shadow
|
|
41
41
|
const handleChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) =>
|
|
42
|
-
onChange
|
|
43
|
-
const handleBlur = () => onBlur
|
|
44
|
-
const handleFocus = () => onFocus
|
|
42
|
+
onChange?.(value === '' ? options.emptyValue : value);
|
|
43
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
44
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<>
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
enumOptionValueEncoder,
|
|
16
16
|
getOptionValueFormat,
|
|
17
17
|
labelValue,
|
|
18
|
+
logUnsupportedDefaultForEnum,
|
|
19
|
+
SelectedOptionDescription,
|
|
18
20
|
} from '@rjsf/utils';
|
|
19
21
|
import map from 'lodash/map';
|
|
20
22
|
import type { DropdownProps, DropdownItemProps } from 'semantic-ui-react';
|
|
@@ -95,6 +97,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
95
97
|
const emptyValue = multiple ? [] : '';
|
|
96
98
|
const optionValueFormat = getOptionValueFormat(options);
|
|
97
99
|
const showPlaceholderOption = !multiple && schema.default === undefined;
|
|
100
|
+
logUnsupportedDefaultForEnum<S>(id, schema, enumOptions, multiple);
|
|
98
101
|
const dropdownOptions = createDefaultValueOptionsForDropDown<S>(
|
|
99
102
|
enumOptions,
|
|
100
103
|
enumDisabled,
|
|
@@ -105,29 +108,32 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
|
|
|
105
108
|
const handleChange = (_: SyntheticEvent<HTMLElement>, { value: enumValue }: DropdownProps) =>
|
|
106
109
|
onChange(enumOptionValueDecoder<S>(enumValue as string[], enumOptions, optionValueFormat, optEmptyVal));
|
|
107
110
|
const handleBlur = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
|
|
108
|
-
onBlur(id, enumOptionValueDecoder<S>(target
|
|
111
|
+
onBlur(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
109
112
|
const handleFocus = (_: FocusEvent<HTMLElement>, { target }: DropdownProps) =>
|
|
110
|
-
onFocus(id, enumOptionValueDecoder<S>(target
|
|
113
|
+
onFocus(id, enumOptionValueDecoder<S>(target?.value, enumOptions, optionValueFormat, optEmptyVal));
|
|
111
114
|
return (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
<>
|
|
116
|
+
<Form.Dropdown
|
|
117
|
+
key={id}
|
|
118
|
+
id={id}
|
|
119
|
+
name={htmlName || id}
|
|
120
|
+
label={labelValue(label || undefined, hideLabel, false)}
|
|
121
|
+
multiple={typeof multiple === 'undefined' ? false : multiple}
|
|
122
|
+
value={enumOptionSelectedValue<S>(value, enumOptions, !!multiple, optionValueFormat, emptyValue)}
|
|
123
|
+
error={rawErrors.length > 0}
|
|
124
|
+
disabled={disabled}
|
|
125
|
+
placeholder={placeholder}
|
|
126
|
+
{...semanticProps}
|
|
127
|
+
required={required}
|
|
128
|
+
autoFocus={autofocus}
|
|
129
|
+
readOnly={readonly}
|
|
130
|
+
options={dropdownOptions}
|
|
131
|
+
onChange={handleChange}
|
|
132
|
+
onBlur={handleBlur}
|
|
133
|
+
onFocus={handleFocus}
|
|
134
|
+
aria-describedby={ariaDescribedByIds(id)}
|
|
135
|
+
/>
|
|
136
|
+
<SelectedOptionDescription {...props} />
|
|
137
|
+
</>
|
|
132
138
|
);
|
|
133
139
|
}
|
|
@@ -4,6 +4,7 @@ import AddButton from '../AddButton';
|
|
|
4
4
|
import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate';
|
|
5
5
|
import ArrayFieldTemplate from '../ArrayFieldTemplate';
|
|
6
6
|
import BaseInputTemplate from '../BaseInputTemplate';
|
|
7
|
+
import CyclicSchemaExpandTemplate from '../CyclicSchemaExpandTemplate';
|
|
7
8
|
import DescriptionField from '../DescriptionField';
|
|
8
9
|
import ErrorList from '../ErrorList';
|
|
9
10
|
import FieldErrorTemplate from '../FieldErrorTemplate';
|
|
@@ -27,6 +28,7 @@ export function generateTemplates<
|
|
|
27
28
|
ArrayFieldItemTemplate,
|
|
28
29
|
ArrayFieldTemplate,
|
|
29
30
|
BaseInputTemplate,
|
|
31
|
+
CyclicSchemaExpandTemplate,
|
|
30
32
|
ButtonTemplates: {
|
|
31
33
|
AddButton,
|
|
32
34
|
CopyButton,
|
|
@@ -39,9 +39,9 @@ export default function TextareaWidget<
|
|
|
39
39
|
});
|
|
40
40
|
// oxlint-disable-next-line no-shadow
|
|
41
41
|
const handleChange = ({ target: { value } }: ChangeEvent<HTMLTextAreaElement>) =>
|
|
42
|
-
onChange
|
|
43
|
-
const handleBlur = () => onBlur
|
|
44
|
-
const handleFocus = () => onFocus
|
|
42
|
+
onChange?.(value === '' ? options.emptyValue : value);
|
|
43
|
+
const handleBlur = () => onBlur?.(id, value);
|
|
44
|
+
const handleFocus = () => onFocus?.(id, value);
|
|
45
45
|
return (
|
|
46
46
|
<Form.TextArea
|
|
47
47
|
id={id}
|
package/src/util.tsx
CHANGED
|
@@ -83,10 +83,10 @@ export function getSemanticErrorProps<
|
|
|
83
83
|
options = {},
|
|
84
84
|
defaultProps = { size: 'small', pointing: 'above' },
|
|
85
85
|
}: SemanticErrorPropsType<T, S, F>) {
|
|
86
|
-
const formContextProps = formContext.semantic
|
|
86
|
+
const formContextProps = formContext.semantic?.errorOptions;
|
|
87
87
|
const semanticOptions: GenericObjectType = getUiOptions<T, S, F>(uiSchema).semantic as GenericObjectType;
|
|
88
|
-
const schemaProps = semanticOptions
|
|
89
|
-
const optionProps =
|
|
88
|
+
const schemaProps = semanticOptions?.errorOptions;
|
|
89
|
+
const optionProps = (options.semantic as GenericObjectType)?.errorOptions;
|
|
90
90
|
|
|
91
91
|
return { ...defaultProps, ...schemaProps, ...optionProps, ...formContextProps };
|
|
92
92
|
}
|