@nolwenture/formik-jsonschema-form 0.23.3 → 0.25.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/dist/Form.stories.d.ts +1 -0
- package/dist/Form.stories.js +4 -0
- package/dist/FormPdf.d.ts +6 -0
- package/dist/FormPdf.js +48 -0
- package/dist/FormPdf.stories.d.ts +11 -0
- package/dist/FormPdf.stories.js +148 -0
- package/dist/FormPdf.test.d.ts +1 -0
- package/dist/FormPdf.test.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pdfFields/AnyField.d.ts +3 -0
- package/dist/pdfFields/AnyField.js +22 -0
- package/dist/pdfFields/ArrayField.d.ts +3 -0
- package/dist/pdfFields/ArrayField.js +41 -0
- package/dist/pdfFields/BooleanField.d.ts +3 -0
- package/dist/pdfFields/BooleanField.js +27 -0
- package/dist/pdfFields/DateField.d.ts +3 -0
- package/dist/pdfFields/DateField.js +16 -0
- package/dist/pdfFields/EJSField.d.ts +3 -0
- package/dist/pdfFields/EJSField.js +24 -0
- package/dist/pdfFields/MultipleChoiceField.d.ts +3 -0
- package/dist/pdfFields/MultipleChoiceField.js +20 -0
- package/dist/pdfFields/NullField.d.ts +3 -0
- package/dist/pdfFields/NullField.js +8 -0
- package/dist/pdfFields/NumberField.d.ts +3 -0
- package/dist/pdfFields/NumberField.js +6 -0
- package/dist/pdfFields/ObjectField.d.ts +3 -0
- package/dist/pdfFields/ObjectField.js +59 -0
- package/dist/pdfFields/RadioField.d.ts +3 -0
- package/dist/pdfFields/RadioField.js +6 -0
- package/dist/pdfFields/SchemaField.d.ts +3 -0
- package/dist/pdfFields/SchemaField.js +31 -0
- package/dist/pdfFields/SearchMultiTagSelectField.d.ts +3 -0
- package/dist/pdfFields/SearchMultiTagSelectField.js +14 -0
- package/dist/pdfFields/SearchableSelectField.d.ts +3 -0
- package/dist/pdfFields/SearchableSelectField.js +9 -0
- package/dist/pdfFields/StringField.d.ts +3 -0
- package/dist/pdfFields/StringField.js +27 -0
- package/dist/pdfFields/TextAreaField.d.ts +3 -0
- package/dist/pdfFields/TextAreaField.js +13 -0
- package/dist/pdfFields/ToggleField.d.ts +3 -0
- package/dist/pdfFields/ToggleField.js +6 -0
- package/dist/pdfFields/index.d.ts +16 -0
- package/dist/pdfFields/index.js +16 -0
- package/dist/pdfFields/types.d.ts +10 -0
- package/dist/pdfFields/types.js +10 -0
- package/dist/pdfTemplates/ArrayFieldTemplate.d.ts +3 -0
- package/dist/pdfTemplates/ArrayFieldTemplate.js +16 -0
- package/dist/pdfTemplates/CollapsibleObjectFieldTemplate.d.ts +3 -0
- package/dist/pdfTemplates/CollapsibleObjectFieldTemplate.js +20 -0
- package/dist/pdfTemplates/FieldTemplate.d.ts +3 -0
- package/dist/pdfTemplates/FieldTemplate.js +15 -0
- package/dist/pdfTemplates/ObjectFieldTemplate.d.ts +3 -0
- package/dist/pdfTemplates/ObjectFieldTemplate.js +18 -0
- package/dist/pdfTemplates/index.d.ts +4 -0
- package/dist/pdfTemplates/index.js +4 -0
- package/dist/sampleData/completeSchema.d.ts +1 -0
- package/dist/sampleData/completeSchema.js +23 -2
- package/dist/sampleData/ejsSchema.d.ts +6 -0
- package/dist/sampleData/ejsSchema.js +25 -0
- package/dist/sampleData/multipleChoiceSchema.d.ts +6 -0
- package/dist/sampleData/multipleChoiceSchema.js +8 -1
- package/dist/sampleData/pdfProExampleSchema.d.ts +21 -0
- package/dist/sampleData/pdfProExampleSchema.js +185 -0
- package/dist/sampleData/simpleData.js +1 -0
- package/dist/styledComponents.d.ts +12 -1
- package/dist/styledComponents.js +55 -0
- package/dist/types.d.ts +26 -0
- package/dist/utils/__tests/createValidationSchema.test.js +208 -20
- package/dist/utils/__tests/hasReferences.test.d.ts +1 -0
- package/dist/utils/__tests/hasReferences.test.js +100 -0
- package/dist/utils/createValidationSchema.js +23 -4
- package/dist/utils/getEnums.d.ts +13 -0
- package/dist/utils/getEnums.js +12 -0
- package/dist/utils/hasReferences.d.ts +2 -0
- package/dist/utils/hasReferences.js +12 -0
- package/package.json +2 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useExtractUiSchema, useSetDefault } from "../hooks";
|
|
3
|
+
import { StringField } from "./StringField";
|
|
4
|
+
export const SearchableSelectField = (props) => {
|
|
5
|
+
useSetDefault(props);
|
|
6
|
+
const { uiSchema } = props;
|
|
7
|
+
const { props: inputProps } = useExtractUiSchema(uiSchema);
|
|
8
|
+
return _jsx(StringField, Object.assign({}, props, inputProps));
|
|
9
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useMemo } from "react";
|
|
3
|
+
import { FormPdfRegistry } from "../FormPdf";
|
|
4
|
+
import { useExtractUiSchema, useSetDefault } from "../hooks";
|
|
5
|
+
import { useFormikContext } from "formik";
|
|
6
|
+
import { getEnums } from "../utils";
|
|
7
|
+
function getValueByPath(obj, path) {
|
|
8
|
+
const parts = path
|
|
9
|
+
.split(".")
|
|
10
|
+
.flatMap((part) => part.replace(/\[(\d+)\]/g, ".$1").split("."));
|
|
11
|
+
return parts.reduce((acc, part) => acc && acc[part], obj);
|
|
12
|
+
}
|
|
13
|
+
export const StringField = (props) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const { templates: { FieldTemplate }, components: { StringFieldPdf }, } = useContext(FormPdfRegistry);
|
|
16
|
+
useSetDefault(props);
|
|
17
|
+
const { name, uiSchema = {}, schema } = props;
|
|
18
|
+
const { values } = useFormikContext();
|
|
19
|
+
const { type, placeholder, props: inputProps } = useExtractUiSchema(uiSchema);
|
|
20
|
+
const enums = useMemo(() => getEnums(props), [props]);
|
|
21
|
+
let value = values[name] !== undefined ? values[name] : getValueByPath(values, name);
|
|
22
|
+
if (enums !== undefined) {
|
|
23
|
+
value =
|
|
24
|
+
(_b = (_a = enums.values.find((element) => element.const === value)) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : value;
|
|
25
|
+
}
|
|
26
|
+
return (_jsx(FieldTemplate, Object.assign({}, props, { children: _jsx(StringFieldPdf, { name: name, "data-keyword": values[name], value: value }) })));
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { FormPdfRegistry } from "../FormPdf";
|
|
4
|
+
import { useExtractUiSchema, useSetDefault } from "../hooks";
|
|
5
|
+
import { useFormikContext } from "formik";
|
|
6
|
+
export const TextAreaField = (props) => {
|
|
7
|
+
const { templates: { FieldTemplate }, components: { TextAreaPdf }, } = useContext(FormPdfRegistry);
|
|
8
|
+
useSetDefault(props);
|
|
9
|
+
const { name, uiSchema } = props;
|
|
10
|
+
const { props: inputProps } = useExtractUiSchema(uiSchema);
|
|
11
|
+
const { values } = useFormikContext();
|
|
12
|
+
return (_jsx(FieldTemplate, Object.assign({}, props, { children: _jsx(TextAreaPdf, { name: name, children: values[name] }) })));
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BooleanField } from "./BooleanField";
|
|
3
|
+
export const ToggleField = (props) => {
|
|
4
|
+
var _a;
|
|
5
|
+
return (_jsx(BooleanField, Object.assign({}, props, { uiSchema: Object.assign(Object.assign({}, props.uiSchema), { "ui:props": Object.assign(Object.assign({}, (((_a = props.uiSchema) === null || _a === void 0 ? void 0 : _a["ui:props"]) || {})), { type: "boolean" }) }) })));
|
|
6
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./ArrayField";
|
|
2
|
+
export * from "./BooleanField";
|
|
3
|
+
export * from "./DateField";
|
|
4
|
+
export * from "./NullField";
|
|
5
|
+
export * from "./NumberField";
|
|
6
|
+
export * from "./ObjectField";
|
|
7
|
+
export * from "./SchemaField";
|
|
8
|
+
export * from "./StringField";
|
|
9
|
+
export * from "./AnyField";
|
|
10
|
+
export * from "./RadioField";
|
|
11
|
+
export * from "./ToggleField";
|
|
12
|
+
export * from "./SearchMultiTagSelectField";
|
|
13
|
+
export * from "./SearchableSelectField";
|
|
14
|
+
export * from "./MultipleChoiceField";
|
|
15
|
+
export * from "./TextAreaField";
|
|
16
|
+
export * from "./EJSField";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./ArrayField";
|
|
2
|
+
export * from "./BooleanField";
|
|
3
|
+
export * from "./DateField";
|
|
4
|
+
export * from "./NullField";
|
|
5
|
+
export * from "./NumberField";
|
|
6
|
+
export * from "./ObjectField";
|
|
7
|
+
export * from "./SchemaField";
|
|
8
|
+
export * from "./StringField";
|
|
9
|
+
export * from "./AnyField";
|
|
10
|
+
export * from "./RadioField";
|
|
11
|
+
export * from "./ToggleField";
|
|
12
|
+
export * from "./SearchMultiTagSelectField";
|
|
13
|
+
export * from "./SearchableSelectField";
|
|
14
|
+
export * from "./MultipleChoiceField";
|
|
15
|
+
export * from "./TextAreaField";
|
|
16
|
+
export * from "./EJSField";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { FormPdfRegistry } from "../FormPdf";
|
|
4
|
+
import { getDescription, getTitle } from "../utils";
|
|
5
|
+
import { useExtractUiSchema } from "../hooks";
|
|
6
|
+
import { RequiredIndicator } from "../styledComponents";
|
|
7
|
+
export const ArrayFieldTemplate = (props) => {
|
|
8
|
+
const { components: { ArrayFieldWrapper, ArrayFieldTitle, FieldDescription, ErrorMessage, FieldHelp, InfoFieldButton, }, } = useContext(FormPdfRegistry);
|
|
9
|
+
const { name, uiSchema, children } = props;
|
|
10
|
+
const title = getTitle(props);
|
|
11
|
+
const description = getDescription(props);
|
|
12
|
+
const { help, info,
|
|
13
|
+
//TODO: This is not right
|
|
14
|
+
props: { wrapper: wrapperProps, title: titleProps, description: descriptionProps, help: helpProps, error: errorProps, } = {}, } = useExtractUiSchema(uiSchema);
|
|
15
|
+
return (_jsxs(ArrayFieldWrapper, Object.assign({}, wrapperProps, { children: [title && (_jsxs(ArrayFieldTitle, Object.assign({}, titleProps, { htmlFor: name, children: [title, (props === null || props === void 0 ? void 0 : props.required) && _jsx(RequiredIndicator, { children: "*" })] }))), info && _jsx(InfoFieldButton, Object.assign({}, info)), description && (_jsx(FieldDescription, Object.assign({}, descriptionProps, { children: description }))), children, help && _jsx(FieldHelp, Object.assign({}, helpProps, { children: help })), _jsx(ErrorMessage, Object.assign({}, errorProps, { name: name }))] })));
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useState } from "react";
|
|
3
|
+
import { FormRegistry } from "../Form";
|
|
4
|
+
import { getDescription, getTitle } from "../utils";
|
|
5
|
+
import { useExtractUiSchema } from "../hooks";
|
|
6
|
+
import { CollapsibleChildWrapper, CollapsibleToggle, Icon, RequiredIndicator, } from "../styledComponents";
|
|
7
|
+
export const CollapsibleObjectFieldTemplate = (props) => {
|
|
8
|
+
const { components: { FieldDescription, CollapsibleObjectFieldTitle, CollapsibleObjectFieldWrapper, FieldHelp, InfoFieldButton, }, } = useContext(FormRegistry);
|
|
9
|
+
const { children, name, uiSchema } = props;
|
|
10
|
+
const title = getTitle(props);
|
|
11
|
+
const description = getDescription(props);
|
|
12
|
+
const { help, info,
|
|
13
|
+
//TODO: This is not right
|
|
14
|
+
props: { wrapper: wrapperProps, title: titleProps, description: descriptionProps, help: helpProps, isCollapsedOnLoad = true, openIcon, collapsedIcon, ariaLabel,
|
|
15
|
+
// error: errorProps,
|
|
16
|
+
} = {}, } = useExtractUiSchema(uiSchema);
|
|
17
|
+
const [collapsed, setCollapsed] = useState(isCollapsedOnLoad);
|
|
18
|
+
const hide = collapsed;
|
|
19
|
+
return (_jsxs(CollapsibleObjectFieldWrapper, Object.assign({}, wrapperProps, { children: [title && (_jsx(CollapsibleToggle, { onClick: () => setCollapsed(!collapsed), ariaExpanded: !hide, ariaLabel: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : name, children: _jsxs(CollapsibleObjectFieldTitle, Object.assign({ style: { display: "flex", alignItems: "center" } }, titleProps, { children: [title, (props === null || props === void 0 ? void 0 : props.required) && _jsx(RequiredIndicator, { children: "*" }), _jsx(Icon, { children: hide ? collapsedIcon !== null && collapsedIcon !== void 0 ? collapsedIcon : "▸" : openIcon !== null && openIcon !== void 0 ? openIcon : "▾" })] })) })), info && _jsx(InfoFieldButton, Object.assign({}, info)), description && (_jsx(FieldDescription, Object.assign({}, descriptionProps, { children: description }))), !hide && _jsx(CollapsibleChildWrapper, { children: children }), help && _jsx(FieldHelp, Object.assign({}, helpProps, { children: help }))] })));
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { FormPdfRegistry } from "../FormPdf";
|
|
4
|
+
import { getDescription, getTitle } from "../utils";
|
|
5
|
+
import { useExtractUiSchema } from "../hooks";
|
|
6
|
+
export const FieldTemplate = (props) => {
|
|
7
|
+
const { components: { FieldWrapper, FieldTitle, FieldDescription, FieldHelp, RequiredIndicator, }, } = useContext(FormPdfRegistry);
|
|
8
|
+
const { name, uiSchema, children } = props;
|
|
9
|
+
const title = getTitle(props);
|
|
10
|
+
const description = getDescription(props);
|
|
11
|
+
const { help,
|
|
12
|
+
//TODO: This is not right
|
|
13
|
+
props: { wrapper: wrapperProps, title: titleProps, description: descriptionProps, help: helpProps, } = {}, } = useExtractUiSchema(uiSchema);
|
|
14
|
+
return (_jsxs(FieldWrapper, Object.assign({}, wrapperProps, { children: [title && (_jsxs(FieldTitle, Object.assign({}, titleProps, { htmlFor: name, children: [title, props.required && _jsx(RequiredIndicator, { children: "*" })] }))), description && (_jsx(FieldDescription, Object.assign({}, descriptionProps, { children: description }))), children, help && _jsx(FieldHelp, Object.assign({}, helpProps, { children: help }))] })));
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { FormPdfRegistry } from "../FormPdf";
|
|
4
|
+
import { getDescription, getTitle } from "../utils";
|
|
5
|
+
import { useExtractUiSchema } from "../hooks";
|
|
6
|
+
import { RequiredIndicator } from "../styledComponents";
|
|
7
|
+
export const ObjectFieldTemplate = (props) => {
|
|
8
|
+
const { components: { FieldDescription, ObjectFieldTitle, ObjectFieldWrapper, FieldHelp, InfoFieldButton, }, } = useContext(FormPdfRegistry);
|
|
9
|
+
const { children, uiSchema } = props;
|
|
10
|
+
const title = getTitle(props);
|
|
11
|
+
const description = getDescription(props);
|
|
12
|
+
const { help, info,
|
|
13
|
+
//TODO: This is not right
|
|
14
|
+
props: { wrapper: wrapperProps, title: titleProps, description: descriptionProps, help: helpProps,
|
|
15
|
+
// error: errorProps,
|
|
16
|
+
} = {}, } = useExtractUiSchema(uiSchema);
|
|
17
|
+
return (_jsxs(ObjectFieldWrapper, Object.assign({}, wrapperProps, { children: [title && (_jsxs(ObjectFieldTitle, Object.assign({}, titleProps, { children: [title, (props === null || props === void 0 ? void 0 : props.required) && _jsx(RequiredIndicator, { children: "*" })] }))), info && _jsx(InfoFieldButton, Object.assign({}, info)), description && (_jsx(FieldDescription, Object.assign({}, descriptionProps, { children: description }))), children, help && _jsx(FieldHelp, Object.assign({}, helpProps, { children: help }))] })));
|
|
18
|
+
};
|
|
@@ -155,8 +155,13 @@ export const completeSchema = {
|
|
|
155
155
|
title: "Enum array",
|
|
156
156
|
description: "Enum array description",
|
|
157
157
|
additionalItems: {
|
|
158
|
-
type: "
|
|
159
|
-
|
|
158
|
+
type: "string",
|
|
159
|
+
oneOf: [
|
|
160
|
+
{ const: 1, title: "one" },
|
|
161
|
+
{ const: 2, title: "two" },
|
|
162
|
+
{ const: 3, title: "three" },
|
|
163
|
+
{ const: 4, title: "four" },
|
|
164
|
+
],
|
|
160
165
|
},
|
|
161
166
|
},
|
|
162
167
|
objectArray: {
|
|
@@ -198,6 +203,17 @@ export const completeSchema = {
|
|
|
198
203
|
enum: [1, 2, 3, 4],
|
|
199
204
|
},
|
|
200
205
|
},
|
|
206
|
+
enumWithTitle: {
|
|
207
|
+
type: "number",
|
|
208
|
+
title: "Array Enum with titles",
|
|
209
|
+
description: "Array Enum with titles description",
|
|
210
|
+
oneOf: [
|
|
211
|
+
{ const: 1, title: "first option" },
|
|
212
|
+
{ const: 2, title: "second option" },
|
|
213
|
+
{ const: 3, title: "third option" },
|
|
214
|
+
{ const: 4, title: "fourth option" },
|
|
215
|
+
],
|
|
216
|
+
},
|
|
201
217
|
null: {
|
|
202
218
|
type: "null",
|
|
203
219
|
title: "Array Null",
|
|
@@ -212,6 +228,8 @@ export const completeSchema = {
|
|
|
212
228
|
title: "TextArea Field",
|
|
213
229
|
description: "TextArea field description",
|
|
214
230
|
},
|
|
231
|
+
radio: { type: "boolean", title: "Are you ready?" },
|
|
232
|
+
toggle: { type: "boolean", title: "Toggle mode" },
|
|
215
233
|
},
|
|
216
234
|
};
|
|
217
235
|
export const completeUiSchema = {
|
|
@@ -324,4 +342,7 @@ export const completeUiSchema = {
|
|
|
324
342
|
},
|
|
325
343
|
},
|
|
326
344
|
textArea: { "ui:field": "TextAreaField" },
|
|
345
|
+
radio: { "ui:field": "RadioField", "ui:label": { true: "yes", false: "no" } },
|
|
346
|
+
toggle: { "ui:field": "ToggleField" },
|
|
327
347
|
};
|
|
348
|
+
export const completePdfUiSchema = {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const ejsSchema = {
|
|
2
|
+
title: "TITLE",
|
|
3
|
+
properties: {
|
|
4
|
+
ejsTest: { type: "array", title: "EJS title" },
|
|
5
|
+
},
|
|
6
|
+
};
|
|
7
|
+
export const ejsUiSchema = {
|
|
8
|
+
"ui:description": "Description text",
|
|
9
|
+
ejsTest: {
|
|
10
|
+
"ui:field": "EJSField",
|
|
11
|
+
"ui:description": "Just a short description",
|
|
12
|
+
"ui:options": {
|
|
13
|
+
template: `<div>
|
|
14
|
+
<div><%= title %></div>
|
|
15
|
+
<div><%= description %></div>
|
|
16
|
+
<div>
|
|
17
|
+
<% value.forEach(function(v) { %>
|
|
18
|
+
<span><%= v %></span>
|
|
19
|
+
<% }); %>
|
|
20
|
+
</div>
|
|
21
|
+
</div>`,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const ejsTestValues = { ejsTest: ["flammable", "corrosive"] };
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { Schema, UiSchema } from "../types";
|
|
2
2
|
export declare const multipleChoiceSchema: Schema;
|
|
3
3
|
export declare const multipleChoiceUiSchema: UiSchema;
|
|
4
|
+
export declare const multipleChoiceValue: {
|
|
5
|
+
weather: string;
|
|
6
|
+
food: string[];
|
|
7
|
+
drinks: string[];
|
|
8
|
+
flowers: string[];
|
|
9
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const multipleChoiceSchema = {
|
|
2
|
-
title: "
|
|
2
|
+
title: "MULTIPLE CHOICE EXAMPLES",
|
|
3
3
|
required: ["lastName", "requiredNestedObject", "requiredArray"],
|
|
4
4
|
properties: {
|
|
5
5
|
weather: {
|
|
@@ -119,6 +119,13 @@ export const multipleChoiceUiSchema = {
|
|
|
119
119
|
"ui:field": "MultipleChoiceField",
|
|
120
120
|
"ui:options": {
|
|
121
121
|
style: "threeColumns",
|
|
122
|
+
onlyShowSelected: true,
|
|
122
123
|
},
|
|
123
124
|
},
|
|
124
125
|
};
|
|
126
|
+
export const multipleChoiceValue = {
|
|
127
|
+
weather: "sunny",
|
|
128
|
+
food: ["luncheon"],
|
|
129
|
+
drinks: ["water", "tea"],
|
|
130
|
+
flowers: ["poppy", "dahlia", "rose", "lilac"],
|
|
131
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Schema, UiSchema } from "../types";
|
|
2
|
+
export declare const pdfProExampleSchema: Schema;
|
|
3
|
+
export declare const pdfProExampleData: {
|
|
4
|
+
unitId: number;
|
|
5
|
+
name: string;
|
|
6
|
+
safetydatasheet: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
state: string;
|
|
10
|
+
size: string;
|
|
11
|
+
type: string;
|
|
12
|
+
accessPaths: string[];
|
|
13
|
+
}[];
|
|
14
|
+
maker: string;
|
|
15
|
+
unnumber: string;
|
|
16
|
+
warningSymbols: string[];
|
|
17
|
+
dangersafety: string;
|
|
18
|
+
date: string;
|
|
19
|
+
lastupdate: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const pdfProExampleUiSchema: UiSchema;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export const pdfProExampleSchema = {
|
|
2
|
+
type: "object",
|
|
3
|
+
title: "",
|
|
4
|
+
properties: {
|
|
5
|
+
use: {
|
|
6
|
+
type: "string",
|
|
7
|
+
},
|
|
8
|
+
date: {
|
|
9
|
+
type: "string",
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
type: "string",
|
|
13
|
+
},
|
|
14
|
+
maker: {
|
|
15
|
+
type: "string",
|
|
16
|
+
},
|
|
17
|
+
unnumber: {
|
|
18
|
+
type: "string",
|
|
19
|
+
},
|
|
20
|
+
casnumber: {
|
|
21
|
+
type: "string",
|
|
22
|
+
},
|
|
23
|
+
arrivalday: {
|
|
24
|
+
type: "string",
|
|
25
|
+
},
|
|
26
|
+
lastupdate: {
|
|
27
|
+
type: "string",
|
|
28
|
+
},
|
|
29
|
+
dangersafety: {
|
|
30
|
+
type: "string",
|
|
31
|
+
},
|
|
32
|
+
exactlocation: {
|
|
33
|
+
type: "string",
|
|
34
|
+
},
|
|
35
|
+
warningSymbols: {
|
|
36
|
+
$ref: "#/definitions/warningSymbols",
|
|
37
|
+
},
|
|
38
|
+
chemicalusestop: {
|
|
39
|
+
type: "string",
|
|
40
|
+
},
|
|
41
|
+
safetydatasheet: {
|
|
42
|
+
type: "array",
|
|
43
|
+
items: {
|
|
44
|
+
type: "object",
|
|
45
|
+
},
|
|
46
|
+
//fileType: [["application/pdf"]],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
definitions: {
|
|
50
|
+
warningSymbols: {
|
|
51
|
+
type: "array",
|
|
52
|
+
items: {
|
|
53
|
+
type: "string",
|
|
54
|
+
},
|
|
55
|
+
anyOf: [
|
|
56
|
+
{
|
|
57
|
+
const: "GHS01",
|
|
58
|
+
title: "Räjähtävä",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
const: "GHS02",
|
|
62
|
+
title: "Syttyvä",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
const: "GHS03",
|
|
66
|
+
title: "Hapettava",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
const: "GHS04",
|
|
70
|
+
title: "Paineen alaiset kaasut",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
const: "GHS05",
|
|
74
|
+
title: "Syövyttävä",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
const: "GHS06",
|
|
78
|
+
title: "Välittömästi myrkyllinen",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
const: "GHS07",
|
|
82
|
+
title: "Haitallinen / ärsyttävä / herkistävä / vaarallinen otsonikerrokselle",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
const: "GHS08",
|
|
86
|
+
title: "Vakava terveysvaara",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
const: "GHS09",
|
|
90
|
+
title: "Ympäristölle vaarallinen",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
uniqueItems: true,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export const pdfProExampleData = {
|
|
98
|
+
unitId: 4006,
|
|
99
|
+
name: "Tikkurila Maalipesu",
|
|
100
|
+
safetydatasheet: [
|
|
101
|
+
{
|
|
102
|
+
id: "9aadb65d-c6c7-4b6f-a24c-86d1285b018c",
|
|
103
|
+
name: "Tikkurila maalipesu.pdf",
|
|
104
|
+
state: "NEW",
|
|
105
|
+
size: "133199",
|
|
106
|
+
type: "application/pdf",
|
|
107
|
+
accessPaths: ["/rea(id=9aadb65d-c6c7-4b6f-a24c-86d1285b018c)"],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
maker: "Tikkurila Oyj\nPL 53\n01301 VANTAA\nPuhelin +358 20 191 2000\nproductsafety@tikkurila.com",
|
|
111
|
+
unnumber: "UN1719",
|
|
112
|
+
warningSymbols: ["GHS05"],
|
|
113
|
+
dangersafety: "Huomiosana : Vaara\n\nVaaralausekkeet\nH314 - Voimakkaasti ihoa syövyttävää ja silmiä vaurioittavaa\n\nTurvalausekkeet\nP101 - Jos tarvitaan lääkinnällistä apua, näytä pakkaus tai varoitusetiketti.\nP102 - Säilytä lasten ulottumattomissa.\nP261 - Vältettävä höyryn hengittämistä.\nP280 - Käytä suojakäsineitä/vaatteita ja silmän/kasvonsuojainta.\nP271 - Käytä ainoastaan ulkona tai tiloissa, joissa on hyvä ilmanvaihto.\nP301 + P330 + P331 - JOS KEMIKAALIA ON NIELTY: Huuhdo suu. EI saa\noksennuttaa.\nP303 + P361 + P353 - JOS KEMIKAALIA JOUTUU IHOLLE (tai hiuksiin): Riisu saastunut vaatetus välittömästi. Huuhdo iho vedellä.\nP305 + P351 + P338, P310 - JOS KEMIKAALIA JOUTUU SILMIIN: Huuhdo huolellisesti vedellä usean minuutin ajan. Poista piilolinssit, jos sen voi tehdä helposti. Jatka huuhtomista. Ota välittömästi yhteys\nMYRKYTYSTIETOKESKUKSEEN tai lääkäriin.",
|
|
114
|
+
date: "1.2.2023",
|
|
115
|
+
lastupdate: "16.7.2024",
|
|
116
|
+
};
|
|
117
|
+
export const pdfProExampleUiSchema = {
|
|
118
|
+
"ui:title": "Kemikaalirekisteri",
|
|
119
|
+
"ui:order": [
|
|
120
|
+
"name",
|
|
121
|
+
"casnumber",
|
|
122
|
+
"exactlocation",
|
|
123
|
+
"maker",
|
|
124
|
+
"arrivalday",
|
|
125
|
+
"unnumber",
|
|
126
|
+
"use",
|
|
127
|
+
"warningSymbols",
|
|
128
|
+
"dangersafety",
|
|
129
|
+
"date",
|
|
130
|
+
"safetydatasheet",
|
|
131
|
+
"lastupdate",
|
|
132
|
+
"chemicalusestop",
|
|
133
|
+
],
|
|
134
|
+
"ui:disableCollapsible": true,
|
|
135
|
+
use: {
|
|
136
|
+
"ui:title": "Käyttötarkoitus ja määrät",
|
|
137
|
+
"ui:field": "TextAreaField",
|
|
138
|
+
},
|
|
139
|
+
date: {
|
|
140
|
+
"ui:title": "KTT:n päivämäärä",
|
|
141
|
+
},
|
|
142
|
+
name: {
|
|
143
|
+
"ui:title": "Kemikaali (tarkka kauppanimi)",
|
|
144
|
+
},
|
|
145
|
+
maker: {
|
|
146
|
+
"ui:title": "Toimittaja",
|
|
147
|
+
"ui:field": "TextAreaField",
|
|
148
|
+
},
|
|
149
|
+
unnumber: {
|
|
150
|
+
"ui:title": "YK-numero",
|
|
151
|
+
},
|
|
152
|
+
casnumber: {
|
|
153
|
+
"ui:title": "CAS-Nro.",
|
|
154
|
+
},
|
|
155
|
+
arrivalday: {
|
|
156
|
+
"ui:title": "Kemikaalin saapumispäivämäärä",
|
|
157
|
+
},
|
|
158
|
+
lastupdate: {
|
|
159
|
+
"ui:title": "KTT:n viimeinen päivitys tehty",
|
|
160
|
+
//"ui:field": "DateField"
|
|
161
|
+
},
|
|
162
|
+
dangersafety: {
|
|
163
|
+
"ui:title": "Vaara- ja turvalausekkeet",
|
|
164
|
+
"ui:field": "TextAreaField",
|
|
165
|
+
},
|
|
166
|
+
exactlocation: {
|
|
167
|
+
"ui:title": "Tarkempi sijainti ",
|
|
168
|
+
"ui:description": "Esimerkiksi: huone / kaappi / hylly",
|
|
169
|
+
},
|
|
170
|
+
definitions: {
|
|
171
|
+
warningSymbols: {
|
|
172
|
+
"ui:title": "Varoitusmerkit",
|
|
173
|
+
"ui:field": "MultipleChoiceField",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
chemicalusestop: {
|
|
177
|
+
"ui:title": "Kemikaalin käyttö lopetettu",
|
|
178
|
+
"ui:description": "Päivämäärä, jos se tiedetään.",
|
|
179
|
+
//"ui:field": "DateField"
|
|
180
|
+
},
|
|
181
|
+
safetydatasheet: {
|
|
182
|
+
"ui:title": "KTT (PDF-liite)",
|
|
183
|
+
"ui:field": "files",
|
|
184
|
+
},
|
|
185
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClickableProps, InfoFieldButtonProps, MultipleChoiceFieldProps, ObjectFieldButtonProps, RadioButtonFieldProps, SelectFieldProps, TextAreaInputFieldProps, ToggleSwitchFieldProps, FileUploadFieldProps } from "./types";
|
|
1
|
+
import type { ClickableProps, InfoFieldButtonProps, MultipleChoiceFieldProps, ObjectFieldButtonProps, RadioButtonFieldProps, SelectFieldProps, TextAreaInputFieldProps, ToggleSwitchFieldProps, FileUploadFieldProps, MultipleChoiceFieldPdfProps } from "./types";
|
|
2
2
|
import * as formik from "formik";
|
|
3
3
|
import React from "react";
|
|
4
4
|
export declare const Form: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & React.RefAttributes<HTMLFormElement>, "ref"> & {
|
|
@@ -234,6 +234,17 @@ export declare const SearchInput: import("styled-components/dist/types").IStyled
|
|
|
234
234
|
}, never>> & string;
|
|
235
235
|
export declare const SearchClearButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
236
236
|
export declare const SearchInputContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
237
|
+
export declare const StringFieldPdf: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
238
|
+
export declare const TextAreaPdf: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
239
|
+
export declare const EJSField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
240
|
+
type BooleanPdfFieldProps = {
|
|
241
|
+
name: string;
|
|
242
|
+
className: string;
|
|
243
|
+
value: boolean;
|
|
244
|
+
label?: string;
|
|
245
|
+
};
|
|
246
|
+
export declare const BooleanFieldPdf: ({ name, className, value, label, }: BooleanPdfFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
247
|
+
export declare const MultipleChoiceFieldPdf: ({ inputProps, name, className, style, selected, notSelected, }: MultipleChoiceFieldPdfProps) => import("react/jsx-runtime").JSX.Element;
|
|
237
248
|
export declare const FileUploadButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
238
249
|
export declare const HiddenFileInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
|
239
250
|
export declare const ProgressBarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|