@tsed/react-formio 2.3.2 → 2.3.4
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/react-component/reactComponent.component.d.ts +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +9 -7
- package/dist/index.modern.js.map +1 -1
- package/package.json +6 -5
- package/src/components/actions-table/actionsTable.component.spec.tsx +2 -2
- package/src/components/form/form.stories.tsx +1 -2
- package/src/components/form-access/formAccess.component.tsx +0 -1
- package/src/components/form-action/formAction.component.tsx +1 -0
- package/src/components/form-control/formControl.component.tsx +1 -1
- package/src/components/form-edit/formEdit.reducer.ts +0 -1
- package/src/components/form-settings/formSettings.component.spec.tsx +4 -4
- package/src/components/pagination/pagination.component.spec.tsx +0 -2
- package/src/components/react-component/reactComponent.component.tsx +5 -5
- package/src/components/select/select.component.tsx +1 -1
- package/src/components/table/components/defaultOperationButton.component.tsx +2 -0
- package/src/components/table/components/defaultRow.component.tsx +1 -0
- package/src/components/table/filters/defaultColumnFilter.component.tsx +1 -0
- package/src/react-table.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "Provide a react formio wrapper. Written in TypeScript.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.modern.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
+
"tsed-source": "./src/index.ts",
|
|
9
10
|
"import": "./dist/index.modern.js",
|
|
10
|
-
"require": "./dist/index.js"
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.modern.js"
|
|
11
13
|
}
|
|
12
14
|
},
|
|
13
15
|
"source": "src/index.ts",
|
|
14
16
|
"scripts": {
|
|
15
|
-
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
|
16
17
|
"lint:fix": "yarn lint --fix",
|
|
17
18
|
"test": "cross-env NODE_ENV=test jest --coverage",
|
|
18
19
|
"test:coverage:update": "write-coverage",
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
"tooltip.js": ">=1.3.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@tsed/tailwind": "2.3.
|
|
41
|
-
"@tsed/tailwind-formio": "2.3.
|
|
41
|
+
"@tsed/tailwind": "2.3.4",
|
|
42
|
+
"@tsed/tailwind-formio": "2.3.4",
|
|
42
43
|
"microbundle": "0.13.0"
|
|
43
44
|
},
|
|
44
45
|
"repository": "https://github.com/TypedProject/tsed-formio",
|
|
@@ -60,7 +60,7 @@ describe("ActionsTable", () => {
|
|
|
60
60
|
|
|
61
61
|
const btn = screen.getByTestId("action-table-add");
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
fireEvent.click(btn);
|
|
64
64
|
expect(onAddAction).not.toHaveBeenCalled();
|
|
65
65
|
});
|
|
66
66
|
it("should call addAction with the selected action", async () => {
|
|
@@ -73,7 +73,7 @@ describe("ActionsTable", () => {
|
|
|
73
73
|
|
|
74
74
|
await userEvent.selectOptions(select, String(args.availableActions[1].value));
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
fireEvent.click(btn);
|
|
77
77
|
|
|
78
78
|
expect(btn).not.toHaveProperty("disabled", true);
|
|
79
79
|
expect(onAddAction).toHaveBeenCalledWith("sql");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
|
|
3
|
-
import { Submission } from "../../interfaces";
|
|
4
3
|
import form from "../__fixtures__/form.fixture.json";
|
|
5
4
|
import { Form } from "./form.component";
|
|
6
5
|
|
|
@@ -123,7 +122,7 @@ export const Sandbox = {
|
|
|
123
122
|
|
|
124
123
|
export const TriggerError = {
|
|
125
124
|
render: (args: any) => {
|
|
126
|
-
const onAsyncSubmit = (
|
|
125
|
+
const onAsyncSubmit = () => {
|
|
127
126
|
return new Promise((resolve, reject) => {
|
|
128
127
|
setTimeout(() => {
|
|
129
128
|
reject(new Error("server error"));
|
|
@@ -23,7 +23,6 @@ export interface FormAccessProps {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function useFormAccess({ form: formDefinition, roles, onSubmit, options }: FormAccessProps) {
|
|
26
|
-
// eslint-disable-next-line no-undef
|
|
27
26
|
const form = useMemo(() => getFormAccess(roles), [roles]);
|
|
28
27
|
|
|
29
28
|
const [submissions, setSubmissions] = useState(() => dataAccessToSubmissions(formDefinition, form));
|
|
@@ -11,6 +11,7 @@ function mapData(options: any, defaults: ActionDefaultsSchema): any {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
15
|
function mapSettingsForm({ action, ...settingsForm }: any): any {
|
|
15
16
|
FormioUtils.eachComponent(settingsForm.components, (component: any) => {
|
|
16
17
|
const resourceExclude = "";
|
|
@@ -71,7 +71,6 @@ export const reducer = (state: FormEditState, { type, value }: any): FormEditSta
|
|
|
71
71
|
return update(cloneDeep(state.original));
|
|
72
72
|
|
|
73
73
|
case "formChange":
|
|
74
|
-
// eslint-disable-next-line no-case-declarations
|
|
75
74
|
const newValue = { ...state.current, ...value };
|
|
76
75
|
|
|
77
76
|
if (hasChanged(state.current, newValue)) {
|
|
@@ -5,7 +5,7 @@ import { FormSettings } from "./formSettings.component";
|
|
|
5
5
|
import { Sandbox } from "./formSettings.stories";
|
|
6
6
|
|
|
7
7
|
describe("FormSettings", () => {
|
|
8
|
-
it("should render form settings",
|
|
8
|
+
it("should render form settings", () => {
|
|
9
9
|
const onSubmit = jest.fn();
|
|
10
10
|
|
|
11
11
|
// @ts-ignore
|
|
@@ -23,7 +23,7 @@ describe("FormSettings", () => {
|
|
|
23
23
|
|
|
24
24
|
const btn = screen.getByTestId("submit");
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
fireEvent.click(btn);
|
|
27
27
|
|
|
28
28
|
expect(btn).toHaveTextContent("Save settings");
|
|
29
29
|
expect(onSubmit).toHaveBeenCalledWith({
|
|
@@ -47,7 +47,7 @@ describe("FormSettings", () => {
|
|
|
47
47
|
type: "form"
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
it("should render form settings with i18n options",
|
|
50
|
+
it("should render form settings with i18n options", () => {
|
|
51
51
|
render(
|
|
52
52
|
<FormSettings
|
|
53
53
|
{...Sandbox.args}
|
|
@@ -59,7 +59,7 @@ describe("FormSettings", () => {
|
|
|
59
59
|
|
|
60
60
|
const btn = screen.getByTestId("submit");
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
fireEvent.click(btn);
|
|
63
63
|
|
|
64
64
|
expect(btn).toHaveTextContent("Save settings i18N");
|
|
65
65
|
});
|
|
@@ -50,9 +50,7 @@ describe("Pagination", () => {
|
|
|
50
50
|
if (btn.textContent !== "...") {
|
|
51
51
|
page = +btn.textContent!;
|
|
52
52
|
fireEvent.click(btn);
|
|
53
|
-
// eslint-disable-next-line jest/no-conditional-expect
|
|
54
53
|
expect(gotoPageSpy).toHaveBeenCalled();
|
|
55
|
-
// eslint-disable-next-line jest/no-conditional-expect
|
|
56
54
|
expect(gotoPageSpy).toHaveBeenCalledWith(page - 1);
|
|
57
55
|
}
|
|
58
56
|
});
|
|
@@ -15,7 +15,6 @@ export class ReactComponent<Data = any> extends Components.components.field {
|
|
|
15
15
|
* @param options - Any options passed into the renderer.
|
|
16
16
|
* @param data - The submission data where this component's data exists.
|
|
17
17
|
*/
|
|
18
|
-
// eslint-disable-next-line no-useless-constructor,import/no-anonymous-default-export
|
|
19
18
|
constructor(component: ComponentSchema, options: any, data: Submission<Data>) {
|
|
20
19
|
super(component, options, data);
|
|
21
20
|
}
|
|
@@ -105,18 +104,19 @@ export class ReactComponent<Data = any> extends Components.components.field {
|
|
|
105
104
|
*
|
|
106
105
|
* @param element
|
|
107
106
|
*/
|
|
108
|
-
|
|
107
|
+
|
|
109
108
|
attachReact(element?: any) {
|
|
110
|
-
// eslint-disable-next-line react/no-render-return-value
|
|
109
|
+
// eslint-disable-next-line react/no-render-return-value,react/no-deprecated
|
|
111
110
|
return ReactDOM.render(this.renderReact(), element);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
/**
|
|
115
114
|
* Override this function.
|
|
116
115
|
*/
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
detachReact(element?: any) {
|
|
119
118
|
if (element) {
|
|
119
|
+
// eslint-disable-next-line react/no-deprecated
|
|
120
120
|
ReactDOM.unmountComponentAtNode(element);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -127,7 +127,7 @@ export class ReactComponent<Data = any> extends Components.components.field {
|
|
|
127
127
|
* @param value
|
|
128
128
|
* @param flags
|
|
129
129
|
*/
|
|
130
|
-
setValue(value: any
|
|
130
|
+
setValue(value: any) {
|
|
131
131
|
if (this.reactInstance) {
|
|
132
132
|
this.reactInstance.setState({
|
|
133
133
|
value: value
|
|
@@ -60,7 +60,7 @@ export function Select<Data = any>({
|
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
62
|
<FormControl name={name} label={label} required={required} description={description} prefix={prefix} suffix={suffix} shadow={false}>
|
|
63
|
-
{
|
|
63
|
+
{}
|
|
64
64
|
<select
|
|
65
65
|
ref={ref}
|
|
66
66
|
data-testid={`select_${name}`}
|
|
@@ -28,7 +28,9 @@ export function DefaultOperationButton(props: OperationButtonProps) {
|
|
|
28
28
|
icon = "",
|
|
29
29
|
title = "",
|
|
30
30
|
i18n = (f: string) => f,
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
32
|
data,
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
34
|
ctx,
|
|
33
35
|
...otherProps
|
|
34
36
|
} = props;
|
|
@@ -21,6 +21,7 @@ export function DefaultDndRow<Data extends object = {}>(props: DefaultRowProps<D
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<tr ref={dropRef} style={{ opacity }}>
|
|
24
|
+
{/* eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role */}
|
|
24
25
|
<td ref={dragRef} role='cell' style={{ cursor: isDragging ? "grabbing" : "grab" }} className='align-middle'>
|
|
25
26
|
<div className='flex items-center justify-center'>
|
|
26
27
|
<i className={classnames(iconClass(undefined, "dots-vertical-rounded"))} />
|
package/src/react-table.d.ts
CHANGED
|
@@ -45,10 +45,12 @@ import {
|
|
|
45
45
|
} from "react-table";
|
|
46
46
|
|
|
47
47
|
declare module "react-table" {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
48
49
|
export interface UseFlexLayoutInstanceProps<D extends Record<string, unknown>> {
|
|
49
50
|
totalColumnsMinWidth: number;
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
54
|
export interface UseFlexLayoutColumnProps<D extends Record<string, unknown>> {
|
|
53
55
|
totalMinWidth: number;
|
|
54
56
|
}
|