@engagebay/engagebay-form-module 1.0.8-beta.2 → 1.0.8-beta.3
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/package.json
CHANGED
|
@@ -126,13 +126,13 @@ const FileUploadField: React.FC<FormFieldComponentPropSchema> = (
|
|
|
126
126
|
) : (
|
|
127
127
|
<div className="flex">
|
|
128
128
|
<span className="m-2">
|
|
129
|
-
|
|
129
|
+
{file?.name || file?.toString?.() || ''}
|
|
130
130
|
</span>{" "}
|
|
131
131
|
<button
|
|
132
132
|
onClick={(e) => {
|
|
133
133
|
e.preventDefault();
|
|
134
134
|
formContext.setValue(
|
|
135
|
-
props.fieldConfig.name,
|
|
135
|
+
props.fieldConfig.name,null
|
|
136
136
|
);
|
|
137
137
|
setFile(null);
|
|
138
138
|
}}
|
|
@@ -11,14 +11,14 @@ import { handleChange } from ".";
|
|
|
11
11
|
import { LoaderWithText } from "../../util/LoaderWithText";
|
|
12
12
|
import SVGIcon from "../../util/svg/SVGIcon";
|
|
13
13
|
import { FormContextType } from "../context/FormContext";
|
|
14
|
+
import Tippy from "@tippyjs/react";
|
|
14
15
|
import {
|
|
15
16
|
FieldOptionsSchema,
|
|
16
17
|
FormFieldSchema,
|
|
17
18
|
FormFieldType,
|
|
18
19
|
OutputFormatType,
|
|
19
20
|
} from "../schema/FormFieldSchema";
|
|
20
|
-
import
|
|
21
|
-
import { normalizeMultiSelectValue } from "./normalizeCustomFieldValues";
|
|
21
|
+
import { normalizeMultiSelectValue, normalizeMultiSelectValueForStringArrayValues } from "./normalizeCustomFieldValues";
|
|
22
22
|
type RenderListOptionsProps = {
|
|
23
23
|
formContext: FormContextType;
|
|
24
24
|
fieldConfig: FormFieldSchema;
|
|
@@ -373,7 +373,7 @@ export function renderListBoxValue(
|
|
|
373
373
|
listOptions: FieldOptionsSchema[],
|
|
374
374
|
onChange?: (value: any) => void,
|
|
375
375
|
): JSX.Element {
|
|
376
|
-
let value =
|
|
376
|
+
let value = normalizeMultiSelectValueForStringArrayValues(fieldConfig, formContext.getValues(fieldConfig.name));
|
|
377
377
|
const renderAsString = () => {
|
|
378
378
|
// if (!listOptions) {
|
|
379
379
|
// return value;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
|
+
import { FormFieldSchema, OutputFormatType } from "../schema/FormFieldSchema";
|
|
2
3
|
|
|
3
4
|
const normalizeStringToken = (value: unknown): string => {
|
|
4
5
|
return typeof value === "string" ? value.trim() : String(value).trim();
|
|
@@ -113,3 +114,10 @@ export const normalizeDateInputValue = (
|
|
|
113
114
|
};
|
|
114
115
|
|
|
115
116
|
|
|
117
|
+
export const normalizeMultiSelectValueForStringArrayValues = (fieldConfig: FormFieldSchema, value: any): string[] => {
|
|
118
|
+
if (fieldConfig.outputFormat === OutputFormatType.STRING) {
|
|
119
|
+
return normalizeMultiSelectValue(value);
|
|
120
|
+
}
|
|
121
|
+
return value;
|
|
122
|
+
};
|
|
123
|
+
|