@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.
Files changed (77) hide show
  1. package/dist/Form.stories.d.ts +1 -0
  2. package/dist/Form.stories.js +4 -0
  3. package/dist/FormPdf.d.ts +6 -0
  4. package/dist/FormPdf.js +48 -0
  5. package/dist/FormPdf.stories.d.ts +11 -0
  6. package/dist/FormPdf.stories.js +148 -0
  7. package/dist/FormPdf.test.d.ts +1 -0
  8. package/dist/FormPdf.test.js +13 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +1 -0
  11. package/dist/pdfFields/AnyField.d.ts +3 -0
  12. package/dist/pdfFields/AnyField.js +22 -0
  13. package/dist/pdfFields/ArrayField.d.ts +3 -0
  14. package/dist/pdfFields/ArrayField.js +41 -0
  15. package/dist/pdfFields/BooleanField.d.ts +3 -0
  16. package/dist/pdfFields/BooleanField.js +27 -0
  17. package/dist/pdfFields/DateField.d.ts +3 -0
  18. package/dist/pdfFields/DateField.js +16 -0
  19. package/dist/pdfFields/EJSField.d.ts +3 -0
  20. package/dist/pdfFields/EJSField.js +24 -0
  21. package/dist/pdfFields/MultipleChoiceField.d.ts +3 -0
  22. package/dist/pdfFields/MultipleChoiceField.js +20 -0
  23. package/dist/pdfFields/NullField.d.ts +3 -0
  24. package/dist/pdfFields/NullField.js +8 -0
  25. package/dist/pdfFields/NumberField.d.ts +3 -0
  26. package/dist/pdfFields/NumberField.js +6 -0
  27. package/dist/pdfFields/ObjectField.d.ts +3 -0
  28. package/dist/pdfFields/ObjectField.js +59 -0
  29. package/dist/pdfFields/RadioField.d.ts +3 -0
  30. package/dist/pdfFields/RadioField.js +6 -0
  31. package/dist/pdfFields/SchemaField.d.ts +3 -0
  32. package/dist/pdfFields/SchemaField.js +31 -0
  33. package/dist/pdfFields/SearchMultiTagSelectField.d.ts +3 -0
  34. package/dist/pdfFields/SearchMultiTagSelectField.js +14 -0
  35. package/dist/pdfFields/SearchableSelectField.d.ts +3 -0
  36. package/dist/pdfFields/SearchableSelectField.js +9 -0
  37. package/dist/pdfFields/StringField.d.ts +3 -0
  38. package/dist/pdfFields/StringField.js +27 -0
  39. package/dist/pdfFields/TextAreaField.d.ts +3 -0
  40. package/dist/pdfFields/TextAreaField.js +13 -0
  41. package/dist/pdfFields/ToggleField.d.ts +3 -0
  42. package/dist/pdfFields/ToggleField.js +6 -0
  43. package/dist/pdfFields/index.d.ts +16 -0
  44. package/dist/pdfFields/index.js +16 -0
  45. package/dist/pdfFields/types.d.ts +10 -0
  46. package/dist/pdfFields/types.js +10 -0
  47. package/dist/pdfTemplates/ArrayFieldTemplate.d.ts +3 -0
  48. package/dist/pdfTemplates/ArrayFieldTemplate.js +16 -0
  49. package/dist/pdfTemplates/CollapsibleObjectFieldTemplate.d.ts +3 -0
  50. package/dist/pdfTemplates/CollapsibleObjectFieldTemplate.js +20 -0
  51. package/dist/pdfTemplates/FieldTemplate.d.ts +3 -0
  52. package/dist/pdfTemplates/FieldTemplate.js +15 -0
  53. package/dist/pdfTemplates/ObjectFieldTemplate.d.ts +3 -0
  54. package/dist/pdfTemplates/ObjectFieldTemplate.js +18 -0
  55. package/dist/pdfTemplates/index.d.ts +4 -0
  56. package/dist/pdfTemplates/index.js +4 -0
  57. package/dist/sampleData/completeSchema.d.ts +1 -0
  58. package/dist/sampleData/completeSchema.js +23 -2
  59. package/dist/sampleData/ejsSchema.d.ts +6 -0
  60. package/dist/sampleData/ejsSchema.js +25 -0
  61. package/dist/sampleData/multipleChoiceSchema.d.ts +6 -0
  62. package/dist/sampleData/multipleChoiceSchema.js +8 -1
  63. package/dist/sampleData/pdfProExampleSchema.d.ts +21 -0
  64. package/dist/sampleData/pdfProExampleSchema.js +185 -0
  65. package/dist/sampleData/simpleData.js +1 -0
  66. package/dist/styledComponents.d.ts +12 -1
  67. package/dist/styledComponents.js +55 -0
  68. package/dist/types.d.ts +26 -0
  69. package/dist/utils/__tests/createValidationSchema.test.js +208 -20
  70. package/dist/utils/__tests/hasReferences.test.d.ts +1 -0
  71. package/dist/utils/__tests/hasReferences.test.js +100 -0
  72. package/dist/utils/createValidationSchema.js +23 -4
  73. package/dist/utils/getEnums.d.ts +13 -0
  74. package/dist/utils/getEnums.js +12 -0
  75. package/dist/utils/hasReferences.d.ts +2 -0
  76. package/dist/utils/hasReferences.js +12 -0
  77. 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,3 @@
