@digigov/form 0.12.6 → 0.13.0
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 +15 -4
- package/Field/FieldBase.js +2 -2
- package/Field/FieldBaseContainer.js +7 -7
- package/Field/FieldConditional.js +10 -5
- package/Field/types.d.ts +2 -1
- package/Field/utils.js +14 -10
- package/FieldArray/index.js +3 -3
- package/FieldObject/index.d.ts +1 -1
- package/FieldObject/index.js +4 -4
- package/Fieldset/FieldsetWithContext.js +4 -4
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js +2 -2
- package/FormBuilder/FormBuilder.js +5 -5
- package/FormContext.d.ts +1 -1
- package/MultiplicityField/__stories__/PreviewDisplay.js +3 -3
- package/MultiplicityField/add-objects.js +6 -6
- package/MultiplicityField/index.d.ts +2 -2
- package/MultiplicityField/index.js +5 -5
- package/Questions/Questions.js +2 -2
- package/Questions/Step/ReviewStep.js +7 -7
- package/Questions/Step/Step.js +2 -2
- package/Questions/Step/StepArrayReview.js +10 -10
- package/Questions/Step/StepDescription.js +2 -2
- package/Questions/Step/StepForm.d.ts +1 -1
- package/Questions/Step/StepForm.js +5 -5
- package/Questions/Step/StepTitle.js +2 -2
- package/Questions/Step/getAddMoreFields.d.ts +1 -1
- package/Questions/__stories__/Default.js +6 -6
- package/Questions/index.spec.js +2 -2
- package/es/Field/FieldBase.js +1 -1
- package/es/Field/FieldBaseContainer.js +4 -4
- package/es/Field/FieldConditional.js +6 -2
- package/es/Field/utils.js +13 -9
- package/es/FieldArray/index.js +2 -2
- package/es/FieldObject/index.js +2 -2
- package/es/Fieldset/FieldsetWithContext.js +2 -2
- package/es/Fieldset/index.js +1 -1
- package/es/FormBuilder/FormBuilder.js +3 -3
- package/es/FormContext.js +1 -1
- package/es/MultiplicityField/__stories__/PreviewDisplay.js +2 -2
- package/es/MultiplicityField/add-objects.js +5 -5
- package/es/MultiplicityField/index.js +3 -3
- package/es/Questions/Questions.js +1 -1
- package/es/Questions/Step/ReviewStep.js +4 -4
- package/es/Questions/Step/Step.js +1 -1
- package/es/Questions/Step/StepArrayReview.js +6 -6
- package/es/Questions/Step/StepDescription.js +1 -1
- package/es/Questions/Step/StepForm.js +4 -4
- package/es/Questions/Step/StepTitle.js +1 -1
- package/es/Questions/__stories__/Default.js +4 -4
- package/es/Questions/index.spec.js +2 -1
- package/es/inputs/AutoComplete/__stories__/Default.js +2 -2
- package/es/inputs/AutoComplete/index.js +1 -1
- package/es/inputs/Checkboxes/Checkboxes.stories.js +3 -1
- package/es/inputs/Checkboxes/Checkboxes.stories.playwright.json +16 -0
- package/es/inputs/Checkboxes/__stories__/Conditional.js +95 -0
- package/es/inputs/Checkboxes/__stories__/WithDivider.js +43 -0
- package/es/inputs/Checkboxes/index.js +45 -13
- package/es/inputs/DateInput/index.js +1 -1
- package/es/inputs/FileInput/index.js +4 -4
- package/es/inputs/Input/Input.stories.js +2 -1
- package/es/inputs/Input/__stories__/TextWithCharacterLimit.js +31 -0
- package/es/inputs/Input/index.js +23 -5
- package/es/inputs/Label/index.js +1 -1
- package/es/inputs/Radio/Radio.stories.js +3 -1
- package/es/inputs/Radio/Radio.stories.playwright.json +16 -0
- package/es/inputs/Radio/__stories__/Conditional.js +95 -0
- package/es/inputs/Radio/__stories__/WithDivider.js +48 -0
- package/es/inputs/Radio/index.js +17 -6
- package/es/registry.js +3 -0
- package/es/utils.js +1 -1
- package/es/validators/index.js +10 -2
- package/es/validators/utils/index.js +16 -2
- package/es/validators/utils/text_limit.js +54 -0
- package/esm/Field/FieldBase.js +1 -1
- package/esm/Field/FieldBaseContainer.js +4 -4
- package/esm/Field/FieldConditional.js +6 -2
- package/esm/Field/utils.js +13 -9
- package/esm/FieldArray/index.js +2 -2
- package/esm/FieldObject/index.js +2 -2
- package/esm/Fieldset/FieldsetWithContext.js +2 -2
- package/esm/Fieldset/index.js +1 -1
- package/esm/FormBuilder/FormBuilder.js +3 -3
- package/esm/FormContext.js +1 -1
- package/esm/MultiplicityField/__stories__/PreviewDisplay.js +2 -2
- package/esm/MultiplicityField/add-objects.js +5 -5
- package/esm/MultiplicityField/index.js +3 -3
- package/esm/Questions/Questions.js +1 -1
- package/esm/Questions/Step/ReviewStep.js +4 -4
- package/esm/Questions/Step/Step.js +1 -1
- package/esm/Questions/Step/StepArrayReview.js +6 -6
- package/esm/Questions/Step/StepDescription.js +1 -1
- package/esm/Questions/Step/StepForm.js +4 -4
- package/esm/Questions/Step/StepTitle.js +1 -1
- package/esm/Questions/__stories__/Default.js +4 -4
- package/esm/Questions/index.spec.js +2 -1
- package/esm/index.js +1 -1
- package/esm/inputs/AutoComplete/__stories__/Default.js +2 -2
- package/esm/inputs/AutoComplete/index.js +1 -1
- package/esm/inputs/Checkboxes/Checkboxes.stories.js +3 -1
- package/esm/inputs/Checkboxes/Checkboxes.stories.playwright.json +16 -0
- package/esm/inputs/Checkboxes/__stories__/Conditional.js +95 -0
- package/esm/inputs/Checkboxes/__stories__/WithDivider.js +43 -0
- package/esm/inputs/Checkboxes/index.js +45 -13
- package/esm/inputs/DateInput/index.js +1 -1
- package/esm/inputs/FileInput/index.js +4 -4
- package/esm/inputs/Input/Input.stories.js +2 -1
- package/esm/inputs/Input/__stories__/TextWithCharacterLimit.js +31 -0
- package/esm/inputs/Input/index.js +23 -5
- package/esm/inputs/Label/index.js +1 -1
- package/esm/inputs/Radio/Radio.stories.js +3 -1
- package/esm/inputs/Radio/Radio.stories.playwright.json +16 -0
- package/esm/inputs/Radio/__stories__/Conditional.js +95 -0
- package/esm/inputs/Radio/__stories__/WithDivider.js +48 -0
- package/esm/inputs/Radio/index.js +17 -6
- package/esm/registry.js +3 -0
- package/esm/utils.js +1 -1
- package/esm/validators/index.js +10 -2
- package/esm/validators/utils/index.js +16 -2
- package/esm/validators/utils/text_limit.js +54 -0
- package/inputs/AutoComplete/__stories__/Default.js +3 -3
- package/inputs/AutoComplete/index.d.ts +2 -2
- package/inputs/AutoComplete/index.js +2 -2
- package/inputs/Checkboxes/Checkboxes.stories.d.ts +2 -0
- package/inputs/Checkboxes/Checkboxes.stories.js +28 -0
- package/inputs/Checkboxes/Checkboxes.stories.playwright.json +16 -0
- package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -0
- package/inputs/Checkboxes/__stories__/Conditional.js +115 -0
- package/inputs/Checkboxes/__stories__/WithDivider.d.ts +2 -0
- package/inputs/Checkboxes/__stories__/WithDivider.js +63 -0
- package/inputs/Checkboxes/index.d.ts +1 -1
- package/inputs/Checkboxes/index.js +53 -13
- package/inputs/DateInput/index.js +2 -2
- package/inputs/FileInput/index.js +5 -5
- package/inputs/Input/Input.stories.d.ts +1 -0
- package/inputs/Input/Input.stories.js +14 -0
- package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +2 -0
- package/inputs/Input/__stories__/TextWithCharacterLimit.js +51 -0
- package/inputs/Input/index.d.ts +4 -0
- package/inputs/Input/index.js +26 -5
- package/inputs/Label/index.d.ts +2 -0
- package/inputs/Label/index.js +2 -2
- package/inputs/Radio/Radio.stories.d.ts +2 -0
- package/inputs/Radio/Radio.stories.js +28 -0
- package/inputs/Radio/Radio.stories.playwright.json +16 -0
- package/inputs/Radio/__stories__/Conditional.d.ts +1 -0
- package/inputs/Radio/__stories__/Conditional.js +115 -0
- package/inputs/Radio/__stories__/WithDivider.d.ts +2 -0
- package/inputs/Radio/__stories__/WithDivider.js +68 -0
- package/inputs/Radio/index.d.ts +1 -1
- package/inputs/Radio/index.js +20 -8
- package/inputs/Select/index.d.ts +1 -1
- package/package.json +3 -3
- package/registry.d.ts +1 -0
- package/registry.js +4 -0
- package/src/Field/FieldBase.tsx +1 -1
- package/src/Field/FieldBaseContainer.tsx +5 -5
- package/src/Field/FieldConditional.tsx +9 -3
- package/src/Field/index.tsx +1 -1
- package/src/Field/types.tsx +2 -1
- package/src/Field/utils.ts +17 -11
- package/src/FieldArray/index.tsx +3 -3
- package/src/FieldObject/index.tsx +5 -5
- package/src/Fieldset/FieldsetWithContext.tsx +3 -3
- package/src/Fieldset/index.tsx +5 -5
- package/src/FormBuilder/FormBuilder.tsx +4 -4
- package/src/FormContext.tsx +2 -1
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +6 -6
- package/src/MultiplicityField/add-objects.tsx +4 -4
- package/src/MultiplicityField/index.tsx +5 -5
- package/src/Questions/Questions.tsx +2 -2
- package/src/Questions/Step/ReviewStep.tsx +5 -5
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +8 -8
- package/src/Questions/Step/StepDescription.tsx +1 -1
- package/src/Questions/Step/StepForm.tsx +5 -5
- package/src/Questions/Step/StepTitle.tsx +1 -1
- package/src/Questions/Step/getAddMoreFields.tsx +1 -1
- package/src/Questions/__stories__/Default.tsx +4 -4
- package/src/Questions/index.spec.tsx +2 -1
- package/src/inputs/AutoComplete/__stories__/Default.tsx +2 -2
- package/src/inputs/AutoComplete/index.tsx +3 -3
- package/src/inputs/Checkboxes/Checkboxes.stories.js +2 -0
- package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +16 -0
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +100 -0
- package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +39 -0
- package/src/inputs/Checkboxes/index.tsx +61 -31
- package/src/inputs/DateInput/index.tsx +2 -2
- package/src/inputs/FileInput/index.tsx +4 -4
- package/src/inputs/Input/Input.stories.js +2 -1
- package/src/inputs/Input/__stories__/TextWithCharacterLimit.tsx +24 -0
- package/src/inputs/Input/index.tsx +57 -16
- package/src/inputs/Label/index.tsx +4 -2
- package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
- package/src/inputs/Radio/Radio.stories.js +3 -0
- package/src/inputs/Radio/Radio.stories.playwright.json +16 -0
- package/src/inputs/Radio/__stories__/Conditional.tsx +97 -0
- package/src/inputs/Radio/__stories__/WithDivider.tsx +42 -0
- package/src/inputs/Radio/index.tsx +22 -5
- package/src/inputs/Select/index.tsx +2 -2
- package/src/registry.js +3 -0
- package/src/types.tsx +6 -4
- package/src/utils.ts +1 -1
- package/src/validators/index.ts +8 -1
- package/src/validators/utils/file.ts +1 -1
- package/src/validators/utils/index.ts +10 -1
- package/src/validators/utils/phone.ts +1 -1
- package/src/validators/utils/postal_code.ts +1 -1
- package/src/validators/utils/text_limit.ts +44 -0
- package/types.d.ts +6 -4
- package/validators/index.js +9 -1
- package/validators/utils/file.d.ts +1 -1
- package/validators/utils/index.d.ts +1 -0
- package/validators/utils/index.js +29 -2
- package/validators/utils/phone.d.ts +1 -1
- package/validators/utils/postal_code.d.ts +1 -1
- package/validators/utils/text_limit.d.ts +4 -0
- package/validators/utils/text_limit.js +65 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import Label from '@digigov/form/inputs/Label';
|
|
4
|
-
import ErrorMessage from '@digigov/react-core/ErrorMessage';
|
|
5
3
|
import FieldContainer from '@digigov/react-core/FieldContainer';
|
|
4
|
+
import LabelContainer from '@digigov/react-core/LabelContainer';
|
|
6
5
|
import CoreFieldset from '@digigov/react-core/Fieldset';
|
|
7
|
-
import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
|
|
8
6
|
import Hint from '@digigov/react-core/Hint';
|
|
9
|
-
import
|
|
7
|
+
import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
|
|
8
|
+
import ErrorMessage from '@digigov/react-core/ErrorMessage';
|
|
10
9
|
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
10
|
+
import Label from '@digigov/form/inputs/Label';
|
|
11
11
|
export var FieldBaseContainer = function FieldBaseContainer(_ref) {
|
|
12
12
|
var name = _ref.name,
|
|
13
13
|
wrapper = _ref.wrapper,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { useWatch } from 'react-hook-form';
|
|
4
|
-
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
5
5
|
import { evaluateFieldWithConditions } from '@digigov/form/Field/utils';
|
|
6
|
+
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
6
7
|
var ChildFieldMemo = /*#__PURE__*/React.memo(function ChildField(_ref) {
|
|
7
8
|
var dependencies = _ref.dependencies,
|
|
8
9
|
field = _ref.field,
|
|
@@ -42,10 +43,13 @@ export var FieldConditional = function FieldConditional(_ref2) {
|
|
|
42
43
|
reset = _ref2.reset,
|
|
43
44
|
error = _ref2.error;
|
|
44
45
|
var dependencyKeys = Object.keys(field.condition);
|
|
45
|
-
var
|
|
46
|
+
var dependencyValues = useWatch({
|
|
46
47
|
name: dependencyKeys,
|
|
47
48
|
control: control
|
|
48
49
|
});
|
|
50
|
+
var variables = dependencyKeys.reduce(function (data, fieldKey, index) {
|
|
51
|
+
return _extends({}, data, _defineProperty({}, fieldKey, dependencyValues[index]));
|
|
52
|
+
}, {});
|
|
49
53
|
return /*#__PURE__*/React.createElement(ChildFieldMemo, {
|
|
50
54
|
dependencies: variables,
|
|
51
55
|
field: field,
|
package/es/Field/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import { lazy, useContext, useMemo } from 'react';
|
|
3
|
-
import { FormContext } from '@digigov/form/FormContext';
|
|
4
|
-
import Checkboxes from '@digigov/form/inputs/Checkboxes';
|
|
5
|
-
import DateInput from '@digigov/form/inputs/DateInput';
|
|
6
|
-
import FileInput from '@digigov/form/inputs/FileInput';
|
|
7
3
|
import Input from '@digigov/form/inputs/Input';
|
|
8
|
-
import
|
|
4
|
+
import Checkboxes from '@digigov/form/inputs/Checkboxes';
|
|
9
5
|
import Radio from '@digigov/form/inputs/Radio';
|
|
10
6
|
import Select from '@digigov/form/inputs/Select';
|
|
7
|
+
import FileInput from '@digigov/form/inputs/FileInput';
|
|
8
|
+
import DateInput from '@digigov/form/inputs/DateInput';
|
|
9
|
+
import OtpInput from '@digigov/form/inputs/OtpInput';
|
|
10
|
+
import { FormContext } from '@digigov/form/FormContext';
|
|
11
11
|
var AutoComplete = /*#__PURE__*/lazy(function () {
|
|
12
12
|
return import('@digigov/form/inputs/AutoComplete');
|
|
13
13
|
});
|
|
@@ -138,11 +138,15 @@ export function evaluateFieldWithConditions(field, variables) {
|
|
|
138
138
|
|
|
139
139
|
if (variables) {
|
|
140
140
|
for (var key in variables) {
|
|
141
|
-
if (field.condition[key] && field.condition[key].is
|
|
142
|
-
var
|
|
141
|
+
if (field.condition[key] && field.condition[key].is) {
|
|
142
|
+
var is = field.condition[key].is;
|
|
143
|
+
|
|
144
|
+
if (is === variables[key] || Array.isArray(variables[key]) && variables[key].includes(is)) {
|
|
145
|
+
var then = field.condition[key].then || {};
|
|
143
146
|
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
for (var attr in then) {
|
|
148
|
+
newField[attr] = then[attr];
|
|
149
|
+
}
|
|
146
150
|
}
|
|
147
151
|
} else if (field.condition[key]) {
|
|
148
152
|
var otherwise = field.condition[key]["else"] || {};
|
package/es/FieldArray/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["name", "register", "control", "formState", "error", "layout", "label"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useFieldArray } from 'react-hook-form';
|
|
6
|
-
import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
7
6
|
import FieldObject from '@digigov/form/FieldObject';
|
|
7
|
+
import { Button, Card, Hint } from '@digigov/ui';
|
|
8
8
|
import { FieldsetLabel } from '@digigov/form/Fieldset';
|
|
9
9
|
import Fieldset from '@digigov/react-core/Fieldset';
|
|
10
|
-
import
|
|
10
|
+
import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
11
11
|
export var FieldArray = function FieldArray(_ref) {
|
|
12
12
|
var _customField$extra, _customField$extra$la, _customField$extra4, _customField$extra4$l;
|
|
13
13
|
|
package/es/FieldObject/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
+
import Fieldset, { FieldsetCaption } from '@digigov/form/Fieldset';
|
|
4
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
3
5
|
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
4
6
|
import { calculateField } from '@digigov/form/Field/utils';
|
|
5
|
-
import Fieldset, { FieldsetCaption } from '@digigov/form/Fieldset';
|
|
6
7
|
import { FieldsetLegend } from '@digigov/react-core';
|
|
7
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
8
8
|
export var FieldObject = function FieldObject(_ref) {
|
|
9
9
|
var name = _ref.name,
|
|
10
10
|
label = _ref.label,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
-
import Field from '@digigov/form/Field';
|
|
3
|
-
import { Fieldset, FieldsetLabel, FieldsetCaption, FieldsetBody } from '@digigov/form/Fieldset/';
|
|
4
2
|
import { FormContext } from '@digigov/form/FormContext';
|
|
3
|
+
import Field from '@digigov/form/Field';
|
|
5
4
|
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
5
|
+
import { Fieldset, FieldsetLabel, FieldsetCaption, FieldsetBody } from '@digigov/form/Fieldset/';
|
|
6
6
|
export var FieldsetWithContext = function FieldsetWithContext(_ref) {
|
|
7
7
|
var name = _ref.name;
|
|
8
8
|
|
package/es/Fieldset/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["children"],
|
|
4
4
|
_excluded2 = ["children"];
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import Grid from '@digigov/ui/layouts/Grid';
|
|
6
7
|
import Fieldset from '@digigov/react-core/Fieldset';
|
|
7
8
|
import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
|
|
8
9
|
import Hint from '@digigov/react-core/Hint';
|
|
9
|
-
import Grid from '@digigov/ui/layouts/Grid';
|
|
10
10
|
import NormalText from '@digigov/ui/typography/NormalText';
|
|
11
11
|
export var FieldsetLabel = function FieldsetLabel(_ref) {
|
|
12
12
|
var children = _ref.children,
|
|
@@ -7,11 +7,11 @@ var _excluded = ["onSubmit", "children", "registerField", "fieldsMap", "fieldset
|
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
8
|
import React, { useCallback, useRef } from 'react';
|
|
9
9
|
import { useForm } from 'react-hook-form';
|
|
10
|
-
import Field from '@digigov/form/Field';
|
|
11
|
-
import Fieldset from '@digigov/form/Fieldset';
|
|
12
|
-
import { FormContext } from '@digigov/form/FormContext';
|
|
13
10
|
import { yupResolver } from '@digigov/form/utils';
|
|
14
11
|
import { useValidationSchema } from '@digigov/form/validators';
|
|
12
|
+
import Fieldset from '@digigov/form/Fieldset';
|
|
13
|
+
import Field from '@digigov/form/Field';
|
|
14
|
+
import { FormContext } from '@digigov/form/FormContext';
|
|
15
15
|
import { Form } from '@digigov/react-core/Form';
|
|
16
16
|
export var FormBase = /*#__PURE__*/React.forwardRef(function FormBase(_ref, ref) {
|
|
17
17
|
var onSubmit = _ref.onSubmit,
|
package/es/FormContext.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Layout, { Content, Main } from '@digigov/ui/layouts/Basic/';
|
|
3
3
|
import SummaryList, { SummaryListItem, SummaryListItemKey, SummaryListItemValue } from '@digigov/ui/core/SummaryList';
|
|
4
|
+
import { Header, HeaderSection, HeaderContent, HeaderTitle, HeadingCaption, Heading, Paragraph, Card, CardHeading, CardText, List, ListItem } from '@digigov/ui';
|
|
4
5
|
import GovGRFooter from '@digigov/ui/govgr/Footer';
|
|
5
6
|
import GovGRLogo from '@digigov/ui/govgr/GovGRLogo';
|
|
6
|
-
import Layout, { Content, Main } from '@digigov/ui/layouts/Basic/';
|
|
7
7
|
var fields = [{
|
|
8
8
|
name: 'Όνομα',
|
|
9
9
|
value: 'ΜΑΡΙΟΣ'
|
|
@@ -5,15 +5,15 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
6
6
|
|
|
7
7
|
/* eslint-disable react/prop-types */
|
|
8
|
-
import React, { useEffect, useMemo } from 'react';
|
|
8
|
+
import React, { useEffect, useMemo } from 'react'; // import { FormBuilderProps } from '@digigov/form';
|
|
9
|
+
|
|
10
|
+
import Button from '@digigov/ui/core/Button';
|
|
11
|
+
import Fieldset from '@digigov/react-core/Fieldset';
|
|
12
|
+
import RadioConditional from '@digigov/react-core/RadioConditional';
|
|
9
13
|
import { useWatch } from 'react-hook-form';
|
|
10
14
|
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
11
15
|
import { calculateField, useField } from '@digigov/form/Field/utils';
|
|
12
16
|
import FieldObject from '@digigov/form/FieldObject';
|
|
13
|
-
import Fieldset from '@digigov/react-core/Fieldset';
|
|
14
|
-
import RadioConditional from '@digigov/react-core/RadioConditional'; // import { FormBuilderProps } from '@digigov/form';
|
|
15
|
-
|
|
16
|
-
import Button from '@digigov/ui/core/Button';
|
|
17
17
|
export var AddObjects = function AddObjects(_ref) {
|
|
18
18
|
var name = _ref.name,
|
|
19
19
|
fields = _ref.fields,
|
|
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
|
+
import { Card, CardText, CardAction, Button, Heading, CardHeading } from '@digigov/react-core';
|
|
6
|
+
import AddObjects from '@digigov/form/MultiplicityField/add-objects';
|
|
5
7
|
import { useFieldArray } from 'react-hook-form';
|
|
6
|
-
import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
7
8
|
import FieldObject from '@digigov/form/FieldObject';
|
|
8
|
-
import
|
|
9
|
-
import { Card, CardText, CardAction, Button, Heading, CardHeading } from '@digigov/react-core';
|
|
9
|
+
import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
10
10
|
// epeidh einai forwardRef to ref mas to dinei xwrista apo ta props
|
|
11
11
|
export var Multiplicity = function Multiplicity(_ref) {
|
|
12
12
|
var extra = _ref.extra,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { getNextStep } from '@digigov/form/Questions/getNextStep';
|
|
4
3
|
import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
|
|
4
|
+
import { getNextStep } from '@digigov/form/Questions/getNextStep';
|
|
5
5
|
var isBrowser = typeof window !== 'undefined';
|
|
6
6
|
/**
|
|
7
7
|
* The Question component accepts question data as props
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
+
import { SummaryList, SummaryListItem, SummaryListItemKey, SummaryListItemValue, SummaryListItemAction } from '@digigov/ui/core/SummaryList';
|
|
3
|
+
import Title from '@digigov/ui/typography/Title';
|
|
4
|
+
import { Button } from '@digigov/ui/core';
|
|
2
5
|
import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
|
|
3
|
-
import { StepContext } from '@digigov/form/Questions/Step/StepContext';
|
|
4
6
|
import { StepTitleBase } from '@digigov/form/Questions/Step/StepTitle';
|
|
7
|
+
import { StepContext } from '@digigov/form/Questions/Step/StepContext';
|
|
5
8
|
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
6
|
-
import { Button } from '@digigov/ui/core';
|
|
7
|
-
import { SummaryList, SummaryListItem, SummaryListItemKey, SummaryListItemValue, SummaryListItemAction } from '@digigov/ui/core/SummaryList';
|
|
8
|
-
import Title from '@digigov/ui/typography/Title';
|
|
9
9
|
export var ReviewStep = function ReviewStep() {
|
|
10
10
|
var _useTranslation = useTranslation(),
|
|
11
11
|
t = _useTranslation.t;
|
|
@@ -3,8 +3,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import React, { useContext, useState } from 'react';
|
|
5
5
|
import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
|
|
6
|
-
import { StepArrayReview } from '@digigov/form/Questions/Step/StepArrayReview';
|
|
7
6
|
import { StepContext } from '@digigov/form/Questions/Step/StepContext';
|
|
7
|
+
import { StepArrayReview } from '@digigov/form/Questions/Step/StepArrayReview';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The Step component accepts Step data as props
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { Field } from '@digigov/form/Field';
|
|
3
|
-
import { Fieldset } from '@digigov/form/Fieldset';
|
|
4
|
-
import FormBuilder from '@digigov/form/FormBuilder';
|
|
5
|
-
import Label from '@digigov/form/inputs/Label';
|
|
6
2
|
import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
|
|
7
|
-
import { getAddMoreFields } from '@digigov/form/Questions/Step/getAddMoreFields';
|
|
8
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
9
3
|
import PageTitle, { PageTitleHeading } from '@digigov/ui/app/PageTitle';
|
|
10
4
|
import Button from '@digigov/ui/core/Button';
|
|
5
|
+
import FormBuilder from '@digigov/form/FormBuilder';
|
|
6
|
+
import { Field } from '@digigov/form/Field';
|
|
7
|
+
import { Fieldset } from '@digigov/form/Fieldset';
|
|
8
|
+
import Label from '@digigov/form/inputs/Label';
|
|
11
9
|
import { SummaryList, SummaryListItem, SummaryListItemKey, SummaryListItemValue, SummaryListItemAction } from '@digigov/ui/core/SummaryList';
|
|
10
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
11
|
+
import { getAddMoreFields } from '@digigov/form/Questions/Step/getAddMoreFields';
|
|
12
12
|
export var StepArrayReview = function StepArrayReview(props) {
|
|
13
13
|
var _currentStep$review2, _currentStep$review3, _currentStep$review4;
|
|
14
14
|
|
|
@@ -3,8 +3,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["children", "description"];
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import { StepContext } from '@digigov/form/Questions/Step/StepContext';
|
|
6
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
7
6
|
import Paragraph from '@digigov/ui/typography/Paragraph';
|
|
7
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
8
8
|
export var StepDescriptionBase = function StepDescriptionBase(_ref) {
|
|
9
9
|
var children = _ref.children,
|
|
10
10
|
description = _ref.description,
|
|
@@ -2,12 +2,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
var _excluded = ["children", "submitButton"],
|
|
3
3
|
_excluded2 = ["name", "submitStep"];
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
|
-
import Field from '@digigov/form/Field';
|
|
6
|
-
import Fieldset from '@digigov/form/Fieldset';
|
|
7
|
-
import FormBuilder from '@digigov/form/FormBuilder';
|
|
8
5
|
import { StepContext } from '@digigov/form/Questions/Step/StepContext';
|
|
9
|
-
import
|
|
6
|
+
import FormBuilder from '@digigov/form/FormBuilder';
|
|
7
|
+
import Fieldset from '@digigov/form/Fieldset';
|
|
8
|
+
import Field from '@digigov/form/Field';
|
|
10
9
|
import Button from '@digigov/ui/core/Button';
|
|
10
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The StepForm component accepts a title, a caption and a
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { StepContext } from '@digigov/form/Questions/Step/StepContext';
|
|
3
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
4
3
|
import PageTitle, { PageTitleHeading, PageTitleSection, PageTitleCaption } from '@digigov/ui/app/PageTitle';
|
|
5
4
|
import BackButton from '@digigov/ui/core/Button/BackButton';
|
|
5
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
6
6
|
export var StepTitleHeading = function StepTitleHeading(props) {
|
|
7
7
|
return /*#__PURE__*/React.createElement(PageTitleHeading, null, props.children);
|
|
8
8
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import Questions, { Step, StepForm, StepTitle } from '@digigov/form/Questions';
|
|
2
|
+
import GovGRFooter from '@digigov/ui/govgr/Footer';
|
|
4
3
|
import Header from '@digigov/ui/app/Header';
|
|
5
|
-
import HeaderContent from '@digigov/ui/app/Header/HeaderContent';
|
|
6
4
|
import HeaderSection from '@digigov/ui/app/Header/HeaderSection';
|
|
7
|
-
import
|
|
5
|
+
import HeaderContent from '@digigov/ui/app/Header/HeaderContent';
|
|
8
6
|
import GovGRLogo from '@digigov/ui/govgr/GovGRLogo';
|
|
9
7
|
import BasicLayout, { Top, Content, Main, Bottom } from '@digigov/ui/layouts/Basic';
|
|
8
|
+
import Questions, { Step, StepForm, StepTitle } from '@digigov/form/Questions';
|
|
9
|
+
import { Field } from '@digigov/form';
|
|
10
10
|
var steps = [{
|
|
11
11
|
name: 'age',
|
|
12
12
|
title: 'What is your age?',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { mount } from 'enzyme';
|
|
3
|
+
import { Step, StepForm, StepQuote, StepTitle } from '@digigov/form/Questions';
|
|
4
|
+
import Questions from '@digigov/form/Questions';
|
|
3
5
|
import { Field } from '@digigov/form';
|
|
4
|
-
import Questions, { Step, StepForm, StepQuote, StepTitle } from "@digigov/form/Questions";
|
|
5
6
|
var steps = [{
|
|
6
7
|
name: 'intro',
|
|
7
8
|
caption: 'intro.caption',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Suspense } from 'react';
|
|
2
|
-
import { Field } from '@digigov/form/Field';
|
|
3
2
|
import FormBuilder from '@digigov/form/FormBuilder';
|
|
4
|
-
import {
|
|
3
|
+
import { Field } from '@digigov/form/Field';
|
|
5
4
|
import Button from '@digigov/ui/core/Button';
|
|
5
|
+
import { results } from '@digigov/ui/admin/AutoComplete/utils';
|
|
6
6
|
var fields = [{
|
|
7
7
|
key: 'autocomplete',
|
|
8
8
|
label: {
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["name", "extra", "onChange", "value"];
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
|
-
import { Hint } from '@digigov/react-core';
|
|
6
5
|
import UIAutoComplete from '@digigov/ui/admin/AutoComplete';
|
|
6
|
+
import { Hint } from '@digigov/react-core';
|
|
7
7
|
export var AutoComplete = function AutoComplete(_ref) {
|
|
8
8
|
var name = _ref.name,
|
|
9
9
|
options = _ref.extra.options,
|
|
@@ -4,4 +4,6 @@ export default {
|
|
|
4
4
|
component: Checkboxes,
|
|
5
5
|
displayName: 'Checkboxes'
|
|
6
6
|
};
|
|
7
|
-
export * from '@digigov/form/inputs/Checkboxes/__stories__/Default';
|
|
7
|
+
export * from '@digigov/form/inputs/Checkboxes/__stories__/Default';
|
|
8
|
+
export * from '@digigov/form/inputs/Checkboxes/__stories__/WithDivider';
|
|
9
|
+
export * from '@digigov/form/inputs/Checkboxes/__stories__/Conditional';
|
|
@@ -64,6 +64,22 @@
|
|
|
64
64
|
"title": "Focus and check using keyboard, click box and submit"
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
|
+
},
|
|
68
|
+
"digigov-form-inputs-checkboxes--conditional": {
|
|
69
|
+
"actionSets": [
|
|
70
|
+
{
|
|
71
|
+
"actions": [
|
|
72
|
+
{
|
|
73
|
+
"name": "click",
|
|
74
|
+
"args": {
|
|
75
|
+
"selector": "html>body>div:nth-child(5)>form>div>fieldset>div>div:nth-child(1)>label>input"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"id": "zpUjNzrqwtmW",
|
|
80
|
+
"title": "Checkboxes conditional action"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
67
83
|
}
|
|
68
84
|
}
|
|
69
85
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
+
import { Button } from '@digigov/ui/core';
|
|
4
|
+
var fields = [{
|
|
5
|
+
key: 'landline',
|
|
6
|
+
type: 'phone_number',
|
|
7
|
+
label: {
|
|
8
|
+
secondary: 'Εισάγετε το νούμερο του σταθερού σας τηλεφώνου.'
|
|
9
|
+
},
|
|
10
|
+
enabled: false,
|
|
11
|
+
condition: {
|
|
12
|
+
auth_form: {
|
|
13
|
+
is: 'via_mobile_phone',
|
|
14
|
+
then: {
|
|
15
|
+
enabled: true,
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
key: 'mobile_phone',
|
|
22
|
+
type: 'mobile_phone',
|
|
23
|
+
label: {
|
|
24
|
+
secondary: 'Εισάγετε το νούμερο του κινητού σας τηλεφώνου.'
|
|
25
|
+
},
|
|
26
|
+
enabled: false,
|
|
27
|
+
condition: {
|
|
28
|
+
auth_form: {
|
|
29
|
+
is: 'via_mobile_phone',
|
|
30
|
+
then: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
required: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: 'email',
|
|
38
|
+
type: 'email',
|
|
39
|
+
label: {
|
|
40
|
+
secondary: 'Εισάγετε την διεύθυνση του ηλεκτρονικού σας ταχυδρομείου.'
|
|
41
|
+
},
|
|
42
|
+
enabled: false,
|
|
43
|
+
condition: {
|
|
44
|
+
auth_form: {
|
|
45
|
+
is: 'via_email',
|
|
46
|
+
then: {
|
|
47
|
+
enabled: true,
|
|
48
|
+
required: true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: 'auth_form',
|
|
54
|
+
type: 'choice:multiple',
|
|
55
|
+
required: true,
|
|
56
|
+
label: {
|
|
57
|
+
primary: 'Επιλέξτε μέθοδο πιστοποίησης',
|
|
58
|
+
secondary: 'Για την ολοκλήρωση της δήλωσης σας, θα χρειαστεί επιπλέον πιστοποίηση. Θα σας στείλουμε ένα κωδικό μιας χρήσης είτε στο τηλέφωνο είτε στην ηλεκτρονική σας διεύθυνση.'
|
|
59
|
+
},
|
|
60
|
+
extra: {
|
|
61
|
+
options: [{
|
|
62
|
+
key: 'via_mobile_phone',
|
|
63
|
+
label: {
|
|
64
|
+
primary: 'Mέσω κινητού τηλεφώνου'
|
|
65
|
+
},
|
|
66
|
+
value: 'via_mobile_phone',
|
|
67
|
+
show: ['mobile_phone', 'landline']
|
|
68
|
+
}, {
|
|
69
|
+
key: 'via_email',
|
|
70
|
+
label: {
|
|
71
|
+
primary: 'Μέσω διεύθυνσης ηλεκτρονικού ταχυδρομείου (e-mail)'
|
|
72
|
+
},
|
|
73
|
+
value: 'via_email',
|
|
74
|
+
show: ['email']
|
|
75
|
+
}]
|
|
76
|
+
}
|
|
77
|
+
}];
|
|
78
|
+
|
|
79
|
+
var _ref = /*#__PURE__*/React.createElement(Field, {
|
|
80
|
+
key: "auth_form",
|
|
81
|
+
name: "auth_form"
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var _ref2 = /*#__PURE__*/React.createElement(Button, {
|
|
85
|
+
type: "submit"
|
|
86
|
+
}, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
87
|
+
|
|
88
|
+
export var Conditional = function Conditional() {
|
|
89
|
+
return /*#__PURE__*/React.createElement(FormBuilder, {
|
|
90
|
+
onSubmit: function onSubmit(data) {
|
|
91
|
+
console.log(data);
|
|
92
|
+
},
|
|
93
|
+
fields: fields
|
|
94
|
+
}, _ref, _ref2);
|
|
95
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
+
import { Button } from '@digigov/ui/core';
|
|
4
|
+
|
|
5
|
+
var _ref = /*#__PURE__*/React.createElement(Button, {
|
|
6
|
+
type: "submit"
|
|
7
|
+
}, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
|
|
8
|
+
|
|
9
|
+
export var WithDivider = function WithDivider() {
|
|
10
|
+
return /*#__PURE__*/React.createElement(FormBuilder, {
|
|
11
|
+
onSubmit: function onSubmit(data) {
|
|
12
|
+
console.log(data);
|
|
13
|
+
}
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Field, {
|
|
15
|
+
key: 'string',
|
|
16
|
+
name: "string",
|
|
17
|
+
type: "choice:multiple",
|
|
18
|
+
required: true,
|
|
19
|
+
label: {
|
|
20
|
+
primary: 'Πώς αισθάνεστε αυτή τη στιγμή;'
|
|
21
|
+
},
|
|
22
|
+
extra: {
|
|
23
|
+
options: [{
|
|
24
|
+
label: {
|
|
25
|
+
primary: 'Έχω συνάχι'
|
|
26
|
+
},
|
|
27
|
+
value: 'runny-nose'
|
|
28
|
+
}, {
|
|
29
|
+
label: {
|
|
30
|
+
primary: 'Έχω πυρετό'
|
|
31
|
+
},
|
|
32
|
+
value: 'fever'
|
|
33
|
+
}, {
|
|
34
|
+
label: {
|
|
35
|
+
primary: 'Αισθάνομαι κούραση'
|
|
36
|
+
},
|
|
37
|
+
value: 'fatigue',
|
|
38
|
+
divider: 'ή'
|
|
39
|
+
}]
|
|
40
|
+
}
|
|
41
|
+
}), _ref);
|
|
42
|
+
};
|
|
43
|
+
export default WithDivider;
|