@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.
- package/.eslintignore +13 -0
- package/.eslintrc.js +7 -0
- package/coverage.json +6 -0
- package/dist/components/form-control/formControl.component.d.ts +2 -2
- package/dist/components/form-control/formControl.component.spec.d.ts +1 -0
- package/dist/components/form-control/formControl.stories.d.ts +57 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/table/components/defaultCellHeader.component.d.ts +1 -1
- package/dist/components/table/index.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7904 -7902
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +5506 -5500
- package/dist/index.modern.js.map +1 -1
- package/dist/stores/actions/index.d.ts +1 -1
- package/dist/stores/auth/index.d.ts +4 -4
- package/dist/stores/index.d.ts +2 -2
- package/jest.config.js +6 -1
- package/package.json +7 -4
- package/src/components/actions-table/actionsTable.component.spec.tsx +11 -11
- package/src/components/actions-table/actionsTable.component.tsx +8 -9
- package/src/components/actions-table/actionsTable.stories.tsx +1 -0
- package/src/components/alert/alert.component.spec.tsx +21 -19
- package/src/components/alert/alert.stories.tsx +1 -0
- package/src/components/card/card.component.spec.tsx +5 -4
- package/src/components/card/card.stories.tsx +1 -0
- package/src/components/form/form.component.spec.tsx +7 -6
- package/src/components/form/form.component.tsx +2 -1
- package/src/components/form/form.stories.tsx +60 -75
- package/src/components/form/useForm.hook.ts +13 -12
- package/src/components/form-access/formAccess.component.tsx +2 -1
- package/src/components/form-access/formAccess.schema.ts +1 -0
- package/src/components/form-access/formAccess.stories.tsx +1 -0
- package/src/components/form-access/formAccess.utils.ts +9 -8
- package/src/components/form-action/formAction.component.tsx +4 -3
- package/src/components/form-action/formAction.stories.tsx +225 -227
- package/src/components/form-builder/formBuilder.component.tsx +1 -0
- package/src/components/form-builder/formBuilder.stories.tsx +1 -0
- package/src/components/form-control/formControl.component.spec.tsx +76 -0
- package/src/components/form-control/formControl.component.tsx +15 -7
- package/src/components/form-control/formControl.stories.tsx +65 -0
- package/src/components/form-edit/formCtas.component.tsx +25 -26
- package/src/components/form-edit/formEdit.component.tsx +1 -0
- package/src/components/form-edit/formEdit.reducer.ts +1 -0
- package/src/components/form-edit/formEdit.stories.tsx +1 -0
- package/src/components/form-edit/formParameters.component.tsx +1 -0
- package/src/components/form-edit/useFormEdit.hook.ts +1 -0
- package/src/components/form-settings/formSettings.component.spec.tsx +7 -6
- package/src/components/form-settings/formSettings.component.tsx +12 -14
- package/src/components/form-settings/formSettings.stories.tsx +1 -0
- package/src/components/form-settings/formSettings.utils.ts +1 -0
- package/src/components/forms-table/components/formCell.component.tsx +1 -0
- package/src/components/forms-table/formsTable.component.tsx +23 -25
- package/src/components/forms-table/formsTable.stories.tsx +1 -0
- package/src/components/index.ts +2 -2
- package/src/components/input-tags/inputTags.component.tsx +5 -4
- package/src/components/input-tags/inputTags.stories.tsx +1 -0
- package/src/components/input-text/inputText.component.spec.tsx +12 -11
- package/src/components/input-text/inputText.component.tsx +1 -0
- package/src/components/input-text/inputText.stories.tsx +1 -0
- package/src/components/loader/loader.component.spec.tsx +6 -5
- package/src/components/loader/loader.component.tsx +1 -0
- package/src/components/loader/loader.stories.tsx +1 -0
- package/src/components/modal/modal.component.spec.tsx +36 -33
- package/src/components/modal/modal.component.tsx +1 -1
- package/src/components/modal/modal.stories.tsx +1 -0
- package/src/components/modal/removeModal.component.tsx +1 -0
- package/src/components/pagination/pagination.component.spec.tsx +24 -21
- package/src/components/pagination/pagination.component.tsx +1 -0
- package/src/components/pagination/pagination.stories.tsx +1 -0
- package/src/components/react-component/reactComponent.component.tsx +3 -2
- package/src/components/select/select.component.spec.tsx +17 -18
- package/src/components/select/select.component.tsx +1 -0
- package/src/components/select/select.stories.tsx +1 -0
- package/src/components/submissions-table/submissionsTable.component.tsx +6 -5
- package/src/components/submissions-table/submissionsTable.stories.tsx +1 -0
- package/src/components/table/components/defaultArrowSort.component.tsx +1 -0
- package/src/components/table/components/defaultCellHeader.component.tsx +1 -1
- package/src/components/table/components/defaultCellOperations.component.tsx +1 -0
- package/src/components/table/components/defaultOperationButton.component.tsx +1 -0
- package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +5 -3
- package/src/components/table/filters/defaultColumnFilter.component.tsx +1 -0
- package/src/components/table/filters/selectColumnFilter.component.spec.tsx +9 -7
- package/src/components/table/filters/selectColumnFilter.component.tsx +1 -0
- package/src/components/table/index.ts +1 -1
- package/src/components/table/table.component.tsx +45 -58
- package/src/components/table/table.stories.tsx +2 -1
- package/src/components/table/utils/mapFormToColumns.tsx +2 -1
- package/src/components/table/utils/useOperations.hook.tsx +1 -0
- package/src/components/tabs/tabs.component.spec.tsx +6 -5
- package/src/components/tabs/tabs.component.stories.tsx +1 -0
- package/src/components/tabs/tabs.component.tsx +10 -4
- package/src/index.ts +3 -4
- package/src/interfaces/Operation.ts +1 -0
- package/src/stores/action/action.actions.spec.ts +1 -0
- package/src/stores/action/action.actions.ts +1 -0
- package/src/stores/action/action.reducers.ts +1 -1
- package/src/stores/action-info/action-info.actions.spec.ts +1 -0
- package/src/stores/action-info/action-info.actions.ts +2 -1
- package/src/stores/action-info/action-info.reducers.ts +2 -1
- package/src/stores/action-info/action-info.selectors.ts +2 -1
- package/src/stores/actions/actions.actions.spec.ts +1 -0
- package/src/stores/actions/actions.actions.ts +1 -0
- package/src/stores/actions/actions.reducers.ts +1 -0
- package/src/stores/actions/index.ts +1 -1
- package/src/stores/auth/auth.actions.ts +1 -0
- package/src/stores/auth/auth.reducers.ts +1 -0
- package/src/stores/auth/auth.selectors.ts +1 -0
- package/src/stores/auth/auth.utils.tsx +2 -1
- package/src/stores/auth/getAccess.action.spec.ts +1 -0
- package/src/stores/auth/getAccess.action.ts +1 -0
- package/src/stores/auth/getProjectAccess.action.ts +1 -0
- package/src/stores/auth/index.ts +4 -4
- package/src/stores/auth/initAuth.action.spec.ts +1 -0
- package/src/stores/auth/initAuth.action.ts +1 -0
- package/src/stores/auth/logout.action.spec.ts +2 -1
- package/src/stores/auth/logout.action.ts +1 -0
- package/src/stores/auth/setUser.action.spec.ts +1 -0
- package/src/stores/auth/setUser.action.ts +1 -0
- package/src/stores/form/form.actions.spec.ts +1 -0
- package/src/stores/form/form.actions.ts +1 -0
- package/src/stores/form/form.reducers.ts +1 -0
- package/src/stores/forms/forms.actions.spec.ts +1 -0
- package/src/stores/forms/forms.actions.ts +1 -0
- package/src/stores/forms/forms.reducers.ts +1 -0
- package/src/stores/index.ts +3 -2
- package/src/stores/root/root.selectors.ts +1 -1
- package/src/stores/submission/submission.actions.spec.ts +1 -0
- package/src/stores/submission/submission.actions.ts +1 -0
- package/src/stores/submission/submission.reducers.ts +1 -0
- package/src/stores/submissions/submissions.actions.spec.ts +1 -0
- package/src/stores/submissions/submissions.actions.ts +1 -0
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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=
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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,7 +1,8 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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,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
|
|
8
|
+
<div
|
|
9
|
+
title={"button-wrapper"}
|
|
10
|
+
className={classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)}
|
|
11
|
+
>
|
|
8
12
|
<button
|
|
9
|
-
title={
|
|
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={
|
|
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"}>
|
|
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";
|
|
@@ -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
|
-
import {
|
|
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> =>
|
|
6
|
+
export const selectActionInfo = (state: Record<string, any>): Partial<ActionSchema> =>
|
|
7
|
+
selectRoot<ActionInfoState>(ACTION_INFO, state).data!;
|
|
@@ -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,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
|
|
33
|
+
return roles.includes("owner") && get(form, "owner") === get(auth, "user._id");
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
return true;
|
package/src/stores/auth/index.ts
CHANGED
|
@@ -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 "./
|
|
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,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(
|
|
8
|
+
jest.mock("formiojs");
|
|
8
9
|
|
|
9
10
|
describe("logout()", () => {
|
|
10
11
|
beforeEach(() => {
|
|
@@ -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";
|
package/src/stores/index.ts
CHANGED
|
@@ -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,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";
|