@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,10 +1,11 @@
|
|
|
1
|
-
import {ExtendedComponentSchema} from "formiojs";
|
|
1
|
+
import { ExtendedComponentSchema } from "formiojs";
|
|
2
2
|
import cloneDeep from "lodash/cloneDeep";
|
|
3
3
|
import isEqual from "lodash/isEqual";
|
|
4
4
|
import noop from "lodash/noop";
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
|
|
6
|
+
import { FormSchema, Submission } from "../../interfaces";
|
|
7
|
+
import { RoleSchema } from "../../interfaces/RoleSchema";
|
|
8
|
+
import { getAccessPermissionForm, getSubmissionPermissionForm } from "./formAccess.schema";
|
|
8
9
|
|
|
9
10
|
export interface Choice {
|
|
10
11
|
label: string;
|
|
@@ -69,8 +70,8 @@ function hashToAccess(data: AccessRoles) {
|
|
|
69
70
|
|
|
70
71
|
export function getFormAccess(roles: RoleSchema[]): FormAccessSchema {
|
|
71
72
|
const choices = rolesToChoices(roles);
|
|
72
|
-
const access = getAccessPermissionForm({choices});
|
|
73
|
-
const submissionAccess = getSubmissionPermissionForm({choices});
|
|
73
|
+
const access = getAccessPermissionForm({ choices });
|
|
74
|
+
const submissionAccess = getSubmissionPermissionForm({ choices });
|
|
74
75
|
|
|
75
76
|
return {
|
|
76
77
|
access,
|
|
@@ -79,7 +80,7 @@ export function getFormAccess(roles: RoleSchema[]): FormAccessSchema {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
export function dataAccessToSubmissions(form: Partial<FormSchema>, formAccess: FormAccessSchema): SubmissionAccess {
|
|
82
|
-
const getKeys = (components: ExtendedComponentSchema[]) => components.map(({key}) => key);
|
|
83
|
+
const getKeys = (components: ExtendedComponentSchema[]) => components.map(({ key }) => key);
|
|
83
84
|
|
|
84
85
|
return {
|
|
85
86
|
access: {
|
|
@@ -107,7 +108,7 @@ export function updateSubmissions(type: string, submission: Submission<AccessRol
|
|
|
107
108
|
if (shouldUpdate(type, submission, submissions)) {
|
|
108
109
|
submissions = {
|
|
109
110
|
...submissions,
|
|
110
|
-
[type]: {data: submission.data}
|
|
111
|
+
[type]: { data: submission.data }
|
|
111
112
|
};
|
|
112
113
|
cb(submissions);
|
|
113
114
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import FormioUtils from "formiojs/utils";
|
|
2
|
-
import React, { PropsWithChildren, ReactElement
|
|
2
|
+
import React, { PropsWithChildren, ReactElement } from "react";
|
|
3
|
+
|
|
3
4
|
import { ActionDefaultsSchema, ActionSchema, FormOptions, Submission } from "../../interfaces";
|
|
4
5
|
import { Form } from "../form/form.component";
|
|
5
6
|
|
|
@@ -38,12 +39,12 @@ export interface FormActionProps {
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export function FormAction({ actionInfo, children, onSubmit, options, ...props }: PropsWithChildren<FormActionProps>): ReactElement {
|
|
41
|
-
const { form, submission } =
|
|
42
|
+
const { form, submission } = (() => {
|
|
42
43
|
const submission = mapData(props.submission || {}, actionInfo.defaults!);
|
|
43
44
|
const form = mapSettingsForm(actionInfo.settingsForm);
|
|
44
45
|
|
|
45
46
|
return { form, submission: { data: submission } };
|
|
46
|
-
}
|
|
47
|
+
})();
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
50
|
<div>
|