@tsed/react-formio 1.10.5 → 1.10.9
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/components/modal/removeModal.component.d.ts +3 -2
- package/dist/components/table/components/defaultCell.component.d.ts +2 -0
- package/dist/components/table/index.d.ts +1 -1
- package/dist/index.js +32 -14
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +30 -13
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -4
- package/src/components/form/useForm.hook.ts +20 -8
- package/src/components/modal/removeModal.component.tsx +11 -4
- package/src/components/table/components/{cell.component.tsx → defaultCell.component.tsx} +4 -1
- package/src/components/table/index.ts +1 -1
- package/src/components/table/utils/mapFormToColumns.tsx +6 -3
- package/dist/components/table/components/cell.component.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.modern.js",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"prettier": "prettier '{src,test}/**/*.{ts,tsx}' --write"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@tsed/redux-utils": "1.10.
|
|
16
|
+
"@tsed/redux-utils": "1.10.9",
|
|
17
17
|
"eventemitter2": "^6.4.3",
|
|
18
18
|
"prop-types": "^15.7.2"
|
|
19
19
|
},
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"tooltip.js": "^1.3.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tsed/tailwind": "1.10.
|
|
32
|
-
"@tsed/tailwind-formio": "1.10.
|
|
31
|
+
"@tsed/tailwind": "1.10.9",
|
|
32
|
+
"@tsed/tailwind-formio": "1.10.9"
|
|
33
33
|
},
|
|
34
34
|
"repository": "https://github.com/TypedProject/tsed-formio",
|
|
35
35
|
"bugs": {
|
|
@@ -62,14 +62,6 @@ export const useForm = (props: any): any => {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
props.onSubmit && events.current.set("onSubmit", props.onSubmit);
|
|
67
|
-
}, [props.onSubmit, events]);
|
|
68
|
-
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
props.onSubmitDone && events.current.set("onSubmitDone", props.onSubmit);
|
|
71
|
-
}, [props.onSubmitDone, events]);
|
|
72
|
-
|
|
73
65
|
return instance.current;
|
|
74
66
|
};
|
|
75
67
|
|
|
@@ -103,6 +95,26 @@ export const useForm = (props: any): any => {
|
|
|
103
95
|
}
|
|
104
96
|
}, [src]);
|
|
105
97
|
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (form) {
|
|
100
|
+
createWebForm(form, options);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return () => {
|
|
104
|
+
isLoaded.current = false;
|
|
105
|
+
instance.current && instance.current.destroy(true);
|
|
106
|
+
};
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
props.onSubmit && events.current.set("onSubmit", props.onSubmit);
|
|
111
|
+
}, [props.onSubmit, events]);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
props.onSubmitDone &&
|
|
115
|
+
events.current.set("onSubmitDone", props.onSubmitDone);
|
|
116
|
+
}, [props.onSubmitDone, events]);
|
|
117
|
+
|
|
106
118
|
return {
|
|
107
119
|
element
|
|
108
120
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classnames from "classnames";
|
|
2
2
|
import noop from "lodash/noop";
|
|
3
|
-
import React, { useState } from "react";
|
|
3
|
+
import React, { PropsWithChildren, useState } from "react";
|
|
4
4
|
import { iconClass } from "../../utils/iconClass";
|
|
5
5
|
import { InputText } from "../input-text/inputText.component";
|
|
6
6
|
import { Modal, ModalProps } from "./modal.component";
|
|
@@ -10,7 +10,7 @@ function RemoveModalFooter({
|
|
|
10
10
|
valueToCompare,
|
|
11
11
|
onSubmit,
|
|
12
12
|
onClose,
|
|
13
|
-
i18n =
|
|
13
|
+
i18n = (f: string) => f
|
|
14
14
|
}: ModalProps) {
|
|
15
15
|
return (
|
|
16
16
|
<div className={"flex items-center justify-center bg-white p-2"}>
|
|
@@ -42,22 +42,29 @@ export interface RemoveModalProps extends ModalProps {
|
|
|
42
42
|
valueToCompare: string;
|
|
43
43
|
itemType?: string;
|
|
44
44
|
i18n?: (f: string) => string;
|
|
45
|
+
maxWidth?: string;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
export function RemoveModal(
|
|
48
|
+
export function RemoveModal({
|
|
49
|
+
maxWidth = "300px",
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}: PropsWithChildren<RemoveModalProps>) {
|
|
48
53
|
const { i18n = noop } = props;
|
|
49
54
|
const [value, setValue] = useState();
|
|
50
55
|
|
|
51
56
|
return (
|
|
52
57
|
<Modal
|
|
53
58
|
{...props}
|
|
54
|
-
|
|
59
|
+
className={classnames(props.className, "formio-dialog-theme-remove")}
|
|
60
|
+
style={{ maxWidth }}
|
|
55
61
|
title={`Drop ${props.itemType?.toLowerCase()}`}
|
|
56
62
|
value={value}
|
|
57
63
|
footer={RemoveModalFooter}
|
|
58
64
|
>
|
|
59
65
|
<div className={"px-4 pt-3 pb-5"}>
|
|
60
66
|
<div className={"pb-1"}>
|
|
67
|
+
{children}
|
|
61
68
|
{i18n("To drop")} <strong>{props.valueToCompare}</strong>,
|
|
62
69
|
{i18n("type the")}
|
|
63
70
|
<strong>"{props.itemType?.toLowerCase()}"</strong>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./utils/useOperations.hook";
|
|
2
|
-
export * from "./components/cell.component";
|
|
3
2
|
export * from "./components/defaultArrowSort.component";
|
|
3
|
+
export * from "./components/defaultCell.component";
|
|
4
4
|
export * from "./components/defaultCellHeader.component";
|
|
5
5
|
export * from "./components/defaultCellHeader.component";
|
|
6
6
|
export * from "./components/defaultCellOperations.component";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { Components, ExtendedComponentSchema } from "formiojs";
|
|
2
3
|
import FormioUtils from "formiojs/utils";
|
|
3
|
-
import React from "react";
|
|
4
4
|
import { Column } from "react-table";
|
|
5
5
|
import { FormSchema } from "../../../interfaces";
|
|
6
|
-
import {
|
|
6
|
+
import { DefaultCell } from "../components/defaultCell.component";
|
|
7
7
|
import { SelectColumnFilter } from "../filters/selectColumnFilter.component";
|
|
8
8
|
|
|
9
9
|
export function mapFormToColumns(form: FormSchema): Column[] {
|
|
@@ -19,7 +19,10 @@ export function mapFormToColumns(form: FormSchema): Column[] {
|
|
|
19
19
|
Header: component.label || component.title || component.key,
|
|
20
20
|
accessor: `data.${component.key}`,
|
|
21
21
|
Cell: (props: any) => (
|
|
22
|
-
<
|
|
22
|
+
<DefaultCell
|
|
23
|
+
{...props}
|
|
24
|
+
render={(value: any) => cmp.asString(value)}
|
|
25
|
+
/>
|
|
23
26
|
)
|
|
24
27
|
};
|
|
25
28
|
|