1
+ import type { FieldProps } from "../types";
2
+ import React from "react";
3
+ export declare const StringField: React.FC<FieldProps>;
@@ -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,3 @@
1
+ import type { FieldProps } from "../types";
2
+ import React from "react";
3
+ export declare const TextAreaField: React.FC<FieldProps>;
@@ -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,3 @@
1
+ import type { FieldProps } from "../types";
2
+ import React from "react";
3
+ export declare const ToggleField: React.FC<FieldProps>;
@@ -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,10 @@
1
+ export declare const COMPONENT_TYPES: {
2
+ array: string;
3
+ boolean: string;
4
+ integer: string;
5
+ number: string;
6
+ object: string;
7
+ string: string;
8
+ null: string;
9
+ any: string;
10
+ };
@@ -0,0 +1,10 @@
1
+ export const COMPONENT_TYPES = {
2
+ array: "ArrayField",
3
+ boolean: "BooleanField",
4
+ integer: "NumberField",
5
+ number: "NumberField",
6
+ object: "ObjectField",
7
+ string: "StringField",
8
+ null: "NullField",
9
+ any: "AnyField",
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { ArrayFieldTemplateProps } from "../types";
2
+ import React from "react";
3
+ export declare const ArrayFieldTemplate: React.FC<ArrayFieldTemplateProps>;
@@ -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,3 @@
1
+ import type { CollapsibleObjectFieldTemplateProps } from "../types";
2
+ import React from "react";
3
+ export declare const CollapsibleObjectFieldTemplate: React.FC<CollapsibleObjectFieldTemplateProps>;
@@ -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,3 @@
1
+ import type { FieldTemplateProps } from "../types";
2
+ import React from "react";
3
+ export declare const FieldTemplate: React.FC<FieldTemplateProps>;
@@ -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,3 @@
1
+ import type { ObjectFieldTemplateProps } from "../types";
2
+ import React from "react";
3
+ export declare const ObjectFieldTemplate: React.FC<ObjectFieldTemplateProps>;
@@ -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
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./ArrayFieldTemplate";
2
+ export * from "./FieldTemplate";
3
+ export * from "./ObjectFieldTemplate";
4
+ export * from "./CollapsibleObjectFieldTemplate";
@@ -0,0 +1,4 @@
1
+ export * from "./ArrayFieldTemplate";
2
+ export * from "./FieldTemplate";
3
+ export * from "./ObjectFieldTemplate";
4
+ export * from "./CollapsibleObjectFieldTemplate";
@@ -1,3 +1,4 @@
1
1
  import type { Schema, UiSchema } from "../types";
2
2
  export declare const completeSchema: Schema;
3
3
  export declare const completeUiSchema: UiSchema;
4
+ export declare const completePdfUiSchema: UiSchema;
@@ -155,8 +155,13 @@ export const completeSchema = {
155
155
  title: "Enum array",
156
156
  description: "Enum array description",
157
157
  additionalItems: {
158
- type: "number",
159
- enum: [1, 2, 3, 4],
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,6 @@
1
+ import type { Schema, UiSchema } from "../types";
2
+ export declare const ejsSchema: Schema;
3
+ export declare const ejsUiSchema: UiSchema;
4
+ export declare const ejsTestValues: {
5
+ ejsTest: string[];
6
+ };
@@ -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: "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,5 +1,6 @@
1
1
  export const simpleSchema = {
2
2
  title: "TITLE",
3
+ required: ["firstName"],
3
4
  properties: {
4
5
  firstName: { type: "string", title: "First name" },
5
6
  lastName: { type: "string", title: "Last name" },
@@ -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;