@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.
Files changed (26) hide show
  1. package/coverage.json +4 -4
  2. package/dist/components/actions-table/actionsTable.stories.d.ts +8 -53
  3. package/dist/components/form-access/formAccess.component.d.ts +2 -13
  4. package/dist/components/form-access/formAccess.stories.d.ts +3 -44
  5. package/dist/components/form-control/formControl.component.d.ts +3 -11
  6. package/dist/components/select/select.component.d.ts +5 -18
  7. package/dist/components/table/components/defaultCellOperations.component.d.ts +12 -1
  8. package/dist/components/table/components/defaultOperationButton.component.d.ts +4 -4
  9. package/dist/components/table/hooks/useOperations.hook.d.ts +2 -2
  10. package/dist/index.js +1113 -1265
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.modern.js +226 -244
  13. package/dist/index.modern.js.map +1 -1
  14. package/package.json +13 -6
  15. package/src/components/__fixtures__/form-actions.json +240 -0
  16. package/src/components/actions-table/__fixtures__/data.json +12 -0
  17. package/src/components/actions-table/actionsTable.component.spec.tsx +42 -11
  18. package/src/components/actions-table/actionsTable.component.tsx +2 -1
  19. package/src/components/actions-table/actionsTable.stories.tsx +71 -289
  20. package/src/components/form-access/formAccess.component.tsx +2 -12
  21. package/src/components/form-access/formAccess.stories.tsx +55 -49
  22. package/src/components/form-control/formControl.component.tsx +4 -11
  23. package/src/components/select/select.component.tsx +9 -22
  24. package/src/components/table/components/defaultCellOperations.component.tsx +17 -4
  25. package/src/components/table/components/defaultOperationButton.component.tsx +9 -4
  26. package/src/components/table/hooks/useOperations.hook.tsx +3 -3
@@ -1,11 +1,10 @@
1
1
  import classnames from "classnames";
2
- import React from "react";
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?: React.ComponentType;
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