@tsed/react-formio 2.3.1 → 2.3.3
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/coverage.json +4 -4
- package/dist/components/actions-table/actionsTable.stories.d.ts +8 -53
- package/dist/components/form-access/formAccess.component.d.ts +2 -13
- package/dist/components/form-access/formAccess.stories.d.ts +3 -44
- package/dist/components/form-control/formControl.component.d.ts +3 -11
- package/dist/components/react-component/reactComponent.component.d.ts +1 -1
- package/dist/components/select/select.component.d.ts +5 -18
- package/dist/components/table/components/defaultCellOperations.component.d.ts +12 -1
- package/dist/components/table/components/defaultOperationButton.component.d.ts +4 -4
- package/dist/components/table/hooks/useOperations.hook.d.ts +2 -2
- package/dist/index.js +1184 -1334
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +300 -316
- package/dist/index.modern.js.map +1 -1
- package/package.json +13 -9
- package/src/components/__fixtures__/form-actions.json +240 -0
- package/src/components/actions-table/__fixtures__/data.json +12 -0
- package/src/components/actions-table/actionsTable.component.spec.tsx +44 -13
- package/src/components/actions-table/actionsTable.component.tsx +2 -1
- package/src/components/actions-table/actionsTable.stories.tsx +71 -289
- package/src/components/form/form.stories.tsx +1 -2
- package/src/components/form-access/formAccess.component.tsx +2 -13
- package/src/components/form-access/formAccess.stories.tsx +55 -49
- package/src/components/form-action/formAction.component.tsx +1 -0
- package/src/components/form-control/formControl.component.tsx +3 -10
- 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 +10 -23
- package/src/components/table/components/defaultCellOperations.component.tsx +17 -4
- package/src/components/table/components/defaultOperationButton.component.tsx +11 -4
- package/src/components/table/components/defaultRow.component.tsx +1 -0
- package/src/components/table/filters/defaultColumnFilter.component.tsx +1 -0
- package/src/components/table/hooks/useOperations.hook.tsx +3 -3
- package/src/react-table.d.ts +2 -0
- package/dist/package.json +0 -3
package/coverage.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
import { ActionsTable } from "./actionsTable.component";
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
@@ -6,37 +6,27 @@ declare const _default: {
|
|
|
6
6
|
argTypes: {
|
|
7
7
|
data: {
|
|
8
8
|
control: {
|
|
9
|
-
type:
|
|
9
|
+
type: "object";
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
operations: {
|
|
13
13
|
control: {
|
|
14
|
-
type:
|
|
14
|
+
type: "object";
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
isLoading: {
|
|
18
18
|
control: {
|
|
19
|
-
type:
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
isEmpty: {
|
|
23
|
-
control: {
|
|
24
|
-
type: string;
|
|
19
|
+
type: "boolean";
|
|
25
20
|
};
|
|
26
21
|
};
|
|
27
22
|
disableFilters: {
|
|
28
23
|
control: {
|
|
29
|
-
type:
|
|
24
|
+
type: "boolean";
|
|
30
25
|
};
|
|
31
26
|
};
|
|
32
27
|
disablePagination: {
|
|
33
28
|
control: {
|
|
34
|
-
type:
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
tags: {
|
|
38
|
-
control: {
|
|
39
|
-
type: string;
|
|
29
|
+
type: "boolean";
|
|
40
30
|
};
|
|
41
31
|
};
|
|
42
32
|
onAddAction: {
|
|
@@ -46,40 +36,5 @@ declare const _default: {
|
|
|
46
36
|
parameters: {};
|
|
47
37
|
};
|
|
48
38
|
export default _default;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
args: {
|
|
52
|
-
icon: string;
|
|
53
|
-
availableActions: {
|
|
54
|
-
label: string;
|
|
55
|
-
value: string;
|
|
56
|
-
}[];
|
|
57
|
-
data: {
|
|
58
|
-
_id: string;
|
|
59
|
-
handler: string[];
|
|
60
|
-
method: string[];
|
|
61
|
-
priority: number;
|
|
62
|
-
name: string;
|
|
63
|
-
title: string;
|
|
64
|
-
form: string;
|
|
65
|
-
machineName: string;
|
|
66
|
-
}[];
|
|
67
|
-
operations: ({
|
|
68
|
-
title: string;
|
|
69
|
-
action: string;
|
|
70
|
-
alias: string;
|
|
71
|
-
path: string;
|
|
72
|
-
icon: string;
|
|
73
|
-
permissionsResolver(): boolean;
|
|
74
|
-
buttonType?: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
action: string;
|
|
77
|
-
path: string;
|
|
78
|
-
icon: string;
|
|
79
|
-
buttonType: string;
|
|
80
|
-
permissionsResolver(): boolean;
|
|
81
|
-
title?: undefined;
|
|
82
|
-
alias?: undefined;
|
|
83
|
-
})[];
|
|
84
|
-
};
|
|
85
|
-
};
|
|
39
|
+
type Story = StoryObj<typeof ActionsTable>;
|
|
40
|
+
export declare const Sandbox: Story;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PropsWithChildren, ReactElement } from "react";
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
3
2
|
import type { FormOptions, FormSchema } from "../../interfaces";
|
|
4
3
|
export interface FormAccessProps {
|
|
5
4
|
form: Partial<FormSchema>;
|
|
@@ -7,14 +6,4 @@ export interface FormAccessProps {
|
|
|
7
6
|
onSubmit?: Function;
|
|
8
7
|
options?: FormOptions;
|
|
9
8
|
}
|
|
10
|
-
export declare function FormAccess(props: PropsWithChildren<FormAccessProps>):
|
|
11
|
-
export declare namespace FormAccess {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
type: PropTypes.Validator<string>;
|
|
14
|
-
form: PropTypes.Requireable<object>;
|
|
15
|
-
roles: PropTypes.Requireable<any>;
|
|
16
|
-
children: PropTypes.Requireable<any>;
|
|
17
|
-
options: PropTypes.Requireable<any>;
|
|
18
|
-
onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
9
|
+
export declare function FormAccess(props: PropsWithChildren<FormAccessProps>): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
import { FormAccess } from "./formAccess.component";
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
@@ -7,16 +7,6 @@ declare const _default: {
|
|
|
7
7
|
onSubmit: {
|
|
8
8
|
action: string;
|
|
9
9
|
};
|
|
10
|
-
actionInfo: {
|
|
11
|
-
control: {
|
|
12
|
-
type: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
options: {
|
|
16
|
-
control: {
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
10
|
};
|
|
21
11
|
parameters: {
|
|
22
12
|
docs: {
|
|
@@ -27,36 +17,5 @@ declare const _default: {
|
|
|
27
17
|
};
|
|
28
18
|
};
|
|
29
19
|
export default _default;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
args: {
|
|
33
|
-
form: {
|
|
34
|
-
_id: string;
|
|
35
|
-
type: string;
|
|
36
|
-
tags: never[];
|
|
37
|
-
owner: string;
|
|
38
|
-
access: {
|
|
39
|
-
roles: string[];
|
|
40
|
-
type: string;
|
|
41
|
-
}[];
|
|
42
|
-
submissionAccess: {
|
|
43
|
-
roles: string[];
|
|
44
|
-
type: string;
|
|
45
|
-
}[];
|
|
46
|
-
controller: string;
|
|
47
|
-
properties: {};
|
|
48
|
-
settings: {};
|
|
49
|
-
name: string;
|
|
50
|
-
path: string;
|
|
51
|
-
machineName: string;
|
|
52
|
-
};
|
|
53
|
-
roles: {
|
|
54
|
-
title: string;
|
|
55
|
-
_id: string;
|
|
56
|
-
}[];
|
|
57
|
-
options: {
|
|
58
|
-
template: string;
|
|
59
|
-
iconset: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
};
|
|
20
|
+
type Story = StoryObj<typeof FormAccess>;
|
|
21
|
+
export declare const Sandbox: Story;
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
|
-
export interface FormControlProps {
|
|
2
|
+
export interface FormControlProps<Data = any> {
|
|
4
3
|
name: string;
|
|
4
|
+
value?: Data;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
label?: string;
|
|
7
7
|
className?: string;
|
|
8
|
+
onChange?: (name: string, value: any) => void;
|
|
8
9
|
description?: string | React.ComponentType | any;
|
|
9
10
|
prefix?: JSX.Element | React.ComponentType | any;
|
|
10
11
|
suffix?: JSX.Element | React.ComponentType | any;
|
|
11
12
|
shadow?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare function FormControl({ children, name, required, prefix, suffix, description, label, className }: React.PropsWithChildren<FormControlProps>): React.JSX.Element;
|
|
14
|
-
export declare namespace FormControl {
|
|
15
|
-
var propTypes: {
|
|
16
|
-
label: PropTypes.Requireable<string>;
|
|
17
|
-
name: PropTypes.Validator<string>;
|
|
18
|
-
children: PropTypes.Requireable<any>;
|
|
19
|
-
required: PropTypes.Requireable<boolean>;
|
|
20
|
-
description: PropTypes.Requireable<any>;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -63,7 +63,7 @@ export declare class ReactComponent<Data = any> extends Components.components.fi
|
|
|
63
63
|
* @param value
|
|
64
64
|
* @param flags
|
|
65
65
|
*/
|
|
66
|
-
setValue(value: any
|
|
66
|
+
setValue(value: any): boolean;
|
|
67
67
|
/**
|
|
68
68
|
* The user has changed the value in the component and the value needs to be updated on the main submission object and other components notified of a change event.
|
|
69
69
|
*
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ReactElement } from "react";
|
|
1
|
+
import { HTMLAttributes, ReactElement } from "react";
|
|
3
2
|
import { FormControlProps } from "../form-control/formControl.component";
|
|
4
|
-
export interface SelectProps<
|
|
5
|
-
value?: any;
|
|
3
|
+
export interface SelectProps<Data = any> extends FormControlProps, Omit<HTMLAttributes<HTMLSelectElement>, "onChange" | "prefix"> {
|
|
6
4
|
size?: string;
|
|
7
|
-
onChange?: (name: string, value: any) => void;
|
|
8
5
|
placeholder?: string;
|
|
9
6
|
choices: {
|
|
10
7
|
label: string;
|
|
11
|
-
value:
|
|
8
|
+
value: Data;
|
|
12
9
|
}[];
|
|
13
10
|
layout?: "html5" | "choicesjs";
|
|
11
|
+
disabled?: boolean;
|
|
14
12
|
multiple?: boolean;
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
export declare function Select<T = any>({ name, label, size, onChange, required, value, choices, description, placeholder, prefix, suffix, multiple, layout, ...props }: SelectProps<T>): ReactElement;
|
|
18
|
-
export declare namespace Select {
|
|
19
|
-
var propTypes: {
|
|
20
|
-
label: PropTypes.Requireable<string>;
|
|
21
|
-
name: PropTypes.Validator<string>;
|
|
22
|
-
value: PropTypes.Requireable<any>;
|
|
23
|
-
required: PropTypes.Requireable<boolean>;
|
|
24
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
-
choices: PropTypes.Validator<any[]>;
|
|
26
|
-
};
|
|
27
13
|
}
|
|
14
|
+
export declare function Select<Data = any>({ name, label, size, onChange, required, value, choices, description, placeholder, prefix, suffix, multiple, layout, ...props }: SelectProps<Data>): ReactElement;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { DefaultOperationButton, OperationButtonProps } from "./defaultOperationButton.component";
|
|
3
|
+
export interface DefaultCellOperationsProps {
|
|
4
|
+
operations: (OperationButtonProps & {
|
|
5
|
+
OperationButton: typeof DefaultOperationButton;
|
|
6
|
+
permissionsResolver?(data: unknown, ctx: any): boolean;
|
|
7
|
+
})[];
|
|
8
|
+
row: any;
|
|
9
|
+
onClick: (data: any, action: string) => void;
|
|
10
|
+
ctx: any;
|
|
11
|
+
i18n: (i18n: string) => string;
|
|
12
|
+
}
|
|
13
|
+
export declare function DefaultCellOperations({ operations, row, onClick, ctx, i18n }: DefaultCellOperationsProps): React.JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface OperationButtonProps {
|
|
3
|
-
className?: string;
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
export interface OperationButtonProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onClick"> {
|
|
4
3
|
buttonType?: string;
|
|
5
4
|
buttonSize?: string;
|
|
6
5
|
buttonOutline?: boolean;
|
|
@@ -10,5 +9,6 @@ export interface OperationButtonProps {
|
|
|
10
9
|
icon?: string;
|
|
11
10
|
title?: string;
|
|
12
11
|
i18n?: (i18n: string) => string;
|
|
12
|
+
ctx?: any;
|
|
13
13
|
}
|
|
14
|
-
export declare function DefaultOperationButton(props: OperationButtonProps):
|
|
14
|
+
export declare function DefaultOperationButton(props: OperationButtonProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ComponentType, type FunctionComponent } from "react";
|
|
2
2
|
import { Hooks } from "react-table";
|
|
3
3
|
import { Operation } from "../../../interfaces";
|
|
4
4
|
export type UseOperationsHookProps = {
|
|
5
|
-
CellOperations?:
|
|
5
|
+
CellOperations?: FunctionComponent | ComponentType<{}>;
|
|
6
6
|
operations: Operation[];
|
|
7
7
|
onClick?: (data: any, event: string) => void;
|
|
8
8
|
i18n?: (f: string) => string;
|