@tsed/react-formio 1.13.2 → 1.13.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.
Files changed (133) hide show
  1. package/.eslintignore +13 -0
  2. package/.eslintrc.js +7 -0
  3. package/coverage.json +6 -0
  4. package/dist/components/form-control/formControl.component.d.ts +2 -2
  5. package/dist/components/form-control/formControl.component.spec.d.ts +1 -0
  6. package/dist/components/form-control/formControl.stories.d.ts +57 -0
  7. package/dist/components/index.d.ts +2 -2
  8. package/dist/components/table/components/defaultCellHeader.component.d.ts +1 -1
  9. package/dist/components/table/index.d.ts +1 -1
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +7904 -7902
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.modern.js +5506 -5500
  14. package/dist/index.modern.js.map +1 -1
  15. package/dist/stores/actions/index.d.ts +1 -1
  16. package/dist/stores/auth/index.d.ts +4 -4
  17. package/dist/stores/index.d.ts +2 -2
  18. package/jest.config.js +6 -1
  19. package/package.json +7 -4
  20. package/src/components/actions-table/actionsTable.component.spec.tsx +11 -11
  21. package/src/components/actions-table/actionsTable.component.tsx +8 -9
  22. package/src/components/actions-table/actionsTable.stories.tsx +1 -0
  23. package/src/components/alert/alert.component.spec.tsx +21 -19
  24. package/src/components/alert/alert.stories.tsx +1 -0
  25. package/src/components/card/card.component.spec.tsx +5 -4
  26. package/src/components/card/card.stories.tsx +1 -0
  27. package/src/components/form/form.component.spec.tsx +7 -6
  28. package/src/components/form/form.component.tsx +2 -1
  29. package/src/components/form/form.stories.tsx +60 -75
  30. package/src/components/form/useForm.hook.ts +13 -12
  31. package/src/components/form-access/formAccess.component.tsx +2 -1
  32. package/src/components/form-access/formAccess.schema.ts +1 -0
  33. package/src/components/form-access/formAccess.stories.tsx +1 -0
  34. package/src/components/form-access/formAccess.utils.ts +9 -8
  35. package/src/components/form-action/formAction.component.tsx +4 -3
  36. package/src/components/form-action/formAction.stories.tsx +225 -227
  37. package/src/components/form-builder/formBuilder.component.tsx +1 -0
  38. package/src/components/form-builder/formBuilder.stories.tsx +1 -0
  39. package/src/components/form-control/formControl.component.spec.tsx +76 -0
  40. package/src/components/form-control/formControl.component.tsx +15 -7
  41. package/src/components/form-control/formControl.stories.tsx +65 -0
  42. package/src/components/form-edit/formCtas.component.tsx +25 -26
  43. package/src/components/form-edit/formEdit.component.tsx +1 -0
  44. package/src/components/form-edit/formEdit.reducer.ts +1 -0
  45. package/src/components/form-edit/formEdit.stories.tsx +1 -0
  46. package/src/components/form-edit/formParameters.component.tsx +1 -0
  47. package/src/components/form-edit/useFormEdit.hook.ts +1 -0
  48. package/src/components/form-settings/formSettings.component.spec.tsx +7 -6
  49. package/src/components/form-settings/formSettings.component.tsx +12 -14
  50. package/src/components/form-settings/formSettings.stories.tsx +1 -0
  51. package/src/components/form-settings/formSettings.utils.ts +1 -0
  52. package/src/components/forms-table/components/formCell.component.tsx +1 -0
  53. package/src/components/forms-table/formsTable.component.tsx +23 -25
  54. package/src/components/forms-table/formsTable.stories.tsx +1 -0
  55. package/src/components/index.ts +2 -2
  56. package/src/components/input-tags/inputTags.component.tsx +5 -4
  57. package/src/components/input-tags/inputTags.stories.tsx +1 -0
  58. package/src/components/input-text/inputText.component.spec.tsx +12 -11
  59. package/src/components/input-text/inputText.component.tsx +1 -0
  60. package/src/components/input-text/inputText.stories.tsx +1 -0
  61. package/src/components/loader/loader.component.spec.tsx +6 -5
  62. package/src/components/loader/loader.component.tsx +1 -0
  63. package/src/components/loader/loader.stories.tsx +1 -0
  64. package/src/components/modal/modal.component.spec.tsx +36 -33
  65. package/src/components/modal/modal.component.tsx +1 -1
  66. package/src/components/modal/modal.stories.tsx +1 -0
  67. package/src/components/modal/removeModal.component.tsx +1 -0
  68. package/src/components/pagination/pagination.component.spec.tsx +24 -21
  69. package/src/components/pagination/pagination.component.tsx +1 -0
  70. package/src/components/pagination/pagination.stories.tsx +1 -0
  71. package/src/components/react-component/reactComponent.component.tsx +3 -2
  72. package/src/components/select/select.component.spec.tsx +17 -18
  73. package/src/components/select/select.component.tsx +1 -0
  74. package/src/components/select/select.stories.tsx +1 -0
  75. package/src/components/submissions-table/submissionsTable.component.tsx +6 -5
  76. package/src/components/submissions-table/submissionsTable.stories.tsx +1 -0
  77. package/src/components/table/components/defaultArrowSort.component.tsx +1 -0
  78. package/src/components/table/components/defaultCellHeader.component.tsx +1 -1
  79. package/src/components/table/components/defaultCellOperations.component.tsx +1 -0
  80. package/src/components/table/components/defaultOperationButton.component.tsx +1 -0
  81. package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +5 -3
  82. package/src/components/table/filters/defaultColumnFilter.component.tsx +1 -0
  83. package/src/components/table/filters/selectColumnFilter.component.spec.tsx +9 -7
  84. package/src/components/table/filters/selectColumnFilter.component.tsx +1 -0
  85. package/src/components/table/index.ts +1 -1
  86. package/src/components/table/table.component.tsx +45 -58
  87. package/src/components/table/table.stories.tsx +2 -1
  88. package/src/components/table/utils/mapFormToColumns.tsx +2 -1
  89. package/src/components/table/utils/useOperations.hook.tsx +1 -0
  90. package/src/components/tabs/tabs.component.spec.tsx +6 -5
  91. package/src/components/tabs/tabs.component.stories.tsx +1 -0
  92. package/src/components/tabs/tabs.component.tsx +10 -4
  93. package/src/index.ts +3 -4
  94. package/src/interfaces/Operation.ts +1 -0
  95. package/src/stores/action/action.actions.spec.ts +1 -0
  96. package/src/stores/action/action.actions.ts +1 -0
  97. package/src/stores/action/action.reducers.ts +1 -1
  98. package/src/stores/action-info/action-info.actions.spec.ts +1 -0
  99. package/src/stores/action-info/action-info.actions.ts +2 -1
  100. package/src/stores/action-info/action-info.reducers.ts +2 -1
  101. package/src/stores/action-info/action-info.selectors.ts +2 -1
  102. package/src/stores/actions/actions.actions.spec.ts +1 -0
  103. package/src/stores/actions/actions.actions.ts +1 -0
  104. package/src/stores/actions/actions.reducers.ts +1 -0
  105. package/src/stores/actions/index.ts +1 -1
  106. package/src/stores/auth/auth.actions.ts +1 -0
  107. package/src/stores/auth/auth.reducers.ts +1 -0
  108. package/src/stores/auth/auth.selectors.ts +1 -0
  109. package/src/stores/auth/auth.utils.tsx +2 -1
  110. package/src/stores/auth/getAccess.action.spec.ts +1 -0
  111. package/src/stores/auth/getAccess.action.ts +1 -0
  112. package/src/stores/auth/getProjectAccess.action.ts +1 -0
  113. package/src/stores/auth/index.ts +4 -4
  114. package/src/stores/auth/initAuth.action.spec.ts +1 -0
  115. package/src/stores/auth/initAuth.action.ts +1 -0
  116. package/src/stores/auth/logout.action.spec.ts +2 -1
  117. package/src/stores/auth/logout.action.ts +1 -0
  118. package/src/stores/auth/setUser.action.spec.ts +1 -0
  119. package/src/stores/auth/setUser.action.ts +1 -0
  120. package/src/stores/form/form.actions.spec.ts +1 -0
  121. package/src/stores/form/form.actions.ts +1 -0
  122. package/src/stores/form/form.reducers.ts +1 -0
  123. package/src/stores/forms/forms.actions.spec.ts +1 -0
  124. package/src/stores/forms/forms.actions.ts +1 -0
  125. package/src/stores/forms/forms.reducers.ts +1 -0
  126. package/src/stores/index.ts +3 -2
  127. package/src/stores/root/root.selectors.ts +1 -1
  128. package/src/stores/submission/submission.actions.spec.ts +1 -0
  129. package/src/stores/submission/submission.actions.ts +1 -0
  130. package/src/stores/submission/submission.reducers.ts +1 -0
  131. package/src/stores/submissions/submissions.actions.spec.ts +1 -0
  132. package/src/stores/submissions/submissions.actions.ts +1 -0
  133. package/src/stores/submissions/submissions.reducers.ts +1 -0
