@wise/dynamic-flow-client 0.4.0 → 0.4.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/common/constants/DateMode.js +2 -2
- package/build/common/constants/FormControlType.js +2 -2
- package/build/common/constants/MonthFormat.js +2 -2
- package/build/common/constants/SchemaType.js +2 -2
- package/build/common/constants/Size.js +2 -2
- package/build/common/constants/index.js +1 -1
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +15 -27
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +11 -9
- package/build/common/contexts/eventsContext/EventsContext.js +11 -28
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +14 -27
- package/build/common/contexts/index.js +1 -1
- package/build/common/contexts/logContext/LogContext.js +12 -30
- package/build/common/hooks/index.js +1 -1
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +3 -3
- package/build/common/hooks/useExternal/useExternal.js +8 -8
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +20 -31
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +60 -139
- package/build/common/hooks/usePolling/usePolling.js +20 -21
- package/build/common/hooks/usePrevious/usePrevious.js +5 -5
- package/build/common/hooks/useStepPolling/useStepPolling.js +15 -14
- package/build/common/makeFetcher/index.js +1 -1
- package/build/common/makeFetcher/makeFetcher.js +10 -24
- package/build/common/messages.js +5 -5
- package/build/common/utils/api-utils.js +3 -4
- package/build/common/utils/date-utils.js +11 -11
- package/build/common/utils/debounce.js +11 -15
- package/build/common/utils/file-utils.js +12 -25
- package/build/common/utils/id-utils.js +4 -5
- package/build/common/utils/index.js +1 -1
- package/build/common/utils/is-equal.js +8 -8
- package/build/common/utils/schema-utils.js +6 -6
- package/build/common/utils/step-utils.js +14 -14
- package/build/common/validators/index.js +7 -7
- package/build/common/validators/models/model-validators.js +8 -8
- package/build/common/validators/models/models.utils.js +29 -42
- package/build/common/validators/schemas/schema-validators.js +11 -13
- package/build/common/validators/types/type-validators.js +9 -13
- package/build/common/validators/validationFailures/validation-failures.js +14 -14
- package/build/common/validators/validationFailures/validation-failures.utils.js +5 -7
- package/build/common/validators/values/value-validators.js +4 -6
- package/build/dynamicFlow/DynamicFlow.js +185 -307
- package/build/dynamicFlow/DynamicFlowStep.js +12 -23
- package/build/dynamicFlow/DynamicFlowTypes.js +1 -1
- package/build/dynamicFlow/index.js +6 -14
- package/build/dynamicFlow/stories/DynamicFlow.story.js +20 -20
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +20 -33
- package/build/dynamicFlow/stories/fixtureFetcher.js +46 -104
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +22 -40
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +6 -6
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +10 -11
- package/build/dynamicFlow/utils/index.js +5 -2
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +53 -118
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +9 -9
- package/build/dynamicFlow/utils/useDynamicFlowState.js +51 -74
- package/build/dynamicFlow/utils/useLoader.js +9 -20
- package/build/fixtures/components/alert.js +8 -8
- package/build/fixtures/components/box.js +7 -7
- package/build/fixtures/components/button.js +25 -36
- package/build/fixtures/components/columns.js +10 -10
- package/build/fixtures/components/copyable.js +6 -6
- package/build/fixtures/components/decision.js +15 -15
- package/build/fixtures/components/heading.js +7 -7
- package/build/fixtures/components/image.js +10 -10
- package/build/fixtures/components/index.js +17 -25
- package/build/fixtures/components/info.js +22 -6
- package/build/fixtures/components/list.js +8 -8
- package/build/fixtures/components/loading-indicator.js +5 -5
- package/build/fixtures/components/paragraph.js +9 -9
- package/build/fixtures/components/review.js +11 -11
- package/build/fixtures/examples/camera-capture.js +29 -29
- package/build/fixtures/examples/index.js +9 -17
- package/build/fixtures/examples/recipient-update.js +69 -69
- package/build/fixtures/examples/recipient.js +63 -63
- package/build/fixtures/examples/single-file-upload.js +21 -21
- package/build/fixtures/examples/step-validation-errors.js +21 -21
- package/build/fixtures/features/action-response.js +8 -8
- package/build/fixtures/features/external.js +8 -8
- package/build/fixtures/features/index.js +9 -17
- package/build/fixtures/features/persist-async.js +11 -11
- package/build/fixtures/features/polling.js +9 -9
- package/build/fixtures/features/validation-async.js +10 -10
- package/build/fixtures/index.js +11 -22
- package/build/fixtures/jsonSchemaForm/allOf.js +30 -30
- package/build/fixtures/jsonSchemaForm/audRecipient.js +271 -271
- package/build/fixtures/jsonSchemaForm/currency.js +12 -12
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +11 -11
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +11 -11
- package/build/fixtures/jsonSchemaForm/oneOf.js +27 -27
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +16 -16
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +17 -17
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +30 -30
- package/build/fixtures/jsonSchemaForm/simple.js +16 -16
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +19 -19
- package/build/fixtures/jsonSchemaForm/validationAsync.js +8 -8
- package/build/fixtures/layouts/all.js +37 -37
- package/build/fixtures/layouts/final-step-layout.js +9 -9
- package/build/fixtures/layouts/index.js +10 -18
- package/build/fixtures/layouts/list.js +10 -10
- package/build/fixtures/layouts/pay-in.js +23 -23
- package/build/fixtures/layouts/review.js +38 -38
- package/build/fixtures/layouts/success.js +15 -15
- package/build/fixtures/responses/action-response-final.js +8 -8
- package/build/fixtures/responses/action.js +3 -3
- package/build/fixtures/responses/exit.js +3 -3
- package/build/fixtures/responses/index.js +8 -16
- package/build/fixtures/responses/recipient-update-final.js +8 -8
- package/build/fixtures/schemas/basic-form.js +11 -11
- package/build/fixtures/schemas/index.js +8 -16
- package/build/fixtures/schemas/number-and-integer.js +11 -11
- package/build/fixtures/schemas/one-of.js +43 -46
- package/build/fixtures/schemas/string-formats.js +15 -15
- package/build/fixtures/utils/image-util.js +8 -8
- package/build/formControl/FormControl.js +118 -148
- package/build/formControl/index.js +6 -14
- package/build/formControl/utils/index.js +1 -1
- package/build/formControl/utils/value-utils.js +18 -23
- package/build/i18n/index.js +31 -31
- package/build/index.js +13 -10
- package/build/jsonSchemaForm/JsonSchemaForm.js +12 -24
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +24 -37
- package/build/jsonSchemaForm/allOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +9 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +9 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +56 -115
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +7 -7
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +1 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +19 -71
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +10 -11
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +6 -14
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +45 -62
- package/build/jsonSchemaForm/basicTypeSchema/index.js +6 -14
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +39 -50
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +18 -18
- package/build/jsonSchemaForm/controlFeedback/index.js +6 -14
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +52 -61
- package/build/jsonSchemaForm/genericSchema/index.js +6 -14
- package/build/jsonSchemaForm/help/Help.js +9 -9
- package/build/jsonSchemaForm/help/Help.messages.js +5 -5
- package/build/jsonSchemaForm/help/index.js +6 -14
- package/build/jsonSchemaForm/index.js +6 -14
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +28 -49
- package/build/jsonSchemaForm/objectSchema/index.js +6 -14
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +54 -74
- package/build/jsonSchemaForm/oneOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +3 -3
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +1 -1
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +19 -20
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +11 -22
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +5 -5
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +6 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +73 -127
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +6 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +45 -110
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +17 -17
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +6 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +28 -47
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +4 -4
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +13 -24
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +11 -22
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +12 -23
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +24 -26
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +6 -6
- package/build/jsonSchemaForm/readOnlySchema/index.js +6 -14
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +26 -39
- package/build/jsonSchemaForm/schemaFormControl/index.js +6 -14
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +5 -5
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -1
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +30 -47
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +57 -119
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +6 -14
- package/build/layout/DynamicLayout.js +10 -21
- package/build/layout/alert/DynamicAlert.js +9 -9
- package/build/layout/box/DynamicBox.js +12 -23
- package/build/layout/button/DynamicButton.js +16 -27
- package/build/layout/columns/DynamicColumns.js +13 -24
- package/build/layout/decision/DynamicDecision.js +16 -27
- package/build/layout/divider/DynamicDivider.js +7 -8
- package/build/layout/external/DynamicExternal.js +16 -28
- package/build/layout/external/DynamicExternal.messages.js +5 -5
- package/build/layout/form/DynamicForm.js +10 -21
- package/build/layout/heading/DynamicHeading.js +12 -23
- package/build/layout/icon/DynamicIcon.js +9 -10
- package/build/layout/image/DynamicImage.js +43 -93
- package/build/layout/index.js +21 -29
- package/build/layout/info/DynamicInfo.js +7 -19
- package/build/layout/list/DynamicList.js +14 -26
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +8 -9
- package/build/layout/paragraph/DynamicParagraph.js +19 -37
- package/build/layout/paragraph/DynamicParagraph.messages.js +6 -6
- package/build/layout/paragraph/useSnackBarIfAvailable.js +4 -4
- package/build/layout/review/DynamicReview.js +14 -26
- package/build/layout/utils.js +4 -6
- package/build/step/cameraStep/CameraStep.js +42 -88
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +48 -105
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +7 -7
- package/build/step/cameraStep/cameraCapture/components/index.js +10 -28
- package/build/step/cameraStep/cameraCapture/hooks/index.js +17 -72
- package/build/step/cameraStep/cameraCapture/index.js +6 -14
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +33 -45
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +8 -19
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +6 -6
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +9 -21
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +7 -7
- package/build/step/cameraStep/cameraCapture/screens/index.js +6 -14
- package/build/step/cameraStep/cameraCapture/tracking/index.js +17 -99
- package/build/step/cameraStep/cameraCapture/utils/index.js +33 -96
- package/build/step/cameraStep/index.js +6 -14
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +20 -21
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +8 -8
- package/build/step/externalConfirmationStep/index.js +6 -14
- package/build/step/index.js +7 -15
- package/build/step/layoutStep/LayoutStep.js +19 -19
- package/build/step/layoutStep/index.js +6 -14
- package/build/step/layoutStep/utils/index.js +3 -14
- package/build/step/layoutStep/utils/inline-reference-utils.js +29 -46
- package/build/step/layoutStep/utils/layout-utils.js +34 -53
- package/build/types/common/FormControl.js +1 -1
- package/build/types/index.js +13 -13
- package/build/types/specification/Action.js +1 -1
- package/build/types/specification/FileUploadSchema.js +1 -1
- package/build/types/specification/LayoutComponent.js +1 -1
- package/build/types/specification/Model.js +9 -17
- package/build/types/specification/PersistAsync.js +1 -1
- package/build/types/specification/Polling.js +1 -1
- package/build/types/specification/Promotion.js +1 -1
- package/build/types/specification/Schema.js +8 -8
- package/build/types/specification/Step.js +3 -5
- package/build/types/specification/ValidationAsync.js +1 -1
- package/build/types/specification/core.js +1 -1
- package/package.json +1 -1
|
@@ -1,77 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
-
if (ar || !(i in from)) {
|
|
16
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
-
ar[i] = from[i];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
-
};
|
|
22
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
|
-
exports
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const layout_1 = require("../../layout");
|
|
9
|
+
const genericSchema_1 = __importDefault(require("../genericSchema"));
|
|
10
|
+
const objectSchema_1 = __importDefault(require("../objectSchema"));
|
|
11
|
+
const promoted_one_of_utils_1 = require("./promoted-one-of-utils");
|
|
12
|
+
const PromotedOneOfControl_1 = __importDefault(require("./promotedOneOfControl/PromotedOneOfControl"));
|
|
13
|
+
const isPromoted = (schema) => schema.promoted === true;
|
|
14
|
+
const PromotedOneOfSchema = (props) => {
|
|
35
15
|
var _a;
|
|
36
16
|
// TODO: LOW avoid type assertion -- actually non-null assertion operator: props.model!
|
|
37
|
-
|
|
38
|
-
((_a = props.schema.promotion) === null || _a === void 0 ? void 0 : _a
|
|
39
|
-
'promoted')
|
|
40
|
-
|
|
41
|
-
|
|
17
|
+
const [selection, setSelection] = (0, react_1.useState)((0, promoted_one_of_utils_1.getSelectionFromModel)(props.schema, props.model) ||
|
|
18
|
+
((_a = props.schema.promotion) === null || _a === void 0 ? void 0 : _a.default) ||
|
|
19
|
+
'promoted');
|
|
20
|
+
const promotedAlert = props.schema.alert;
|
|
21
|
+
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
42
22
|
// TODO: LOW avoid type assertion -- actually non-null assertion operator
|
|
43
23
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [promotedAlert && (0, jsx_runtime_1.jsx)(layout_1.DynamicAlert, { component: promotedAlert }), (0, jsx_runtime_1.jsx)(PromotedOneOfControl_1
|
|
24
|
+
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
25
|
+
const otherOneOf = getOtherOneOf(props.schema);
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [promotedAlert && (0, jsx_runtime_1.jsx)(layout_1.DynamicAlert, { component: promotedAlert }), (0, jsx_runtime_1.jsx)(PromotedOneOfControl_1.default, { id: props.schema.$id, title: props.schema.title,
|
|
47
27
|
// TODO: LOW avoid type assertion -- actually non-null assertion operator
|
|
48
28
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
29
|
promotedOneOf: promotedOneOf,
|
|
50
30
|
// TODO: LOW avoid type assertion -- actually non-null assertion operator
|
|
51
31
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
52
|
-
promotion: props.schema.promotion, selection: selection, setSelection: setSelection }), selection === 'promoted' && (0, jsx_runtime_1.jsx)(objectSchema_1
|
|
32
|
+
promotion: props.schema.promotion, selection: selection, setSelection: setSelection }), selection === 'promoted' && (0, jsx_runtime_1.jsx)(objectSchema_1.default, Object.assign({}, props, { schema: promotedObjectSchema })), selection === 'other' && (0, jsx_runtime_1.jsx)(genericSchema_1.default, Object.assign({}, props, { schema: otherOneOf }))] }));
|
|
53
33
|
};
|
|
54
34
|
function getPromotedObjectSchema(promotedSchema) {
|
|
55
|
-
return
|
|
35
|
+
return Object.assign(Object.assign({}, promotedSchema), {
|
|
56
36
|
// We don't need to show these since they are already displayed in the radio option
|
|
57
37
|
title: undefined, description: undefined });
|
|
58
38
|
}
|
|
59
39
|
function getOtherOneOf(schema) {
|
|
60
40
|
var _a, _b, _c;
|
|
61
|
-
|
|
62
|
-
?
|
|
63
|
-
|
|
41
|
+
const other = ((_a = schema.promotion) === null || _a === void 0 ? void 0 : _a.displayTwice)
|
|
42
|
+
? [...schema.oneOf]
|
|
43
|
+
: schema.oneOf.filter((one) => !isPromoted(one));
|
|
44
|
+
const title = (_c = (_b = schema.promotion) === null || _b === void 0 ? void 0 : _b.other.heading) === null || _c === void 0 ? void 0 : _c.text;
|
|
64
45
|
if (other.length === 1) {
|
|
65
|
-
return
|
|
46
|
+
return Object.assign(Object.assign({}, other[0]), { title });
|
|
66
47
|
}
|
|
67
48
|
if (other.length > 1) {
|
|
68
49
|
return {
|
|
69
|
-
title
|
|
50
|
+
title,
|
|
70
51
|
oneOf: other,
|
|
71
52
|
// TODO: LOW avoid type assertion -- the spec does not recognise a `control` property in ObjectSchema
|
|
72
|
-
control: schema.control
|
|
53
|
+
control: schema.control,
|
|
73
54
|
};
|
|
74
55
|
}
|
|
75
56
|
return null;
|
|
76
57
|
}
|
|
77
|
-
exports
|
|
58
|
+
exports.default = PromotedOneOfSchema;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
exports["default"] = void 0;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
15
7
|
var PromotedOneOfSchema_1 = require("./PromotedOneOfSchema");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PromotedOneOfSchema_1).default; } });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSelectionFromModel = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const utils_1 = require("../oneOfSchema/utils");
|
|
5
|
+
const getSelectionFromModel = (schema, model) => {
|
|
6
|
+
const index = (0, utils_1.getBestMatchingSchemaIndexForValue)(schema, model);
|
|
7
7
|
if (index !== null) {
|
|
8
8
|
return schema.oneOf[index].promoted ? 'promoted' : 'other';
|
|
9
9
|
}
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
-
var components_1 = require("@transferwise/components");
|
|
16
|
-
var PromotedOneOfCheckboxControl = function (props) {
|
|
17
|
-
var id = props.id, selection = props.selection, setSelection = props.setSelection;
|
|
18
|
-
var _a = props.promotion, promoted = _a.promoted, other = _a.other, checkedMeans = _a.checkedMeans;
|
|
19
|
-
var title = checkedMeans === 'other' ? other.title : (promoted === null || promoted === void 0 ? void 0 : promoted.title) || props.promotedOneOf.title;
|
|
20
|
-
var selectionWhenChecked = checkedMeans === 'other' ? 'other' : 'promoted';
|
|
21
|
-
var selectionWhenUnchecked = checkedMeans === 'other' ? 'promoted' : 'other';
|
|
22
|
-
var checked = selection === selectionWhenChecked;
|
|
23
|
-
var toggleSelection = function () {
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const components_1 = require("@transferwise/components");
|
|
5
|
+
const PromotedOneOfCheckboxControl = (props) => {
|
|
6
|
+
const { id, selection, setSelection } = props;
|
|
7
|
+
const { promoted, other, checkedMeans } = props.promotion;
|
|
8
|
+
const title = checkedMeans === 'other' ? other.title : (promoted === null || promoted === void 0 ? void 0 : promoted.title) || props.promotedOneOf.title;
|
|
9
|
+
const selectionWhenChecked = checkedMeans === 'other' ? 'other' : 'promoted';
|
|
10
|
+
const selectionWhenUnchecked = checkedMeans === 'other' ? 'promoted' : 'other';
|
|
11
|
+
const checked = selection === selectionWhenChecked;
|
|
12
|
+
const toggleSelection = () => {
|
|
24
13
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
25
14
|
};
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)("div",
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "form-group" }, { children: (0, jsx_runtime_1.jsx)(components_1.Checkbox, { id: id, label: title, checked: checked, onChange: toggleSelection }) })));
|
|
27
16
|
};
|
|
28
17
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
29
|
-
exports
|
|
18
|
+
exports.default = PromotedOneOfCheckboxControl;
|
package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
|
-
exports
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const utils_1 = require("../../../common/utils");
|
|
8
|
+
const PromotedOneOfCheckboxControl_1 = __importDefault(require("./PromotedOneOfCheckboxControl"));
|
|
9
|
+
const PromotedOneOfRadioControl_1 = __importDefault(require("./PromotedOneOfRadioControl"));
|
|
10
|
+
const PromotedOneOfControl = (props) => {
|
|
11
|
+
const controlType = props.promotion.control || 'radio';
|
|
23
12
|
switch (controlType) {
|
|
24
13
|
case 'radio':
|
|
25
|
-
return (0, jsx_runtime_1.jsx)(PromotedOneOfRadioControl_1
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(PromotedOneOfRadioControl_1.default, Object.assign({}, props));
|
|
26
15
|
case 'checkbox':
|
|
27
|
-
return (0, jsx_runtime_1.jsx)(PromotedOneOfCheckboxControl_1
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(PromotedOneOfCheckboxControl_1.default, Object.assign({}, props));
|
|
28
17
|
default:
|
|
29
18
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
30
19
|
}
|
|
31
20
|
};
|
|
32
21
|
PromotedOneOfControl.defaultProps = {
|
|
33
22
|
id: (0, utils_1.generateRandomId)(),
|
|
34
|
-
title: undefined
|
|
23
|
+
title: undefined,
|
|
35
24
|
};
|
|
36
|
-
exports
|
|
25
|
+
exports.default = PromotedOneOfControl;
|
package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
-
var components_1 = require("@transferwise/components");
|
|
16
|
-
var utils_1 = require("../../schemaFormControl/utils");
|
|
17
|
-
var PromotedOneOfRadioControl = function (props) {
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const components_1 = require("@transferwise/components");
|
|
5
|
+
const utils_1 = require("../../schemaFormControl/utils");
|
|
6
|
+
const PromotedOneOfRadioControl = (props) => {
|
|
18
7
|
var _a, _b;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
9
|
+
const radios = [
|
|
10
|
+
Object.assign(Object.assign({ value: 'promoted',
|
|
22
11
|
// TODO: LOW avoid type assertion below the expression may be nullish, but "label" cannot be
|
|
23
12
|
label: (((_a = promotion.promoted) === null || _a === void 0 ? void 0 : _a.title) || promotedOneOf.title), secondary: ((_b = promotion.promoted) === null || _b === void 0 ? void 0 : _b.description) || promotedOneOf.description }, (0, utils_1.mapIconToAvatar)(promotedOneOf.icon)), (0, utils_1.mapAvatar)(promotedOneOf.image)),
|
|
24
|
-
|
|
13
|
+
Object.assign(Object.assign({ value: 'other', label: promotion.other.title, secondary: promotion.other.description }, (0, utils_1.mapIconToAvatar)(promotion.other.icon)), (0, utils_1.mapAvatar)(promotion.other.image)),
|
|
25
14
|
];
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)("div",
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "form-group" }, { children: [title && ((0, jsx_runtime_1.jsx)("label", Object.assign({ className: "control-label", htmlFor: id }, { children: title }))), (0, jsx_runtime_1.jsx)(components_1.RadioGroup, { name: "promoted-selection", selectedValue: selection, radios: radios,
|
|
27
16
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
28
17
|
// @ts-expect-error -- TODO: avoid @ts-ignore -- apparently RadioGroup does not expect an id prop
|
|
29
18
|
id: id, onChange: setSelection })] })));
|
|
30
19
|
};
|
|
31
20
|
PromotedOneOfRadioControl.defaultProps = {
|
|
32
|
-
title: undefined
|
|
21
|
+
title: undefined,
|
|
33
22
|
};
|
|
34
|
-
exports
|
|
23
|
+
exports.default = PromotedOneOfRadioControl;
|
|
@@ -2,32 +2,30 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var value = getValueForSchema({ schema: schema, model: model, formatMessage: formatMessage });
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const components_1 = require("@transferwise/components");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const validators_1 = require("../../common/validators");
|
|
10
|
+
const types_1 = require("../../types");
|
|
11
|
+
const currency_utils_1 = require("../schemaFormControl/utils/currency-utils");
|
|
12
|
+
const ReadOnlySchema_messages_1 = __importDefault(require("./ReadOnlySchema.messages"));
|
|
13
|
+
const ReadOnlySchema = ({ schema, model }) => {
|
|
14
|
+
const { title = '' } = schema;
|
|
15
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
16
|
+
const value = getValueForSchema({ schema, model, formatMessage });
|
|
18
17
|
// FIXME: This is a workaround for the fact that the DefinitionList component value prop doesn't match Model
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(components_1.DefinitionList, { layout: components_1.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(components_1.DefinitionList, { layout: components_1.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: '' }] }));
|
|
20
19
|
};
|
|
21
|
-
exports
|
|
22
|
-
function getValueForSchema(
|
|
23
|
-
var schema = _a.schema, model = _a.model, formatMessage = _a.formatMessage;
|
|
20
|
+
exports.default = ReadOnlySchema;
|
|
21
|
+
function getValueForSchema({ schema, model, formatMessage, }) {
|
|
24
22
|
if ((0, types_1.isBasicSchema)(schema)) {
|
|
25
23
|
if ((0, types_1.isOneOfSchema)(schema)) {
|
|
26
24
|
return getValueFromOneOfSchema(schema, model);
|
|
27
25
|
}
|
|
28
26
|
else {
|
|
29
27
|
if (schema.type === 'boolean' && (0, validators_1.isBoolean)(model)) {
|
|
30
|
-
return model ? formatMessage(ReadOnlySchema_messages_1
|
|
28
|
+
return model ? formatMessage(ReadOnlySchema_messages_1.default.yes) : formatMessage(ReadOnlySchema_messages_1.default.no);
|
|
31
29
|
}
|
|
32
30
|
else {
|
|
33
31
|
return (model && model.toString()) || '';
|
|
@@ -37,24 +35,24 @@ function getValueForSchema(_a) {
|
|
|
37
35
|
return '';
|
|
38
36
|
}
|
|
39
37
|
function getValueFromOneOfSchema(schema, model) {
|
|
40
|
-
|
|
38
|
+
const option = getSelectedOneOf(schema, model);
|
|
41
39
|
// FIXME Remove type assertion
|
|
42
40
|
return option ? getValueFromOption(option) : model;
|
|
43
41
|
}
|
|
44
42
|
function getSelectedOneOf(schema, model) {
|
|
45
|
-
return schema.oneOf.find(
|
|
46
|
-
return 'const' in childSchema ? model === childSchema
|
|
43
|
+
return schema.oneOf.find((childSchema) => {
|
|
44
|
+
return 'const' in childSchema ? model === childSchema.const : false;
|
|
47
45
|
});
|
|
48
46
|
}
|
|
49
47
|
function getValueFromOption(option) {
|
|
50
|
-
|
|
51
|
-
?
|
|
48
|
+
const text = option.title && option.description
|
|
49
|
+
? `${option.title} - ${option.description}`
|
|
52
50
|
: option.title || '';
|
|
53
|
-
|
|
51
|
+
const currencyFlag = getCurrencyFlagFromOption(option);
|
|
54
52
|
return currencyFlag ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [currencyFlag, " ", text] })) : (text);
|
|
55
53
|
}
|
|
56
54
|
function getCurrencyFlagFromOption(option) {
|
|
57
55
|
var _a, _b;
|
|
58
|
-
|
|
59
|
-
return currency ? (0, jsx_runtime_1.jsx)("i", { className:
|
|
56
|
+
const currency = (_b = (0, currency_utils_1.getCurrencyFlag)((_a = option.icon) === null || _a === void 0 ? void 0 : _a.name)) === null || _b === void 0 ? void 0 : _b.currency;
|
|
57
|
+
return currency ? (0, jsx_runtime_1.jsx)("i", { className: `currency-flag currency-flag-${currency} hidden-xs` }) : null;
|
|
60
58
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
|
|
4
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_intl_1 = require("react-intl");
|
|
4
|
+
exports.default = (0, react_intl_1.defineMessages)({
|
|
5
5
|
yes: {
|
|
6
6
|
id: 'dynamicFlows.ReadOnlySchema.yes',
|
|
7
7
|
defaultMessage: 'Yes',
|
|
8
|
-
description: 'Yes, used for boolean schemas with a value of true.'
|
|
8
|
+
description: 'Yes, used for boolean schemas with a value of true.',
|
|
9
9
|
},
|
|
10
10
|
no: {
|
|
11
11
|
id: 'dynamicFlows.ReadOnlySchema.no',
|
|
12
12
|
defaultMessage: 'No',
|
|
13
|
-
description: 'No: used for boolean schemas with a value of false.'
|
|
14
|
-
}
|
|
13
|
+
description: 'No: used for boolean schemas with a value of false.',
|
|
14
|
+
},
|
|
15
15
|
});
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
exports["default"] = void 0;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
15
7
|
var ReadOnlySchema_1 = require("./ReadOnlySchema");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ReadOnlySchema_1).default; } });
|
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.getControlType = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const constants_1 = require("../../common/constants");
|
|
9
|
+
const contexts_1 = require("../../common/contexts");
|
|
10
|
+
const validators_1 = require("../../common/validators");
|
|
11
|
+
const formControl_1 = __importDefault(require("../../formControl"));
|
|
12
|
+
const types_1 = require("../../types");
|
|
13
|
+
const utils_1 = require("./utils");
|
|
14
|
+
const isNativeInput = (propsSchemaType) => {
|
|
26
15
|
return propsSchemaType === 'string' || propsSchemaType === 'number';
|
|
27
16
|
};
|
|
28
|
-
|
|
17
|
+
const getControlType = (schema) => {
|
|
29
18
|
if ('control' in schema && schema.control) {
|
|
30
19
|
if ((0, types_1.isOneOfSchema)(schema) && schema.oneOf.length > 3) {
|
|
31
20
|
return constants_1.FormControlType.SELECT;
|
|
@@ -58,36 +47,34 @@ var getControlType = function (schema) {
|
|
|
58
47
|
return schema.type;
|
|
59
48
|
};
|
|
60
49
|
exports.getControlType = getControlType;
|
|
61
|
-
|
|
50
|
+
const getOptions = (schema, controlType) => {
|
|
62
51
|
if (schema.oneOf) {
|
|
63
|
-
return schema.oneOf.map(
|
|
52
|
+
return schema.oneOf.map((childSchema) => (0, utils_1.mapConstSchemaToOption)(childSchema, controlType));
|
|
64
53
|
}
|
|
65
54
|
return null;
|
|
66
55
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
var onChange = function (value, type) {
|
|
56
|
+
const SchemaFormControl = (props) => {
|
|
57
|
+
const log = (0, contexts_1.useLogger)();
|
|
58
|
+
const getSanitisedValue = (value) => isNativeInput(props.schema.type) && ((0, validators_1.isNull)(value) || (0, validators_1.isUndefined)(value)) ? '' : value;
|
|
59
|
+
const onChange = (value, type) => {
|
|
73
60
|
props.onChange((0, validators_1.getValidBasicModelOrNull)(value, props.schema), type);
|
|
74
61
|
};
|
|
75
|
-
|
|
62
|
+
const controlType = (0, exports.getControlType)(props.schema);
|
|
76
63
|
if (controlType === 'file') {
|
|
77
64
|
log.warning('Deprecation advanced warning', 'Please use a persist-async blob schema instead of string with base64url for file uploads. The base64url does not perform well on low end devices. Support for this schema will be removed in a later release.');
|
|
78
65
|
}
|
|
79
66
|
if (props.schema.values) {
|
|
80
67
|
log.error('Deprecated schema', 'Schema.values is a legacy approach. Please use oneOf.');
|
|
81
68
|
}
|
|
82
|
-
|
|
83
|
-
|
|
69
|
+
const options = props.schema.values || getOptions(props.schema, controlType);
|
|
70
|
+
const events = {
|
|
84
71
|
onFocus: props.onFocus,
|
|
85
72
|
onBlur: props.onBlur,
|
|
86
73
|
onSearchChange: props.onSearchChange,
|
|
87
|
-
onChange
|
|
74
|
+
onChange,
|
|
88
75
|
};
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
const safeValue = getSanitisedValue(props.value);
|
|
77
|
+
const controlProps = {
|
|
91
78
|
id: props.id,
|
|
92
79
|
name: props.id,
|
|
93
80
|
label: props.schema.title,
|
|
@@ -97,15 +84,15 @@ var SchemaFormControl = function (props) {
|
|
|
97
84
|
disabled: props.disabled || props.schema.disabled,
|
|
98
85
|
displayPattern: props.schema.displayFormat,
|
|
99
86
|
// TODO: LOW avoid type assertion below
|
|
100
|
-
uploadProps: (0, utils_1.mapSchemaToUploadOptions)(props.schema)
|
|
87
|
+
uploadProps: (0, utils_1.mapSchemaToUploadOptions)(props.schema),
|
|
101
88
|
};
|
|
102
|
-
return (0, jsx_runtime_1.jsx)(formControl_1
|
|
89
|
+
return (0, jsx_runtime_1.jsx)(formControl_1.default, Object.assign({ type: controlType, value: safeValue }, events, controlProps));
|
|
103
90
|
};
|
|
104
91
|
SchemaFormControl.defaultProps = {
|
|
105
92
|
value: null,
|
|
106
93
|
onFocus: null,
|
|
107
94
|
onBlur: null,
|
|
108
95
|
onSearchChange: null,
|
|
109
|
-
disabled: false
|
|
96
|
+
disabled: false,
|
|
110
97
|
};
|
|
111
|
-
exports
|
|
98
|
+
exports.default = SchemaFormControl;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
exports["default"] = void 0;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
15
7
|
var SchemaFormControl_1 = require("./SchemaFormControl");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(SchemaFormControl_1).default; } });
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCurrencyFlag = void 0;
|
|
4
4
|
function getCurrencyFlag(iconName) {
|
|
5
5
|
if (iconName) {
|
|
6
|
-
|
|
6
|
+
const index = availablePrefixedCurrencyFlags.indexOf(iconName);
|
|
7
7
|
if (index >= 0) {
|
|
8
8
|
return {
|
|
9
|
-
currency: availableCurrencyFlags[index]
|
|
9
|
+
currency: availableCurrencyFlags[index],
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
exports.getCurrencyFlag = getCurrencyFlag;
|
|
16
|
-
|
|
16
|
+
const availableCurrencyFlags = [
|
|
17
17
|
'eur',
|
|
18
18
|
'gbp',
|
|
19
19
|
'inr',
|
|
@@ -74,4 +74,4 @@ var availableCurrencyFlags = [
|
|
|
74
74
|
'zar',
|
|
75
75
|
'zmw',
|
|
76
76
|
];
|
|
77
|
-
|
|
77
|
+
const availablePrefixedCurrencyFlags = availableCurrencyFlags.map((code) => `flag-${code}`);
|
|
@@ -13,5 +13,5 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./mapping-utils"), exports);
|