@digigov/form 2.0.9 → 2.0.11
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/CHANGELOG.md +19 -2
- package/FieldArray/BaseFieldArray.d.ts +3 -2
- package/FieldArray/BaseFieldArray.js +26 -4
- package/FieldArray/DeleteConfirmationModal.d.ts +8 -0
- package/FieldArray/DeleteConfirmationModal.js +29 -0
- package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js +3 -1
- package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +2 -1
- package/FieldArray/FormDialog/ArrayDisplay/index.js +39 -6
- package/FieldArray/FormDialog/index.d.ts +1 -0
- package/FieldArray/FormDialog/index.js +4 -3
- package/FieldArray/index.js +2 -0
- package/index.js +1 -1
- package/lazy.d.ts +4 -34
- package/lazy.js +3 -0
- package/package.json +4 -4
- package/registry.d.ts +3 -2
- package/registry.js +6 -4
- package/src/FieldArray/BaseFieldArray.tsx +34 -3
- package/src/FieldArray/DeleteConfirmationModal.tsx +57 -0
- package/src/FieldArray/FieldArray.stories.js +1 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +1 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +3 -1
- package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/WithDeleteConfirmation.tsx +94 -0
- package/src/FieldArray/FormDialog/ArrayDisplay/index.test.tsx +30 -26
- package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +70 -36
- package/src/FieldArray/FormDialog/index.tsx +5 -1
- package/src/FieldArray/__stories__/WithDeleteConfirmation.tsx +190 -0
- package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +210 -219
- package/src/FieldArray/index.spec.tsx +42 -0
- package/src/FieldArray/index.test.tsx +27 -23
- package/src/FieldArray/index.tsx +2 -1
- package/src/lazy.ts +1 -0
- package/src/registry.ts +6 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ArrayDisplay } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/';
|
|
3
|
+
|
|
4
|
+
const mockOfField = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
label: { primary: 'Item' },
|
|
7
|
+
extra: {
|
|
8
|
+
fields: [
|
|
9
|
+
{ key: 'afm', label: { primary: 'ΑΦΜ' } },
|
|
10
|
+
{ key: 'firstName', label: { primary: 'Όνομα' } },
|
|
11
|
+
{ key: 'lastName', label: { primary: 'Επώνυμο' } },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const mockCustomField = {
|
|
17
|
+
editable: true,
|
|
18
|
+
extra: {
|
|
19
|
+
deleteConfirmation: true,
|
|
20
|
+
noHeader: false,
|
|
21
|
+
noEdit: false,
|
|
22
|
+
noDelete: false,
|
|
23
|
+
border: true,
|
|
24
|
+
verticalAlign: 'top',
|
|
25
|
+
wordBreak: 'break-all',
|
|
26
|
+
stackProps: {
|
|
27
|
+
spacing: 4,
|
|
28
|
+
alignItems: 'flex-end',
|
|
29
|
+
justifyContent: 'flex-end',
|
|
30
|
+
direction: 'column',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const initialValues = [
|
|
36
|
+
{
|
|
37
|
+
afm: '123456789',
|
|
38
|
+
firstName: 'Γιάννης',
|
|
39
|
+
lastName: 'Παπαδόπουλος',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
afm: '987654321',
|
|
43
|
+
firstName: 'Μαρία',
|
|
44
|
+
lastName: 'Κωνσταντίνου',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
afm: '456789123',
|
|
48
|
+
firstName: 'Δημήτρης',
|
|
49
|
+
lastName: 'Αθανασίου',
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export const WithDeleteConfirmation = () => {
|
|
54
|
+
const [fieldArrayValues, setFieldArrayValues] = useState(initialValues);
|
|
55
|
+
|
|
56
|
+
const handleEdit = (index: number) => {
|
|
57
|
+
const newFirstName = prompt(
|
|
58
|
+
'[TEST INTERFACE] Εισάγετε νέο όνομα:',
|
|
59
|
+
fieldArrayValues[index].firstName
|
|
60
|
+
);
|
|
61
|
+
if (newFirstName !== null) {
|
|
62
|
+
const newValues = [...fieldArrayValues];
|
|
63
|
+
newValues[index] = { ...newValues[index], firstName: newFirstName };
|
|
64
|
+
setFieldArrayValues(newValues);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleRemove = (index: number) => {
|
|
69
|
+
if (confirm('Είστε βέβαιοι ότι θέλετε να διαγράψετε αυτό το στοιχείο;')) {
|
|
70
|
+
const newValues = fieldArrayValues.filter((_, i) => i !== index);
|
|
71
|
+
setFieldArrayValues(newValues);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleMove = (fromIndex: number, toIndex: number) => {
|
|
76
|
+
const newValues = [...fieldArrayValues];
|
|
77
|
+
const [movedItem] = newValues.splice(fromIndex, 1);
|
|
78
|
+
newValues.splice(toIndex, 0, movedItem);
|
|
79
|
+
setFieldArrayValues(newValues);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<ArrayDisplay
|
|
84
|
+
fieldArrayName="signatories"
|
|
85
|
+
fieldArrayValues={fieldArrayValues}
|
|
86
|
+
ofField={mockOfField}
|
|
87
|
+
customField={mockCustomField}
|
|
88
|
+
onEdit={handleEdit}
|
|
89
|
+
onRemove={handleRemove}
|
|
90
|
+
move={handleMove}
|
|
91
|
+
sortable={false}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -1,44 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { test, expect } from '@playwright/experimental-ct-react';
|
|
3
|
-
import TestVariant from '@digigov/ui/utils/TestVariant'
|
|
3
|
+
import TestVariant from '@digigov/ui/utils/TestVariant';
|
|
4
4
|
import { Cards } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards';
|
|
5
5
|
import { Default } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/Default';
|
|
6
6
|
import { ReadOnly } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly';
|
|
7
7
|
import { ReadOnlyCards } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards';
|
|
8
8
|
import { Sortable } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable';
|
|
9
9
|
import { SortableCards } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards';
|
|
10
|
+
import { WithDeleteConfirmation } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/__stories__/WithDeleteConfirmation';
|
|
10
11
|
|
|
11
12
|
test('renders the All ArrayDisplay variants', async ({ mount, page }) => {
|
|
12
13
|
await mount(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
<div>
|
|
15
|
+
<TestVariant title="Cards">
|
|
16
|
+
<Cards />
|
|
17
|
+
</TestVariant>
|
|
18
|
+
<TestVariant title="Default">
|
|
19
|
+
<Default />
|
|
20
|
+
</TestVariant>
|
|
21
|
+
<TestVariant title="ReadOnly">
|
|
22
|
+
<ReadOnly />
|
|
23
|
+
</TestVariant>
|
|
24
|
+
<TestVariant title="ReadOnlyCards">
|
|
25
|
+
<ReadOnlyCards />
|
|
26
|
+
</TestVariant>
|
|
27
|
+
<TestVariant title="Sortable">
|
|
28
|
+
<Sortable />
|
|
29
|
+
</TestVariant>
|
|
30
|
+
<TestVariant title="SortableCards">
|
|
31
|
+
<SortableCards />
|
|
32
|
+
</TestVariant>
|
|
33
|
+
<TestVariant title="WithDeleteConfirmation">
|
|
34
|
+
<WithDeleteConfirmation />
|
|
35
|
+
</TestVariant>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
35
38
|
await page.evaluate(() => document.fonts.ready);
|
|
36
39
|
|
|
37
40
|
// Move the mouse to the top-left corner to avoid random hover issues
|
|
38
41
|
await page.mouse.move(0, 0);
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const screenshot = await page.screenshot({
|
|
44
|
+
fullPage: true,
|
|
45
|
+
animations: 'disabled',
|
|
46
|
+
});
|
|
42
47
|
expect(screenshot).toMatchSnapshot();
|
|
43
48
|
});
|
|
44
|
-
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useId } from 'react';
|
|
2
2
|
import type { UseFieldArrayMove } from 'react-hook-form';
|
|
3
|
+
import DeleteConfirmationModal from '@digigov/form/FieldArray/DeleteConfirmationModal';
|
|
3
4
|
import { ArrayContainerDisplay } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay';
|
|
4
5
|
import { ArrayItemDisplay } from '@digigov/form/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay';
|
|
6
|
+
import { omit } from '@digigov/form/utils';
|
|
7
|
+
import { useModal } from '@digigov/ui';
|
|
5
8
|
export interface ArrayDisplayProps {
|
|
6
9
|
fieldArrayName: string;
|
|
7
10
|
fieldArrayValues: any[];
|
|
@@ -11,6 +14,7 @@ export interface ArrayDisplayProps {
|
|
|
11
14
|
onRemove: (index: number) => void;
|
|
12
15
|
move: UseFieldArrayMove;
|
|
13
16
|
sortable: boolean;
|
|
17
|
+
deleteConfirmation?: boolean;
|
|
14
18
|
error?: any;
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -23,44 +27,74 @@ export const ArrayDisplay = ({
|
|
|
23
27
|
onRemove,
|
|
24
28
|
move,
|
|
25
29
|
sortable,
|
|
30
|
+
deleteConfirmation,
|
|
26
31
|
error,
|
|
27
32
|
}: ArrayDisplayProps) => {
|
|
33
|
+
const confirmationModalId = useId();
|
|
34
|
+
const [removeCurrentModal, setRemoveCurrentModal] = useState<number>(-1);
|
|
35
|
+
const { registerModal, open, ...modalProps } = useModal();
|
|
36
|
+
|
|
37
|
+
const handleRemoveClick = React.useCallback(
|
|
38
|
+
(index: number) => {
|
|
39
|
+
const needsConfirmation =
|
|
40
|
+
deleteConfirmation || customField.extra?.deleteConfirmation;
|
|
41
|
+
if (needsConfirmation) {
|
|
42
|
+
setRemoveCurrentModal(index);
|
|
43
|
+
open(confirmationModalId);
|
|
44
|
+
} else {
|
|
45
|
+
onRemove(index);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[deleteConfirmation, customField.extra, open, onRemove, confirmationModalId]
|
|
49
|
+
);
|
|
28
50
|
return (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
<>
|
|
52
|
+
<ArrayContainerDisplay
|
|
53
|
+
fieldArrayValues={fieldArrayValues}
|
|
54
|
+
ofField={ofField}
|
|
55
|
+
customField={customField}
|
|
56
|
+
>
|
|
57
|
+
{fieldArrayValues?.map?.((field, index) => {
|
|
58
|
+
return (
|
|
59
|
+
<ArrayItemDisplay
|
|
60
|
+
error={error && error[index] ? error[index] : undefined}
|
|
61
|
+
key={index}
|
|
62
|
+
name={`${fieldArrayName}.${index}`}
|
|
63
|
+
index={index}
|
|
64
|
+
isFirst={index === 0}
|
|
65
|
+
isLast={index === fieldArrayValues.length - 1}
|
|
66
|
+
data={field}
|
|
67
|
+
edit={() => onEdit(index)}
|
|
68
|
+
stackProps={customField?.extra?.stackProps}
|
|
69
|
+
wordBreak={customField?.extra?.wordBreak}
|
|
70
|
+
valueDisplay={customField?.extra?.valueDisplay}
|
|
71
|
+
remove={() => handleRemoveClick(index)}
|
|
72
|
+
border={customField.extra?.border}
|
|
73
|
+
move={move}
|
|
74
|
+
sortable={sortable}
|
|
75
|
+
disabledEdit={
|
|
76
|
+
sortable ? true : (customField.extra?.noEdit ?? false)
|
|
77
|
+
}
|
|
78
|
+
disabledDelete={customField.extra?.noDelete ?? false}
|
|
79
|
+
disabled={customField?.editable === false}
|
|
80
|
+
fieldArrayValues={fieldArrayValues}
|
|
81
|
+
ofField={ofField}
|
|
82
|
+
customField={customField}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
})}
|
|
86
|
+
</ArrayContainerDisplay>
|
|
87
|
+
<DeleteConfirmationModal
|
|
88
|
+
{...omit(modalProps, ['registerAction', 'currentOpen'])}
|
|
89
|
+
{...registerModal(confirmationModalId)}
|
|
90
|
+
remove={() => {
|
|
91
|
+
if (removeCurrentModal !== -1) {
|
|
92
|
+
onRemove(removeCurrentModal);
|
|
93
|
+
setRemoveCurrentModal(-1);
|
|
94
|
+
}
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
</>
|
|
64
98
|
);
|
|
65
99
|
};
|
|
66
100
|
|
|
@@ -28,6 +28,7 @@ export interface FormDialogProps extends FieldProps {
|
|
|
28
28
|
resetField?: UseFormReturn['resetField'];
|
|
29
29
|
sortable: boolean;
|
|
30
30
|
Field: React.FC<FieldProps>;
|
|
31
|
+
deleteConfirmation?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export const FormDialog = React.forwardRef<HTMLButtonElement, FormDialogProps>(
|
|
@@ -39,6 +40,7 @@ export const FormDialog = React.forwardRef<HTMLButtonElement, FormDialogProps>(
|
|
|
39
40
|
getValues,
|
|
40
41
|
Field,
|
|
41
42
|
sortable,
|
|
43
|
+
deleteConfirmation = false,
|
|
42
44
|
...customField
|
|
43
45
|
},
|
|
44
46
|
ref
|
|
@@ -264,6 +266,7 @@ export const FormDialog = React.forwardRef<HTMLButtonElement, FormDialogProps>(
|
|
|
264
266
|
move={handleMove}
|
|
265
267
|
sortable={sortable}
|
|
266
268
|
error={error}
|
|
269
|
+
deleteConfirmation={deleteConfirmation}
|
|
267
270
|
/>
|
|
268
271
|
)}
|
|
269
272
|
{customField.extra?.editVariant !== 'display' && // add noAdd: necessary for dilosi's 'fixed' fieldsets
|
|
@@ -286,7 +289,8 @@ export const FormDialog = React.forwardRef<HTMLButtonElement, FormDialogProps>(
|
|
|
286
289
|
disabled={
|
|
287
290
|
customField?.editable === false ||
|
|
288
291
|
customField.extra?.editVariant === 'noinput' ||
|
|
289
|
-
|
|
292
|
+
fieldArrayValues?.length >=
|
|
293
|
+
(customField.extra?.max ?? Number.MAX_VALUE)
|
|
290
294
|
}
|
|
291
295
|
>
|
|
292
296
|
{customField.extra?.label.object?.add}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FormBuilder, { Field, FieldSpec } from '@digigov/form';
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
|
+
|
|
5
|
+
const fields = [
|
|
6
|
+
{
|
|
7
|
+
key: 'string',
|
|
8
|
+
type: 'string',
|
|
9
|
+
label: {
|
|
10
|
+
primary: 'Πεδίο κειμένου',
|
|
11
|
+
secondary:
|
|
12
|
+
'Το multiplicity field είναι ένα πεδίο οπότε φαίνεται και είναι μέρος της φόρμας',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'multiplicity',
|
|
17
|
+
editable: true,
|
|
18
|
+
required: true,
|
|
19
|
+
type: 'array',
|
|
20
|
+
label: {
|
|
21
|
+
primary: 'Συνυπογράφοντες',
|
|
22
|
+
secondary: 'Οι συνυπογράφοντες είναι άνθρωποι σαν και εμάς',
|
|
23
|
+
},
|
|
24
|
+
extra: {
|
|
25
|
+
noIndex: true,
|
|
26
|
+
border: false,
|
|
27
|
+
deleteConfirmation: true,
|
|
28
|
+
variant: 'dialog',
|
|
29
|
+
noHeader: false,
|
|
30
|
+
label: {
|
|
31
|
+
object: {
|
|
32
|
+
title: 'Συνυπογράφοντας',
|
|
33
|
+
title_added: 'Οι συνυπογράφοντες που έχετε προσθέσει',
|
|
34
|
+
add: 'Προσθήκη',
|
|
35
|
+
delete: 'Αφαίρεση συνυπογράφοντος',
|
|
36
|
+
append: {
|
|
37
|
+
label: 'Αποθήκευση',
|
|
38
|
+
props: {
|
|
39
|
+
color: 'primary',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
edit: {
|
|
43
|
+
label: 'Αποθήκευση',
|
|
44
|
+
props: {
|
|
45
|
+
color: 'primary',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
cancel: {
|
|
49
|
+
label: 'Ακύρωση',
|
|
50
|
+
props: {
|
|
51
|
+
variant: 'link',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
question: {
|
|
56
|
+
title: 'Θέλετε να προσθέσετε επιπλέον συνυπογράφοντες;',
|
|
57
|
+
objectLabel: {
|
|
58
|
+
primary: 'Προσθήκη νέου συνυπογράφοντα',
|
|
59
|
+
secondary: 'Συμπληρώστε τα στοιχεία και μετά πατήστε «Προσθήκη»',
|
|
60
|
+
},
|
|
61
|
+
yes: 'Ναι',
|
|
62
|
+
no: 'Όχι',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
min: 2,
|
|
66
|
+
// max: 4,
|
|
67
|
+
of: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
extra: {
|
|
70
|
+
fields: [
|
|
71
|
+
{
|
|
72
|
+
key: 'lastName',
|
|
73
|
+
required: true,
|
|
74
|
+
type: 'string',
|
|
75
|
+
label: {
|
|
76
|
+
primary: 'Όνομα',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'gender',
|
|
81
|
+
required: true,
|
|
82
|
+
type: 'choice:single',
|
|
83
|
+
label: {
|
|
84
|
+
primary: 'Φύλο',
|
|
85
|
+
},
|
|
86
|
+
extra: {
|
|
87
|
+
options: [
|
|
88
|
+
{
|
|
89
|
+
label: {
|
|
90
|
+
primary: 'Άνδρας',
|
|
91
|
+
secondary: 'Choice 1 explanation',
|
|
92
|
+
},
|
|
93
|
+
value: 'male',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: {
|
|
97
|
+
primary: 'Γυναίκα',
|
|
98
|
+
secondary: 'Choice 2 explanation',
|
|
99
|
+
},
|
|
100
|
+
value: 'female',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: {
|
|
104
|
+
primary: 'Άλλο',
|
|
105
|
+
secondary: 'Choice 3 explanation',
|
|
106
|
+
},
|
|
107
|
+
value: 'other',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: 'arrayofafm',
|
|
119
|
+
editable: true,
|
|
120
|
+
type: 'array',
|
|
121
|
+
label: {
|
|
122
|
+
primary: 'Συνυπογράφοντες',
|
|
123
|
+
secondary: 'Οι συνυπογράφοντες είναι άνθρωποι σαν και εμάς',
|
|
124
|
+
},
|
|
125
|
+
extra: {
|
|
126
|
+
variant: 'dialog',
|
|
127
|
+
deleteConfirmation: true,
|
|
128
|
+
noHeader: false,
|
|
129
|
+
label: {
|
|
130
|
+
object: {
|
|
131
|
+
title: 'Συνυπογράφοντας',
|
|
132
|
+
title_added: 'Οι συνυπογράφοντες που έχετε προσθέσει',
|
|
133
|
+
add: 'Προσθήκη',
|
|
134
|
+
delete: 'Αφαίρεση συνυπογράφοντος',
|
|
135
|
+
append: {
|
|
136
|
+
label: 'Αποθήκευση',
|
|
137
|
+
props: {
|
|
138
|
+
color: 'primary',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
edit: {
|
|
142
|
+
label: 'Αποθήκευση',
|
|
143
|
+
props: {
|
|
144
|
+
color: 'primary',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
cancel: {
|
|
148
|
+
label: 'Ακύρωση',
|
|
149
|
+
props: {
|
|
150
|
+
variant: 'link',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
question: {
|
|
155
|
+
title: 'Θέλετε να προσθέσετε επιπλέον συνυπογράφοντες;',
|
|
156
|
+
objectLabel: {
|
|
157
|
+
primary: 'Προσθήκη νέου συνυπογράφοντα',
|
|
158
|
+
secondary: 'Συμπληρώστε τα στοιχεία και μετά πατήστε «Προσθήκη»',
|
|
159
|
+
},
|
|
160
|
+
yes: 'Ναι',
|
|
161
|
+
no: 'Όχι',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
// min: 2,
|
|
165
|
+
// max: 4,
|
|
166
|
+
of: {
|
|
167
|
+
required: true,
|
|
168
|
+
type: 'afm',
|
|
169
|
+
label: {
|
|
170
|
+
primary: 'ΑΦΜ',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
] as FieldSpec[];
|
|
176
|
+
|
|
177
|
+
export const WithDeleteConfirmation = (_: any) => (
|
|
178
|
+
<FormBuilder
|
|
179
|
+
onSubmit={(data) => {
|
|
180
|
+
console.log(data);
|
|
181
|
+
window.alert('Submit success');
|
|
182
|
+
}}
|
|
183
|
+
initial={{
|
|
184
|
+
multiplicity: [['Παπαδόπουλος', 'other']],
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
<Field name="multiplicity" {...fields[1]} />
|
|
188
|
+
<Button>Συνέχεια</Button>
|
|
189
|
+
</FormBuilder>
|
|
190
|
+
);
|