@@ -1,23 +1,14 @@
1
1
  import classnames from "classnames";
2
2
  import noop from "lodash/noop";
3
- import React, {PropsWithChildren} from "react";
4
- import {
5
- CellProps,
6
- FilterProps,
7
- Renderer,
8
- TableOptions,
9
- useFilters,
10
- useGroupBy,
11
- usePagination,
12
- useSortBy,
13
- useTable
14
- } from "react-table";
15
- import {OnClickOperation, Operation, QueryOptions} from "../../interfaces";
16
- import {Pagination as DefaultPagination} from "../pagination/pagination.component";
17
- import {DefaultArrowSort} from "./components/defaultArrowSort.component";
18
- import {DefaultCellHeader, DefaultCellHeaderProps} from "./components/defaultCellHeader.component";
19
- import {DefaultColumnFilter} from "./filters/defaultColumnFilter.component";
20
- import {useOperations} from "./utils/useOperations.hook";
3
+ import React, { PropsWithChildren } from "react";
4
+ import { CellProps, FilterProps, Renderer, TableOptions, useFilters, useGroupBy, usePagination, useSortBy, useTable } from "react-table";
5
+
6
+ import { OnClickOperation, Operation, QueryOptions } from "../../interfaces";
7
+ import { Pagination as DefaultPagination } from "../pagination/pagination.component";
8
+ import { DefaultArrowSort } from "./components/defaultArrowSort.component";
9
+ import { DefaultCellHeader, DefaultCellHeaderProps } from "./components/defaultCellHeader.component";
10
+ import { DefaultColumnFilter } from "./filters/defaultColumnFilter.component";
11
+ import { useOperations } from "./utils/useOperations.hook";
21
12
 
