@tsed/react-formio 1.10.4 → 1.10.8
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 +34 -17
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +34 -16
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -4
- package/src/components/form/useForm.hook.ts +24 -10
- package/src/components/modal/removeModal.component.tsx +10 -3
- 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.8",
|
|
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.8",
|
|
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.8",
|
|
32
|
+
"@tsed/tailwind-formio": "1.10.8"
|
|
33
33
|
},
|
|
34
34
|
"repository": "https://github.com/TypedProject/tsed-formio",
|
|
35
35
|
"bugs": {
|
|
@@ -42,15 +42,11 @@ export const useForm = (props: any): any => {
|
|
|
42
42
|
props.hasOwnProperty(funcName) &&
|
|
43
43
|
typeof funcs[funcName] === "function"
|
|
44
44
|
) {
|
|
45
|
-
if (
|
|
46
|
-
funcs[funcName]
|
|
47
|
-
|
|
48
|
-
if (!events.current.has(funcName)) {
|
|
49
|
-
const fn = callLast(funcs[funcName], 100);
|
|
50
|
-
events.current.set(funcName, fn);
|
|
51
|
-
}
|
|
52
|
-
events.current.get(funcName)(...args);
|
|
45
|
+
if (!events.current.has(funcName)) {
|
|
46
|
+
const fn = callLast(funcs[funcName], 100);
|
|
47
|
+
events.current.set(funcName, fn);
|
|
53
48
|
}
|
|
49
|
+
events.current.get(funcName)(...args);
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
});
|
|
@@ -66,8 +62,6 @@ export const useForm = (props: any): any => {
|
|
|
66
62
|
});
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
useEffect(() => {}, []);
|
|
70
|
-
|
|
71
65
|
return instance.current;
|
|
72
66
|
};
|
|
73
67
|
|
|
@@ -101,6 +95,26 @@ export const useForm = (props: any): any => {
|
|
|
101
95
|
}
|
|
102
96
|
}, [src]);
|
|
103
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
|
+
|
|
104
118
|
return {
|
|
105
119
|
element
|
|
106
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";
|
|
@@ -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
|
|