@wise/dynamic-flow-client 3.20.0 → 3.20.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/build/main.js +74 -114
- package/build/main.min.js +1 -1
- package/build/main.mjs +74 -114
- package/build/types/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +0 -5
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +1 -6
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -6
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -6
- package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +1 -8
- package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +0 -8
- package/build/types/legacy/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +0 -6
- package/build/types/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +0 -6
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -5
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -5
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -5
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +1 -4
- package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +0 -9
- package/build/types/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -5
- package/package.json +17 -18
package/build/main.js
CHANGED
|
@@ -144,10 +144,10 @@ var init_clsx = __esm({
|
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
-
// ../../node_modules/.pnpm/@wise+art@2.
|
|
147
|
+
// ../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js
|
|
148
148
|
var import_react7, import_jsx_runtime17, unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
|
|
149
|
-
var
|
|
150
|
-
"../../node_modules/.pnpm/@wise+art@2.
|
|
149
|
+
var init_index_a91e5689_esm = __esm({
|
|
150
|
+
"../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js"() {
|
|
151
151
|
"use strict";
|
|
152
152
|
init_clsx();
|
|
153
153
|
import_react7 = require("react");
|
|
@@ -156,7 +156,8 @@ var init_index_93a0c34e_esm = __esm({
|
|
|
156
156
|
Flag = ({
|
|
157
157
|
code,
|
|
158
158
|
intrinsicSize = 64,
|
|
159
|
-
className = void 0
|
|
159
|
+
className = void 0,
|
|
160
|
+
loading = "lazy"
|
|
160
161
|
}) => {
|
|
161
162
|
const [fallback, setFallback] = (0, import_react7.useState)(null);
|
|
162
163
|
(0, import_react7.useEffect)(() => {
|
|
@@ -167,6 +168,7 @@ var init_index_93a0c34e_esm = __esm({
|
|
|
167
168
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("img", {
|
|
168
169
|
className: clsx(`wds-flag wds-flag-${name}`, className),
|
|
169
170
|
src: `https://wise.com/web-art/assets/flags/${name}.svg`,
|
|
171
|
+
loading,
|
|
170
172
|
alt: "",
|
|
171
173
|
width: intrinsicSize,
|
|
172
174
|
height: intrinsicSize,
|
|
@@ -6145,12 +6147,6 @@ var decisionLayoutOptionSchema = z.object({
|
|
|
6145
6147
|
icon: iconSchema.optional(),
|
|
6146
6148
|
image: imageLayoutSchema.optional()
|
|
6147
6149
|
});
|
|
6148
|
-
var statusListLayoutItemSchema = z.object({
|
|
6149
|
-
title: z.string(),
|
|
6150
|
-
description: z.string().optional(),
|
|
6151
|
-
icon: iconSchema,
|
|
6152
|
-
status: statusListLayoutStatusSchema.optional()
|
|
6153
|
-
});
|
|
6154
6150
|
var instructionsLayoutSchema = z.object({
|
|
6155
6151
|
type: z.literal("instructions"),
|
|
6156
6152
|
title: z.string().optional(),
|
|
@@ -6158,6 +6154,10 @@ var instructionsLayoutSchema = z.object({
|
|
|
6158
6154
|
control: z.string().optional(),
|
|
6159
6155
|
margin: sizeSchema.optional()
|
|
6160
6156
|
});
|
|
6157
|
+
var behaviorSchema = z.object({
|
|
6158
|
+
action: actionSchema.optional(),
|
|
6159
|
+
link: linkSchema.optional()
|
|
6160
|
+
});
|
|
6161
6161
|
var buttonLayoutSchema = z.object({
|
|
6162
6162
|
type: z.literal("button"),
|
|
6163
6163
|
size: sizeSchema.optional(),
|
|
@@ -6174,10 +6174,6 @@ var reviewLayoutFieldSchema = z.object({
|
|
|
6174
6174
|
value: z.string(),
|
|
6175
6175
|
help: helpSchema.optional()
|
|
6176
6176
|
});
|
|
6177
|
-
var behaviorSchema = z.object({
|
|
6178
|
-
action: actionSchema.optional(),
|
|
6179
|
-
link: linkSchema.optional()
|
|
6180
|
-
});
|
|
6181
6177
|
var searchResultSearchSchema = z.object({
|
|
6182
6178
|
type: z.literal("search"),
|
|
6183
6179
|
title: z.string(),
|
|
@@ -6238,12 +6234,10 @@ var decisionLayoutSchema = z.object({
|
|
|
6238
6234
|
control: z.string().optional(),
|
|
6239
6235
|
margin: sizeSchema.optional()
|
|
6240
6236
|
});
|
|
6241
|
-
var
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
control: z.string().optional(),
|
|
6246
|
-
margin: sizeSchema.optional()
|
|
6237
|
+
var itemCallToActionSchema = z.object({
|
|
6238
|
+
title: z.string(),
|
|
6239
|
+
accessibilityDescription: z.string().optional(),
|
|
6240
|
+
behavior: behaviorSchema
|
|
6247
6241
|
});
|
|
6248
6242
|
var reviewLayoutSchema = z.object({
|
|
6249
6243
|
type: z.literal("review"),
|
|
@@ -6277,6 +6271,13 @@ var alertLayoutSchema = z.object({
|
|
|
6277
6271
|
margin: sizeSchema.optional(),
|
|
6278
6272
|
callToAction: alertLayoutCallToActionSchema.optional()
|
|
6279
6273
|
});
|
|
6274
|
+
var statusListLayoutItemSchema = z.object({
|
|
6275
|
+
title: z.string(),
|
|
6276
|
+
description: z.string().optional(),
|
|
6277
|
+
icon: iconSchema,
|
|
6278
|
+
status: statusListLayoutStatusSchema.optional(),
|
|
6279
|
+
callToAction: itemCallToActionSchema.optional()
|
|
6280
|
+
});
|
|
6280
6281
|
var searchResponseBodySchema = z.object({
|
|
6281
6282
|
results: z.array(searchResultSchema)
|
|
6282
6283
|
});
|
|
@@ -6318,6 +6319,13 @@ var constSchemaSchema = z.object({
|
|
|
6318
6319
|
analyticsId: z.string().optional(),
|
|
6319
6320
|
disabled: z.boolean().optional()
|
|
6320
6321
|
});
|
|
6322
|
+
var statusListLayoutSchema = z.object({
|
|
6323
|
+
type: z.literal("status-list"),
|
|
6324
|
+
items: z.array(statusListLayoutItemSchema),
|
|
6325
|
+
title: z.string().optional(),
|
|
6326
|
+
control: z.string().optional(),
|
|
6327
|
+
margin: sizeSchema.optional()
|
|
6328
|
+
});
|
|
6321
6329
|
var layoutSchema = z.lazy(
|
|
6322
6330
|
() => z.union([
|
|
6323
6331
|
alertLayoutSchema,
|
|
@@ -11420,8 +11428,8 @@ var DateInputRenderer_default = DateInputRenderer;
|
|
|
11420
11428
|
// ../renderers/src/DecisionRenderer.tsx
|
|
11421
11429
|
var import_components9 = require("@transferwise/components");
|
|
11422
11430
|
|
|
11423
|
-
// ../../node_modules/.pnpm/@wise+art@2.
|
|
11424
|
-
|
|
11431
|
+
// ../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
|
|
11432
|
+
init_index_a91e5689_esm();
|
|
11425
11433
|
init_clsx();
|
|
11426
11434
|
var import_react8 = require("react");
|
|
11427
11435
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -14930,6 +14938,7 @@ var getSchemaColumnClasses = (width) => ({
|
|
|
14930
14938
|
"col-sm-4": width === "sm"
|
|
14931
14939
|
});
|
|
14932
14940
|
function AllOfSchema(props) {
|
|
14941
|
+
const { disabled = false } = props;
|
|
14933
14942
|
const onChangeModelIndex = (index, onChangeProps) => {
|
|
14934
14943
|
const modelSchema = props.schema.allOf[index];
|
|
14935
14944
|
models[index] = getValidObjectModelParts(onChangeProps.model, modelSchema) || {};
|
|
@@ -14949,7 +14958,7 @@ function AllOfSchema(props) {
|
|
|
14949
14958
|
model: models[index],
|
|
14950
14959
|
errors: props.errors,
|
|
14951
14960
|
submitted: props.submitted,
|
|
14952
|
-
disabled
|
|
14961
|
+
disabled,
|
|
14953
14962
|
onChange: (onChangeProps) => onChangeModelIndex(index, __spreadProps(__spreadValues({}, onChangeProps), {
|
|
14954
14963
|
// We can safely assume that the model here is going to be of the same type as the model prop
|
|
14955
14964
|
model: onChangeProps.model
|
|
@@ -14960,9 +14969,6 @@ function AllOfSchema(props) {
|
|
|
14960
14969
|
)) })
|
|
14961
14970
|
] });
|
|
14962
14971
|
}
|
|
14963
|
-
AllOfSchema.defaultProps = {
|
|
14964
|
-
disabled: false
|
|
14965
|
-
};
|
|
14966
14972
|
var AllOfSchema_default = AllOfSchema;
|
|
14967
14973
|
|
|
14968
14974
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
@@ -14976,28 +14982,22 @@ var import_formatting2 = require("@transferwise/formatting");
|
|
|
14976
14982
|
var import_react_intl22 = require("react-intl");
|
|
14977
14983
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14978
14984
|
function ControlFeedback(props) {
|
|
14979
|
-
|
|
14985
|
+
const { errors = "", validations = [], validationMessages = {} } = props;
|
|
14980
14986
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
14981
|
-
const
|
|
14982
|
-
const isErrorVisible = (props.submitted || !props.changed) && Boolean(
|
|
14983
|
-
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean(
|
|
14987
|
+
const mergedValidationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), validationMessages), props.schema.validationMessages);
|
|
14988
|
+
const isErrorVisible = (props.submitted || !props.changed) && Boolean(errors);
|
|
14989
|
+
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean(validations == null ? void 0 : validations.length);
|
|
14984
14990
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
14985
14991
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
14986
14992
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { id: props.id, children: [
|
|
14987
|
-
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children:
|
|
14988
|
-
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children:
|
|
14993
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children: errors }) : null,
|
|
14994
|
+
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children: validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: mergedValidationMessages[validation] }, validation)) }) : null,
|
|
14989
14995
|
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_components46.InlineAlert, { type: "info", children: [
|
|
14990
14996
|
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: props.schema.description }),
|
|
14991
14997
|
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: props.infoMessage })
|
|
14992
14998
|
] })
|
|
14993
14999
|
] });
|
|
14994
15000
|
}
|
|
14995
|
-
ControlFeedback.defaultProps = {
|
|
14996
|
-
errors: "",
|
|
14997
|
-
validations: [],
|
|
14998
|
-
validationMessages: {},
|
|
14999
|
-
validationAsyncSuccessMessage: null
|
|
15000
|
-
};
|
|
15001
15001
|
function useDefaultValidationMessages(schema) {
|
|
15002
15002
|
const { formatMessage, locale } = (0, import_react_intl22.useIntl)();
|
|
15003
15003
|
const formattedMessages = {
|
|
@@ -15117,7 +15117,7 @@ function useFormattedDefaultErrorMessages({
|
|
|
15117
15117
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
15118
15118
|
function MultipleFileUploadSchema(props) {
|
|
15119
15119
|
var _a, _b;
|
|
15120
|
-
const { onChange, schema } = props;
|
|
15120
|
+
const { onChange, errors = null, schema, required = false } = props;
|
|
15121
15121
|
const onEvent = useEventDispatcher();
|
|
15122
15122
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
15123
15123
|
const uid = (0, import_react34.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
@@ -15154,8 +15154,8 @@ function MultipleFileUploadSchema(props) {
|
|
|
15154
15154
|
}
|
|
15155
15155
|
const validFiles = getSuccessfullyProcessedFiles(files);
|
|
15156
15156
|
const fileIds = validFiles.map((file) => file.id);
|
|
15157
|
-
const fileListValidationFailures = getArrayValidationFailures(fileIds, schema,
|
|
15158
|
-
const showError = Boolean(
|
|
15157
|
+
const fileListValidationFailures = getArrayValidationFailures(fileIds, schema, required);
|
|
15158
|
+
const showError = Boolean(errors) || (inputChanged || props.submitted) && Boolean(fileListValidationFailures.length);
|
|
15159
15159
|
const accepts = "accepts" in fileSchemaDescriptor && fileSchemaDescriptor.accepts;
|
|
15160
15160
|
const maxSize = "maxSize" in fileSchemaDescriptor && fileSchemaDescriptor.maxSize;
|
|
15161
15161
|
const uploadInputProps = __spreadProps(__spreadValues(__spreadValues({
|
|
@@ -15184,14 +15184,10 @@ function MultipleFileUploadSchema(props) {
|
|
|
15184
15184
|
id: feedbackId,
|
|
15185
15185
|
changed: inputChanged,
|
|
15186
15186
|
submitted: props.submitted,
|
|
15187
|
-
errors
|
|
15187
|
+
errors,
|
|
15188
15188
|
schema: props.schema,
|
|
15189
15189
|
validations: fileListValidationFailures,
|
|
15190
|
-
validationMessages: getValidationMessages(
|
|
15191
|
-
schema,
|
|
15192
|
-
Boolean(props.required),
|
|
15193
|
-
defaultErrorMessages
|
|
15194
|
-
),
|
|
15190
|
+
validationMessages: getValidationMessages(schema, Boolean(required), defaultErrorMessages),
|
|
15195
15191
|
infoMessage: null,
|
|
15196
15192
|
focused: false,
|
|
15197
15193
|
blurred: true
|
|
@@ -15199,10 +15195,6 @@ function MultipleFileUploadSchema(props) {
|
|
|
15199
15195
|
)
|
|
15200
15196
|
] });
|
|
15201
15197
|
}
|
|
15202
|
-
MultipleFileUploadSchema.defaultProps = {
|
|
15203
|
-
errors: null,
|
|
15204
|
-
required: false
|
|
15205
|
-
};
|
|
15206
15198
|
var MultipleFileUploadSchema_default = MultipleFileUploadSchema;
|
|
15207
15199
|
function getSuccessfullyProcessedFiles(allFiles) {
|
|
15208
15200
|
return allFiles.filter((file) => !file.error && file.status === "succeeded");
|
|
@@ -15899,22 +15891,18 @@ var RepeatableSchema_default = RepeatableSchema;
|
|
|
15899
15891
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
15900
15892
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
15901
15893
|
function ArrayListSchema(props) {
|
|
15902
|
-
const { schema } = props;
|
|
15894
|
+
const { errors = null, schema } = props;
|
|
15903
15895
|
if (isMultipleFileUploadSchema(schema)) {
|
|
15904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
15896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
|
|
15905
15897
|
}
|
|
15906
15898
|
if (isMultiSelectConstSchema(schema)) {
|
|
15907
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
15899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { errors, schema }));
|
|
15908
15900
|
}
|
|
15909
15901
|
if (isListArraySchema(schema)) {
|
|
15910
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
15902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
|
|
15911
15903
|
}
|
|
15912
15904
|
throw new Error("Invalid array list schema");
|
|
15913
15905
|
}
|
|
15914
|
-
ArrayListSchema.defaultProps = {
|
|
15915
|
-
errors: null,
|
|
15916
|
-
required: false
|
|
15917
|
-
};
|
|
15918
15906
|
var ArrayListSchema_default = ArrayListSchema;
|
|
15919
15907
|
|
|
15920
15908
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
@@ -15926,9 +15914,6 @@ var ArraySchema = (props) => {
|
|
|
15926
15914
|
}
|
|
15927
15915
|
throw new Error("Not implemented");
|
|
15928
15916
|
};
|
|
15929
|
-
ArraySchema.defaultProps = {
|
|
15930
|
-
required: false
|
|
15931
|
-
};
|
|
15932
15917
|
var ArraySchema_default = ArraySchema;
|
|
15933
15918
|
|
|
15934
15919
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
@@ -15942,6 +15927,7 @@ var getSchemaColumnClasses2 = (width) => ({
|
|
|
15942
15927
|
"col-sm-4": width === "sm"
|
|
15943
15928
|
});
|
|
15944
15929
|
function ObjectSchema(props) {
|
|
15930
|
+
const { disabled = false, hideTitle = false } = props;
|
|
15945
15931
|
const [model, setModel] = (0, import_react38.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
15946
15932
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
15947
15933
|
if (onChangeProps.model !== null) {
|
|
@@ -15974,8 +15960,8 @@ function ObjectSchema(props) {
|
|
|
15974
15960
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
15975
15961
|
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
15976
15962
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("fieldset", { children: [
|
|
15977
|
-
props.schema.title && !
|
|
15978
|
-
props.schema.description && !
|
|
15963
|
+
props.schema.title && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_components52.Header, { title: props.schema.title, as: "legend" }),
|
|
15964
|
+
props.schema.description && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { children: [
|
|
15979
15965
|
" ",
|
|
15980
15966
|
props.schema.description,
|
|
15981
15967
|
" "
|
|
@@ -15994,7 +15980,7 @@ function ObjectSchema(props) {
|
|
|
15994
15980
|
errors: propsErrors == null ? void 0 : propsErrors[propertyName],
|
|
15995
15981
|
submitted: props.submitted,
|
|
15996
15982
|
required: isRequired(propertyName),
|
|
15997
|
-
disabled
|
|
15983
|
+
disabled,
|
|
15998
15984
|
onChange: (onChangeProps) => onChangeProperty(propertyName, onChangeProps),
|
|
15999
15985
|
onPersistAsync: props.onPersistAsync
|
|
16000
15986
|
}
|
|
@@ -16005,10 +15991,6 @@ function ObjectSchema(props) {
|
|
|
16005
15991
|
] })
|
|
16006
15992
|
] });
|
|
16007
15993
|
}
|
|
16008
|
-
ObjectSchema.defaultProps = {
|
|
16009
|
-
hideTitle: false,
|
|
16010
|
-
disabled: false
|
|
16011
|
-
};
|
|
16012
15994
|
var ObjectSchema_default = ObjectSchema;
|
|
16013
15995
|
|
|
16014
15996
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
@@ -16338,7 +16320,7 @@ var _FormControl = class _FormControl extends import_react39.PureComponent {
|
|
|
16338
16320
|
UNSAFE_inputAttributes: {
|
|
16339
16321
|
id,
|
|
16340
16322
|
"aria-invalid": invalid,
|
|
16341
|
-
"aria-labelledby":
|
|
16323
|
+
"aria-labelledby": labelledBy,
|
|
16342
16324
|
"aria-describedby": describedBy
|
|
16343
16325
|
},
|
|
16344
16326
|
onChange: this.handleOnChange
|
|
@@ -16370,7 +16352,7 @@ var _FormControl = class _FormControl extends import_react39.PureComponent {
|
|
|
16370
16352
|
UNSAFE_triggerButtonProps: {
|
|
16371
16353
|
id,
|
|
16372
16354
|
"aria-invalid": invalid,
|
|
16373
|
-
"aria-labelledby":
|
|
16355
|
+
"aria-labelledby": labelledBy,
|
|
16374
16356
|
"aria-describedby": describedBy
|
|
16375
16357
|
},
|
|
16376
16358
|
items: items.map((value2) => ({
|
|
@@ -16743,8 +16725,8 @@ function SchemaFormControl(props) {
|
|
|
16743
16725
|
const {
|
|
16744
16726
|
id,
|
|
16745
16727
|
schema,
|
|
16746
|
-
value,
|
|
16747
|
-
disabled,
|
|
16728
|
+
value = null,
|
|
16729
|
+
disabled = false,
|
|
16748
16730
|
invalid,
|
|
16749
16731
|
required,
|
|
16750
16732
|
onChange,
|
|
@@ -16794,13 +16776,6 @@ function SchemaFormControl(props) {
|
|
|
16794
16776
|
};
|
|
16795
16777
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
16796
16778
|
}
|
|
16797
|
-
SchemaFormControl.defaultProps = {
|
|
16798
|
-
value: null,
|
|
16799
|
-
onFocus: null,
|
|
16800
|
-
onBlur: null,
|
|
16801
|
-
onSearchChange: null,
|
|
16802
|
-
disabled: false
|
|
16803
|
-
};
|
|
16804
16779
|
var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
16805
16780
|
if (isOneOfSchema2(schema) && schema.oneOf.length === 2 && !schema.control) {
|
|
16806
16781
|
log.warning(
|
|
@@ -16827,6 +16802,7 @@ function OneOfSchema(props) {
|
|
|
16827
16802
|
const [changed, setChanged] = (0, import_react41.useState)(false);
|
|
16828
16803
|
const [focused, setFocused] = (0, import_react41.useState)(false);
|
|
16829
16804
|
const [blurred, setBlurred] = (0, import_react41.useState)(false);
|
|
16805
|
+
const { disabled = false, required = false } = props;
|
|
16830
16806
|
const id = (0, import_react41.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
16831
16807
|
const [schemaIndex, setSchemaIndex] = (0, import_react41.useState)(
|
|
16832
16808
|
getActiveSchemaIndex(props.schema, props.model)
|
|
@@ -16897,21 +16873,23 @@ function OneOfSchema(props) {
|
|
|
16897
16873
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
16898
16874
|
};
|
|
16899
16875
|
const feedbackId = `${id}-feedback`;
|
|
16876
|
+
const labelId = `${id}-label`;
|
|
16900
16877
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
16901
16878
|
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
16902
16879
|
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
16903
16880
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: (0, import_classnames11.default)(formGroupClasses), children: [
|
|
16904
|
-
getTitleAndHelp(props.schema, id),
|
|
16881
|
+
getTitleAndHelp(props.schema, id, labelId),
|
|
16905
16882
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
16906
16883
|
SchemaFormControl_default,
|
|
16907
16884
|
{
|
|
16908
16885
|
id,
|
|
16909
16886
|
schema: schemaForSelect,
|
|
16910
16887
|
value: schemaIndex,
|
|
16911
|
-
disabled
|
|
16888
|
+
disabled,
|
|
16912
16889
|
invalid: !isEmpty(props.errors) || validations.length > 0,
|
|
16913
16890
|
describedBy: feedbackId,
|
|
16914
|
-
|
|
16891
|
+
labelledBy: labelId,
|
|
16892
|
+
required,
|
|
16915
16893
|
onChange: onChooseNewSchema,
|
|
16916
16894
|
onFocus,
|
|
16917
16895
|
onBlur,
|
|
@@ -16942,17 +16920,17 @@ function OneOfSchema(props) {
|
|
|
16942
16920
|
errors: props.errors,
|
|
16943
16921
|
submitted: props.submitted,
|
|
16944
16922
|
hideTitle: true,
|
|
16945
|
-
disabled
|
|
16923
|
+
disabled,
|
|
16946
16924
|
onChange: (parameters) => onChildModelChange(schemaIndex, parameters),
|
|
16947
16925
|
onPersistAsync: props.onPersistAsync
|
|
16948
16926
|
}
|
|
16949
16927
|
)
|
|
16950
16928
|
] });
|
|
16951
16929
|
}
|
|
16952
|
-
function getTitleAndHelp(schema, forId) {
|
|
16930
|
+
function getTitleAndHelp(schema, forId, labelId) {
|
|
16953
16931
|
var _a;
|
|
16954
16932
|
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Help_default2, { help: schema.help }) : null;
|
|
16955
|
-
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "m-b-1", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("label", { className: "control-label d-inline", htmlFor: forId, children: [
|
|
16933
|
+
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "m-b-1", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("label", { className: "control-label d-inline", id: labelId, htmlFor: forId, children: [
|
|
16956
16934
|
schema.title,
|
|
16957
16935
|
" ",
|
|
16958
16936
|
helpElement
|
|
@@ -16964,12 +16942,13 @@ function getTitleAndHelp(schema, forId) {
|
|
|
16964
16942
|
return schema.title ? titleElement : helpElement;
|
|
16965
16943
|
}
|
|
16966
16944
|
function getValidations(props, schemaIndex) {
|
|
16967
|
-
const
|
|
16945
|
+
const { schema, required = false } = props;
|
|
16946
|
+
const selectedSchema = schema.oneOf[schemaIndex != null ? schemaIndex : -1];
|
|
16968
16947
|
if (isConstSchema2(selectedSchema)) {
|
|
16969
|
-
return getValidationFailures(selectedSchema.const,
|
|
16948
|
+
return getValidationFailures(selectedSchema.const, schema, Boolean(required));
|
|
16970
16949
|
}
|
|
16971
16950
|
if (schemaIndex === null || schemaIndex < 0) {
|
|
16972
|
-
return getValidationFailures(null,
|
|
16951
|
+
return getValidationFailures(null, schema, Boolean(required));
|
|
16973
16952
|
}
|
|
16974
16953
|
return [];
|
|
16975
16954
|
}
|
|
@@ -16989,10 +16968,6 @@ function mapOneOfToConst(schema, index) {
|
|
|
16989
16968
|
const { title, description, disabled = false, icon, image, keywords } = schema;
|
|
16990
16969
|
return { title, description, disabled, icon, image, const: index, keywords };
|
|
16991
16970
|
}
|
|
16992
|
-
OneOfSchema.defaultProps = {
|
|
16993
|
-
required: false,
|
|
16994
|
-
disabled: false
|
|
16995
|
-
};
|
|
16996
16971
|
var OneOfSchema_default = OneOfSchema;
|
|
16997
16972
|
|
|
16998
16973
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
@@ -17060,7 +17035,7 @@ function UploadInputAdapter(props) {
|
|
|
17060
17035
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
17061
17036
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
17062
17037
|
function PersistAsyncBlobSchema(props) {
|
|
17063
|
-
const { model, schema, submitted, required, errors, onChange } = props;
|
|
17038
|
+
const { model, schema, submitted, required = false, errors, onChange } = props;
|
|
17064
17039
|
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react43.useState)({});
|
|
17065
17040
|
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react43.useState)(null);
|
|
17066
17041
|
const [validations, setValidations] = (0, import_react43.useState)([]);
|
|
@@ -17144,9 +17119,6 @@ function PersistAsyncBlobSchema(props) {
|
|
|
17144
17119
|
)
|
|
17145
17120
|
] });
|
|
17146
17121
|
}
|
|
17147
|
-
PersistAsyncBlobSchema.defaultProps = {
|
|
17148
|
-
required: false
|
|
17149
|
-
};
|
|
17150
17122
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
17151
17123
|
|
|
17152
17124
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
@@ -17162,9 +17134,6 @@ function PersistAsyncSchema(props) {
|
|
|
17162
17134
|
}
|
|
17163
17135
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
17164
17136
|
}
|
|
17165
|
-
PersistAsyncSchema.defaultProps = {
|
|
17166
|
-
required: false
|
|
17167
|
-
};
|
|
17168
17137
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
17169
17138
|
|
|
17170
17139
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
@@ -17194,7 +17163,6 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
17194
17163
|
};
|
|
17195
17164
|
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components57.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
17196
17165
|
};
|
|
17197
|
-
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
17198
17166
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
17199
17167
|
|
|
17200
17168
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
@@ -17378,7 +17346,7 @@ function getValueFromOption(option) {
|
|
|
17378
17346
|
var import_react45 = require("react");
|
|
17379
17347
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
17380
17348
|
function ValidationAsyncSchema(props) {
|
|
17381
|
-
const { schema, model, required, submitted, errors, onChange } = props;
|
|
17349
|
+
const { schema, model, required = false, submitted, errors, onChange } = props;
|
|
17382
17350
|
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react45.useState)(model);
|
|
17383
17351
|
const previousRequestedModelReference = (0, import_react45.useRef)(null);
|
|
17384
17352
|
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react45.useState)(
|
|
@@ -17462,7 +17430,6 @@ function ValidationAsyncSchema(props) {
|
|
|
17462
17430
|
};
|
|
17463
17431
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
17464
17432
|
}
|
|
17465
|
-
ValidationAsyncSchema.defaultProps = { required: false };
|
|
17466
17433
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
17467
17434
|
|
|
17468
17435
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
@@ -18245,11 +18212,12 @@ var getDefaultValue = (schema) => {
|
|
|
18245
18212
|
};
|
|
18246
18213
|
var BasicTypeSchema = (props) => {
|
|
18247
18214
|
var _a, _b, _c;
|
|
18215
|
+
const { disabled = false, required = false } = props;
|
|
18248
18216
|
const onChange = (newModel, _type, metadata) => {
|
|
18249
18217
|
setChanged(true);
|
|
18250
18218
|
setModelAndBroadcast(sanitiseModel(newModel), "user", metadata);
|
|
18251
18219
|
};
|
|
18252
|
-
const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema,
|
|
18220
|
+
const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema, required);
|
|
18253
18221
|
const setModelAndBroadcast = (newModel, type, metadata) => {
|
|
18254
18222
|
setModel(newModel);
|
|
18255
18223
|
const validationKeys = getValidationKeys(newModel);
|
|
@@ -18329,7 +18297,7 @@ var BasicTypeSchema = (props) => {
|
|
|
18329
18297
|
id,
|
|
18330
18298
|
schema: props.schema,
|
|
18331
18299
|
value: model,
|
|
18332
|
-
disabled: !!
|
|
18300
|
+
disabled: !!disabled,
|
|
18333
18301
|
onChange,
|
|
18334
18302
|
onFocus,
|
|
18335
18303
|
onBlur,
|
|
@@ -18354,11 +18322,6 @@ var BasicTypeSchema = (props) => {
|
|
|
18354
18322
|
] })
|
|
18355
18323
|
] }) : null;
|
|
18356
18324
|
};
|
|
18357
|
-
BasicTypeSchema.defaultProps = {
|
|
18358
|
-
required: false,
|
|
18359
|
-
disabled: false,
|
|
18360
|
-
onBlur: null
|
|
18361
|
-
};
|
|
18362
18325
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
18363
18326
|
|
|
18364
18327
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
@@ -18376,7 +18339,7 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
18376
18339
|
FormControlType.UPLOAD
|
|
18377
18340
|
]);
|
|
18378
18341
|
function PersistAsyncBasicSchema(props) {
|
|
18379
|
-
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
18342
|
+
const { schema, required = false, submitted, errors, onChange, onPersistAsync } = props;
|
|
18380
18343
|
const intl = (0, import_react_intl40.useIntl)();
|
|
18381
18344
|
const httpClient = useHttpClient();
|
|
18382
18345
|
const onEvent = useEventDispatcher();
|
|
@@ -18466,9 +18429,6 @@ function PersistAsyncBasicSchema(props) {
|
|
|
18466
18429
|
}
|
|
18467
18430
|
);
|
|
18468
18431
|
}
|
|
18469
|
-
PersistAsyncBasicSchema.defaultProps = {
|
|
18470
|
-
required: false
|
|
18471
|
-
};
|
|
18472
18432
|
var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
18473
18433
|
|
|
18474
18434
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|