22
13
  export interface TableProps<Data extends object = any> extends TableOptions<Data>, Partial<QueryOptions> {
23
14
  className?: string;
@@ -102,7 +93,7 @@ function DefaultLoader() {
102
93
  }
103
94
 
104
95
  function DefaultEmptyData() {
105
- return <div className="text-center p-2 pb-4 font-bold">No data found</div>;
96
+ return <div className='text-center p-2 pb-4 font-bold'>No data found</div>;
106
97
  }
107
98
 
108
99
  const hooks = [useFilters, useGroupBy, useSortBy, usePagination];
@@ -171,12 +162,12 @@ export function Table<Data extends object = any>(props: PropsWithChildren<TableP
171
162
  setFilterId
172
163
  } as any,
173
164
  ...hooks,
174
- useOperations({operations, CellOperations, onClick: _onClick, ctx, i18n})
165
+ useOperations({ operations, CellOperations, onClick: _onClick, ctx, i18n })
175
166
  );
176
167
 
177
168
  const {
178
169
  setPageSize,
179
- state: {pageIndex, pageSize, sortBy, filters}
170
+ state: { pageIndex, pageSize, sortBy, filters }
180
171
  } = tableInstance;
181
172
 
182
173
  React.useEffect(() => {
@@ -198,49 +189,45 @@ export function Table<Data extends object = any>(props: PropsWithChildren<TableP
198
189
  /* style={{ marginBottom: disablePagination ? "-1px" : "0px" }} */
199
190
  >
200
191
  <thead>
201
- {tableInstance.headerGroups.map((headerGroup, i) => (
202
- <tr {...headerGroup.getHeaderGroupProps()} key={`tableInstance.headerGroups${i}`}>
203
- {headerGroup.headers.map((column) => (
204
- <th
205
- /* className='text-left py-2 align-top' */
206
- {...column.getHeaderProps()}
207
- key={`tableInstance.headers.column.${column.id}`}
208
- >
209
- <CellHeader column={column}/>
210
- </th>
211
- ))}
212
- </tr>
213
- ))}
192
+ {tableInstance.headerGroups.map((headerGroup, i) => (
193
+ <tr {...headerGroup.getHeaderGroupProps()} key={`tableInstance.headerGroups${i}`}>
194
+ {headerGroup.headers.map((column) => (
195
+ <th
196
+ /* className='text-left py-2 align-top' */
197
+ {...column.getHeaderProps()}
198
+ key={`tableInstance.headers.column.${column.id}`}
199
+ >
200
+ <CellHeader column={column} />
201
+ </th>
202
+ ))}
203
+ </tr>
204
+ ))}
214
205
  </thead>
215
206
  {!isLoading ? (
216
207
  <tbody {...tableInstance.getTableBodyProps()}>
217
- {tableInstance.page.map((row) => {
218
- tableInstance.prepareRow(row);
219
- return (
220
- <tr onClick={() => _onClick(row.original, "row")} {...row.getRowProps()}
221
- key={`tableInstance.page.${row.id}`}>
222
- {row.cells.map((cell, i) => {
223
- const {hidden, colspan} = cell.column as any;
224
- if (hidden) {
225
- return null;
226
- }
227
- return (
228
- <td
229
- colSpan={colspan}
230
- {...cell.getCellProps()}
231
- key={`tableInstance.page.cells.${cell.value || "value"}.${i}`}>
232
- {cell.render("Cell")}
233
- </td>
234
- );
235
- })}
236
- </tr>
237
- );
238
- })}
208
+ {tableInstance.page.map((row) => {
209
+ tableInstance.prepareRow(row);
210
+ return (
211
+ <tr onClick={() => _onClick(row.original, "row")} {...row.getRowProps()} key={`tableInstance.page.${row.id}`}>
212
+ {row.cells.map((cell, i) => {
213
+ const { hidden, colspan } = cell.column as any;
214
+ if (hidden) {
215
+ return null;
216
+ }
217
+ return (
218
+ <td colSpan={colspan} {...cell.getCellProps()} key={`tableInstance.page.cells.${cell.value || "value"}.${i}`}>
219
+ {cell.render("Cell")}
220
+ </td>
221
+ );
222
+ })}
223
+ </tr>
224
+ );
225
+ })}
239
226
  </tbody>
240
227
  ) : null}
241
228
  </table>
242
- {isLoading ? <Loader/> : null}
243
- {!data.length ? <EmptyData/> : null}
229
+ {isLoading ? <Loader /> : null}
230
+ {!data.length ? <EmptyData /> : null}
244
231
  {!isLoading && data.length && !disablePagination ? (
245
232
  <div className={"overflow-hidden"}>
246
233
  <Pagination
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
+
3
+ import { mapPagination } from "../../utils/mapPagination";
2
4
  import formSchema from "../__fixtures__/form-schema.json";
3
5
  import formSubmissions from "../__fixtures__/form-submissions.json";
4
6
  import { Table } from "./table.component";
5
7
  import { mapFormToColumns } from "./utils/mapFormToColumns";
6
- import { mapPagination } from "../../utils/mapPagination";
7
8
 
8
9
  export default {
9
10
  title: "ReactFormio/Table",
@@ -1,7 +1,8 @@
1
- import React from "react";
2
1
  import { Components, ExtendedComponentSchema } from "formiojs";
3
2
  import FormioUtils from "formiojs/utils";
3
+ import React from "react";
4
4
  import { Column } from "react-table";
5
+
5
6
  import { FormSchema } from "../../../interfaces";
6
7
  import { DefaultCell } from "../components/defaultCell.component";
7
8
  import { SelectColumnFilter } from "../filters/selectColumnFilter.component";
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { Hooks } from "react-table";
3
+
3
4
  import { Operation } from "../../../interfaces";
4
5
  import { DefaultCellOperations } from "../components/defaultCellOperations.component";
5
6
 
@@ -1,7 +1,8 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
1
2
  import * as React from "react";
2
- import {fireEvent, render, screen} from "@testing-library/react";
3
- import {Sandbox} from "./tabs.component.stories";
4
- import {Tabs} from "./tabs.component";
3
+
4
+ import { Tabs } from "./tabs.component";
5
+ import { Sandbox } from "./tabs.component.stories";
5
6
 
6
7
  describe("tabs", () => {
7
8
  it("should display the tabs component and children", () => {
@@ -20,7 +21,7 @@ describe("tabs", () => {
20
21
  }
21
22
  ];
22
23
 
23
- render(<Sandbox {...Sandbox.args} items={items}/>);
24
+ render(<Sandbox {...Sandbox.args} items={items} />);
24
25
 
25
26
  const tabsComponent = screen.getByTestId("tabs-comp");
26
27
 
@@ -67,7 +68,7 @@ describe("tabs", () => {
67
68
  ];
68
69
  const onClick = jest.fn();
69
70
 
70
- render(<Tabs items={items} onClick={onClick}/>);
71
+ render(<Tabs items={items} onClick={onClick} />);
71
72
 
72
73
  const buttonsTab = screen.getAllByTitle("button-tab");
73
74
  const chevronLeftButtonTab = buttonsTab[0];
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from "react";
2
+
2
3
  import { Tabs } from "./tabs.component";
3
4
 
4
5
  const useTabs = (args: any) => {
@@ -1,12 +1,16 @@
1
1
  import classnames from "classnames";
2
2
  import React, { PropsWithChildren } from "react";
3
+
3
4
  import { iconClass } from "../../utils/iconClass";
4
5
 
5
6
  export function ButtonTab({ icon, back, onClick, isActive, reverse, children, className, after }: PropsWithChildren<any>) {
6
7
  return (
7
- <div title={'button-wrapper'} className={classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)}>
8
+ <div
9
+ title={"button-wrapper"}
10
+ className={classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)}
11
+ >
8
12
  <button
9
- title={'button-tab'}
13
+ title={"button-tab"}
10
14
  className={classnames("tw-tabs__button", reverse ? "-reverse" : "", isActive ? "-active" : "", back ? "-back" : "")}
11
15
  onClick={onClick}
12
16
  >
@@ -51,7 +55,7 @@ export function Tabs({
51
55
  ...additionalProps
52
56
  }: PropsWithChildren<TabsProps>) {
53
57
  return (
54
- <div data-testid={'tabs-comp'} className={`tw-tabs ${className}`} style={style}>
58
+ <div data-testid={"tabs-comp"} className={`tw-tabs ${className}`} style={style}>
55
59
  <div>
56
60
  <nav className='tw-tabs__header'>
57
61
  <div className='tw-tabs__header-wrapper'>
@@ -80,7 +84,9 @@ export function Tabs({
80
84
  </nav>
81
85
  {HeaderChildren && <HeaderChildren {...additionalProps} current={current} />}
82
86
  </div>
83
- <div title={"tab-body"} className={"tw-tabs__body"}>{children}</div>
87
+ <div title={"tab-body"} className={"tw-tabs__body"}>
88
+ {children}
89
+ </div>
84
90
  </div>
85
91
  );
86
92
  }
package/src/index.ts CHANGED
@@ -11,11 +11,10 @@ export {
11
11
  // editFormUtils,
12
12
  };
13
13
 
14
- export * from "./stores";
15
- export * from "./interfaces";
16
14
  export * from "./components";
17
15
  export * from "./hooks/useTooltip";
16
+ export * from "./interfaces";
17
+ export * from "./stores";
18
18
  export * from "./utils/iconClass";
19
19
  export * from "./utils/url";
20
-
21
- export { Components, Formio, Utils, Templates } from "formiojs";
20
+ export { Components, Formio, Templates, Utils } from "formiojs";
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+
2
3
  import { OperationButtonProps } from "../components/table/components/defaultOperationButton.component";
3
4
 
4
5
  export type PermissionsResolver<Data = any> = (data: Data, ctx: any) => void;
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { getActionInfo } from "../action-info";
3
4
  import {
4
5
  clearActionError,
@@ -2,6 +2,7 @@ import { createAction } from "@tsed/redux-utils";
2
2
  import { Formio } from "formiojs";
3
3
  import get from "lodash/get";
4
4
  import noop from "lodash/noop";
5
+
5
6
  import { getActionUrl } from "../../utils/url";
6
7
  import { getActionInfo } from "../action-info";
7
8
  import { ACTION } from "./action.constant";
@@ -1,6 +1,6 @@
1
1
  import { createReducer, InitialStateCreator } from "@tsed/redux-utils";
2
- import { ActionSchema } from "../../interfaces";
3
2
 
3
+ import { ActionSchema } from "../../interfaces";
4
4
  import { clearActionError, failAction, receiveAction, requestAction, resetAction, sendAction } from "./action.actions";
5
5
  import { ACTION } from "./action.constant";
6
6
 
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { getActionInfo, receiveActionInfo, requestActionInfo } from "./action-info.actions";
3
4
 
4
5
  jest.mock("formiojs/Formio");
@@ -1,6 +1,7 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
- import noop from "lodash/noop";
3
2
  import { Formio } from "formiojs";
3
+ import noop from "lodash/noop";
4
+
4
5
  import { getFormUrl } from "../../utils/url";
5
6
  import { ACTION_INFO } from "./action-info.constant";
6
7
 
@@ -1,4 +1,5 @@
1
- import { InitialStateCreator, createReducer } from "@tsed/redux-utils";
1
+ import { createReducer, InitialStateCreator } from "@tsed/redux-utils";
2
+
2
3
  import { ActionSchema } from "../../interfaces";
3
4
  import { failActionInfo, receiveActionInfo, requestActionInfo, resetActionInfo } from "./action-info.actions";
4
5
  import { ACTION_INFO } from "./action-info.constant";
@@ -3,4 +3,5 @@ import { selectRoot } from "../root";
3
3
  import { ACTION_INFO } from "./action-info.constant";
4
4
  import { ActionInfoState } from "./action-info.reducers";
5
5
 
6
- export const selectActionInfo = (state: Record<string, any>): Partial<ActionSchema> => selectRoot<ActionInfoState>(ACTION_INFO, state).data!;
6
+ export const selectActionInfo = (state: Record<string, any>): Partial<ActionSchema> =>
7
+ selectRoot<ActionInfoState>(ACTION_INFO, state).data!;
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { getActions, receiveActions, requestActions, resetActions } from "./actions.actions";
3
4
 
4
5
  jest.mock("formiojs");
@@ -1,6 +1,7 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
2
  import { Formio } from "formiojs";
3
3
  import noop from "lodash/noop";
4
+
4
5
  import { getFormUrl } from "../../utils/url";
5
6
  import { ACTIONS } from "./actions.constant";
6
7
 
@@ -1,4 +1,5 @@
1
1
  import { createReducer, InitialStateCreator } from "@tsed/redux-utils";
2
+
2
3
  import { ActionInfoSchema, ActionSchema } from "../../interfaces";
3
4
  import { failActions, receiveActions, requestActions, resetActions } from "./actions.actions";
4
5
  import { ACTIONS } from "./actions.constant";
@@ -1,4 +1,4 @@
1
- export * from "./actions.constant";
2
1
  export * from "./actions.actions";
2
+ export * from "./actions.constant";
3
3
  export * from "./actions.reducers";
4
4
  export * from "./actions.selectors";
@@ -1,4 +1,5 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
+
2
3
  import { FormSchema, RoleSchema, Submission } from "../../interfaces";
3
4
 
4
5
  export const requestUser = createAction();
@@ -1,4 +1,5 @@
1
1
  import { createReducer } from "@tsed/redux-utils";
2
+
2
3
  import { FormSchema, Submission } from "../../interfaces";
3
4
  import { RoleSchema } from "../../interfaces/RoleSchema";
4
5
  import {
@@ -1,4 +1,5 @@
1
1
  import get from "lodash/get";
2
+
2
3
  import { RoleSchema, Submission } from "../../interfaces";
3
4
  import { selectRoot } from "../root";
4
5
  import { AUTH } from "./auth.constant";
@@ -1,4 +1,5 @@
1
1
  import get from "lodash/get";
2
+
2
3
  import { FormSchema } from "../../interfaces/FormSchema";
3
4
  import { AuthState } from "./auth.reducers";
4
5
 
@@ -29,7 +30,7 @@ export function checkRoleFormAccess(auth: AuthState, form?: Partial<FormSchema>,
29
30
  return true;
30
31
  }
31
32
 
32
- return (roles.includes("owner") && get(form, "owner") === get(auth, "user._id"));
33
+ return roles.includes("owner") && get(form, "owner") === get(auth, "user._id");
33
34
  }
34
35
 
35
36
  return true;
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { formAccessUser, submissionAccessUser, userForms, userRoles } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
  import { getAccess } from "./getAccess.action";
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { RoleSchema } from "../../interfaces";
3
4
  import { FormSchema } from "../../interfaces/FormSchema";
4
5
  import { formAccessUser, submissionAccessUser, userForms, userRoles } from "./auth.actions";
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { projectAccessUser } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
 
@@ -1,10 +1,10 @@
1
- export * from "./auth.constant";
2
- export * from "./auth.utils";
3
1
  export * from "./auth.actions";
2
+ export * from "./auth.constant";
4
3
  export * from "./auth.reducers";
5
4
  export * from "./auth.selectors";
6
- export * from "./getProjectAccess.action";
5
+ export * from "./auth.utils";
7
6
  export * from "./getAccess.action";
7
+ export * from "./getProjectAccess.action";
8
+ export * from "./initAuth.action";
8
9
  export * from "./logout.action";
9
10
  export * from "./setUser.action";
10
- export * from "./initAuth.action";
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { requestUser } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
  import { getAccess } from "./getAccess.action";
@@ -1,5 +1,6 @@
1
1
  import { Formio } from "formiojs";
2
2
  import noop from "lodash/noop";
3
+
3
4
  import { failUser, requestUser } from "./auth.actions";
4
5
  import { AUTH } from "./auth.constant";
5
6
  import { getAccess } from "./getAccess.action";
@@ -1,10 +1,11 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { logoutUser } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
  import { logout } from "./logout.action";
5
6
 
6
7
  jest.mock("./auth.actions");
7
- jest.mock('formiojs')
8
+ jest.mock("formiojs");
8
9
 
9
10
  describe("logout()", () => {
10
11
  beforeEach(() => {
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { logoutUser } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { receiveUser } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
  import { setUser } from "./setUser.action";
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { receiveUser } from "./auth.actions";
3
4
  import { AUTH } from "./auth.constant";
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { deleteForm, failForm, getForm, receiveForm, requestForm, resetForm, saveForm, sendForm } from "./form.actions";
3
4
 
4
5
  jest.mock("formiojs");
@@ -1,6 +1,7 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
2
  import { Formio } from "formiojs";
3
3
  import noop from "lodash/noop";
4
+
4
5
  import { FormSchema } from "../../interfaces";
5
6
  import { getFormUrl } from "../../utils/url";
6
7
  import { getActions } from "../actions";
@@ -1,4 +1,5 @@
1
1
  import { createReducer, InitialStateCreator } from "@tsed/redux-utils";
2
+
2
3
  import { FormSchema } from "../../interfaces";
3
4
  import { clearFormError, failForm, receiveForm, requestForm, resetForm, sendForm } from "./form.actions";
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { mapRequestParams } from "../../utils/mapRequestParams";
3
4
  import { failForms, getForms, receiveForms, requestForms } from "./forms.actions";
4
5
 
@@ -1,6 +1,7 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
2
  import { Formio } from "formiojs";
3
3
  import noop from "lodash/noop";
4
+
4
5
  import { FormSchema } from "../../interfaces";
5
6
  import type { RequestParamsOptions } from "../../utils/mapRequestParams";
6
7
  import { mapRequestParams } from "../../utils/mapRequestParams";
@@ -1,4 +1,5 @@
1
1
  import { createReducer } from "@tsed/redux-utils";
2
+
2
3
  import { FormSchema } from "../../interfaces";
3
4
  import { failForms, receiveForms, requestForms, resetForms } from "./forms.actions";
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { combine } from "@tsed/redux-utils";
2
+
2
3
  import { actionReducer } from "./action";
3
4
  import { actionInfoReducer } from "./action-info";
4
5
  import { actionsReducer } from "./actions";
@@ -8,15 +9,15 @@ import { formsReducer } from "./forms";
8
9
  import { submissionReducer } from "./submission";
9
10
  import { submissionsReducer } from "./submissions";
10
11
 
11
- export * from "./auth";
12
12
  export * from "./action";
13
13
  export * from "./action-info";
14
14
  export * from "./actions";
15
+ export * from "./auth";
15
16
  export * from "./form";
16
17
  export * from "./forms";
18
+ export * from "./root";
17
19
  export * from "./submission";
18
20
  export * from "./submissions";
19
- export * from "./root";
20
21
 
21
22
  export const defaultFormioReducer = combine(
22
23
  authReducer,
@@ -2,7 +2,7 @@ import get from "lodash/get";
2
2
 
3
3
  export function selectRoot<State = Record<string, any>>(name: string): (state: Record<string, any>) => State;
4
4
  export function selectRoot<State = Record<string, any>>(name: string, state: Record<string, any>): State;
5
- export function selectRoot<State = Record<string, any>>(name: string, state?: Record<string, any>): any {
5
+ export function selectRoot<State = Record<string, any>>(name: string, state?: Record<string, any>): State & any {
6
6
  if (state) {
7
7
  return state[name];
8
8
  }
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import {
3
4
  clearSubmissionError,
4
5
  deleteSubmission,
@@ -1,6 +1,7 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
2
  import { Formio } from "formiojs";
3
3
  import noop from "lodash/noop";
4
+
4
5
  import { Submission } from "../../interfaces";
5
6
  import { getSubmissionUrl } from "../../utils/url";
6
7
 
@@ -1,4 +1,5 @@
1
1
  import { createReducer, InitialStateCreator } from "@tsed/redux-utils";
2
+
2
3
  import { Submission } from "../../interfaces";
3
4
  import {
4
5
  clearSubmissionError,
@@ -1,4 +1,5 @@
1
1
  import { Formio } from "formiojs";
2
+
2
3
  import { mapRequestParams } from "../../utils/mapRequestParams";
3
4
  import { failSubmissions, getSubmissions, receiveSubmissions, requestSubmissions } from "./submissions.actions";
4
5
 
@@ -1,6 +1,7 @@
1
1
  import { createAction } from "@tsed/redux-utils";
2
2
  import { Formio } from "formiojs";
3
3
  import noop from "lodash/noop";
4
+
4
5
  import { mapRequestParams } from "../../utils/mapRequestParams";
5
6
  import { getSubmissionUrl } from "../../utils/url";
6
7
  import { selectSubmissionsParameters } from "./submissions.selectors";
@@ -1,4 +1,5 @@
1
1
  import { createReducer } from "@tsed/redux-utils";
2
+
2
3
  import { Submission } from "../../interfaces/Submission";
3
4
  import { failSubmissions, receiveSubmissions, requestSubmissions, resetSubmissions } from "./submissions.actions";
4
5