@tsed/react-formio 2.3.0 → 2.3.2
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/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 +1113 -1265
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +226 -244
- package/dist/index.modern.js.map +1 -1
- package/package.json +13 -6
- 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 +42 -11
- package/src/components/actions-table/actionsTable.component.tsx +2 -1
- package/src/components/actions-table/actionsTable.stories.tsx +71 -289
- package/src/components/form-access/formAccess.component.tsx +2 -12
- package/src/components/form-access/formAccess.stories.tsx +55 -49
- package/src/components/form-control/formControl.component.tsx +4 -11
- package/src/components/select/select.component.tsx +9 -22
- package/src/components/table/components/defaultCellOperations.component.tsx +17 -4
- package/src/components/table/components/defaultOperationButton.component.tsx +9 -4
- package/src/components/table/hooks/useOperations.hook.tsx +3 -3
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import classnames from "classnames";
|
|
2
|
-
import
|
|
2
|
+
import { HTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
import { iconClass } from "../../../utils/iconClass";
|
|
5
5
|
import { stopPropagationWrapper } from "../../../utils/stopPropagationWrapper";
|
|
6
6
|
|
|
7
|
-
export interface OperationButtonProps {
|
|
8
|
-
className?: string;
|
|
7
|
+
export interface OperationButtonProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onClick"> {
|
|
9
8
|
buttonType?: string;
|
|
10
9
|
buttonSize?: string;
|
|
11
10
|
buttonOutline?: boolean;
|
|
@@ -15,6 +14,7 @@ export interface OperationButtonProps {
|
|
|
15
14
|
icon?: string;
|
|
16
15
|
title?: string;
|
|
17
16
|
i18n?: (i18n: string) => string;
|
|
17
|
+
ctx?: any;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function DefaultOperationButton(props: OperationButtonProps) {
|
|
@@ -27,11 +27,16 @@ export function DefaultOperationButton(props: OperationButtonProps) {
|
|
|
27
27
|
action,
|
|
28
28
|
icon = "",
|
|
29
29
|
title = "",
|
|
30
|
-
i18n = (f: string) => f
|
|
30
|
+
i18n = (f: string) => f,
|
|
31
|
+
data,
|
|
32
|
+
ctx,
|
|
33
|
+
...otherProps
|
|
31
34
|
} = props;
|
|
32
35
|
|
|
33
36
|
return (
|
|
34
37
|
<button
|
|
38
|
+
{...otherProps}
|
|
39
|
+
aria-label={"Operation button: " + (title || action)}
|
|
35
40
|
className={classnames(className, ["btn", buttonOutline && "outline", buttonType].filter(Boolean).join("-"), `btn-${buttonSize}`)}
|
|
36
41
|
onClick={stopPropagationWrapper(() => onClick(action))}
|
|
37
42
|
>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type ComponentType, type FunctionComponent } from "react";
|
|
2
2
|
import { Hooks } from "react-table";
|
|
3
3
|
|
|
4
4
|
import { Operation } from "../../../interfaces";
|
|
5
5
|
import { DefaultCellOperations } from "../components/defaultCellOperations.component";
|
|
6
6
|
|
|
7
7
|
export type UseOperationsHookProps = {
|
|
8
|
-
CellOperations?:
|
|
8
|
+
CellOperations?: FunctionComponent | ComponentType<{}>;
|
|
9
9
|
operations: Operation[];
|
|
10
10
|
onClick?: (data: any, event: string) => void;
|
|
11
11
|
i18n?: (f: string) => string;
|
|
@@ -14,7 +14,7 @@ export type UseOperationsHookProps = {
|
|
|
14
14
|
|
|
15
15
|
export function useOperations<D extends object = {}>({
|
|
16
16
|
operations,
|
|
17
|
-
CellOperations = DefaultCellOperations,
|
|
17
|
+
CellOperations = DefaultCellOperations as FunctionComponent,
|
|
18
18
|
onClick,
|
|
19
19
|
i18n = (f: string) => f,
|
|
20
20
|
ctx
|