@experium/findy-form 1.2.25 → 1.2.29
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/dist/app.js +8 -8
- package/lib/components/formComponents/HtmlOpdForm.js +14 -5
- package/lib/components/formComponents/PersonalDataAgreement.js +3 -3
- package/lib/styles/index.css +24 -0
- package/package.json +1 -1
- package/src/components/formComponents/HtmlOpdForm.js +30 -6
- package/src/components/formComponents/PersonalDataAgreement.js +6 -6
- package/src/styles/index.css +24 -0
|
@@ -74,7 +74,7 @@ var styles = {
|
|
|
74
74
|
"timeIndicator": "index__timeIndicator",
|
|
75
75
|
"modalButtonGroup": "index__modalButtonGroup"
|
|
76
76
|
};
|
|
77
|
-
var commonStyle = "\n .opd-html-form {\n line-height: 20px;\n margin-bottom: 24px;\n }\n .opd-html-form input {\n border: none;\n border-bottom: 1px solid #000;\n font-size: 16px;\n pointer-events: auto;\n }\n .opd-html-form label {\n pointer-events: auto;\n }\n .opd-html-form input:focus {\n outline: none;\n }\n .opd-html-form.submitted input:invalid {\n border-bottom: 1px solid red;\n }\n .opd-html-form label{\n cursor: pointer;\n }\n .opd-html-form input[type=\"checkbox\"] {\n position: relative;\n margin-right: 8px;\n margin-bottom:
|
|
77
|
+
var commonStyle = "\n .opd-html-form {\n line-height: 20px;\n margin-bottom: 24px;\n }\n .opd-html-form input {\n border: none;\n border-bottom: 1px solid #000;\n font-size: 16px;\n pointer-events: auto;\n margin: 4px 0;\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n .opd-html-form label {\n pointer-events: auto;\n }\n .opd-html-form input:focus {\n outline: none;\n }\n .opd-html-form.submitted input:invalid {\n border-bottom: 1px solid red;\n }\n .opd-html-form label{\n cursor: pointer;\n }\n .opd-html-form input[type=\"checkbox\"] {\n position: relative;\n margin-right: 8px;\n margin-bottom: -2px;\n border: 1px solid #ccc;\n appearance: none;\n width: 18px;\n height: 18px;\n border-radius: 2px;\n }\n .opd-html-form input[type=\"checkbox\"]:checked {\n background: #3a70bb;\n border-color: #3a70bb;\n }\n .opd-html-form input[type=\"checkbox\"]:checked:before {\n transform: rotate(45deg);\n position: absolute;\n left: 5px;\n top: 2px;\n display: table;\n width: 4px;\n height: 7px;\n border: 2px solid #ffffff;\n border-top: 0;\n border-left: 0;\n content: ' ';\n }\n .opd-html-form input[type=\"checkbox\"]:required::after {\n content: \"*\";\n color: red;\n top: -6px;\n right: -8px;\n position: absolute;\n }\n .opd-html-form.submitted input[type=\"checkbox\"]:invalid {\n border-color: red;\n }\n .opd-html-form > div > div {\n margin: 4px 0;\n }\n .opd-html-form > div p {\n display: inline-block;\n margin: 4px 0;\n }\n .opd-html-form > div p + p {\n display: block;\n }\n @media screen and (max-width: 991px) {\n .opd-html-form input[type=\"checkbox\"]:checked:before {\n left: 6px;\n top: 3px;\n }\n }\n";
|
|
78
78
|
|
|
79
79
|
var getHtml = function getHtml(body) {
|
|
80
80
|
return "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>OPD</title>\n <style>\n ".concat(commonStyle, "\n .opd-html-form {\n font-family: Arial;\n font-size: 16px;\n }\n .opd-html-form input,\n .opd-html-form label {\n pointer-events: none;\n }\n .opd-html-form input[type=\"checkbox\"]:required::after {\n content: \"\";\n }\n </style>\n </head>\n <body>\n <div style=\"margin: 10px auto; max-width: 1080px;\">\n ").concat(body, "\n </div>\n </body>\n </html>\n");
|
|
@@ -82,7 +82,7 @@ var getHtml = function getHtml(body) {
|
|
|
82
82
|
|
|
83
83
|
exports.getHtml = getHtml;
|
|
84
84
|
var TEXT_FIELDS = ['text', 'email', 'phone', 'date'];
|
|
85
|
-
var SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region'];
|
|
85
|
+
var SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region', 'money'];
|
|
86
86
|
|
|
87
87
|
var HtmlOpdForm = /*#__PURE__*/function (_Component) {
|
|
88
88
|
(0, _inherits2["default"])(HtmlOpdForm, _Component);
|
|
@@ -118,9 +118,18 @@ var HtmlOpdForm = /*#__PURE__*/function (_Component) {
|
|
|
118
118
|
input.value = value;
|
|
119
119
|
input.setAttribute('value', value);
|
|
120
120
|
} else if (field && (0, _ramda.includes)(field.type, SELECT_FIELDS)) {
|
|
121
|
-
var selectValue = (0, _ramda.path)(['
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
var selectValue = (0, _ramda.path)(['settings', 'multiple'], field) ? (0, _ramda.path)(['settings', 'checkboxes'], field) ? (0, _ramda.join)(', ', (0, _ramda.map)(function (el) {
|
|
122
|
+
return (0, _ramda.path)(['innerHTML'], el);
|
|
123
|
+
}, document.querySelectorAll("#field-".concat(input.name, " .rc-checkbox-checked + .checkbox-label")))) : (0, _ramda.join)(', ', (0, _ramda.map)(function (el) {
|
|
124
|
+
return (0, _ramda.path)(['innerHTML'], el);
|
|
125
|
+
}, document.querySelectorAll("#field-".concat(input.name, " .jobot-forms-rc-select-selection-item-content")))) : (0, _ramda.path)(['settings', 'checkboxes'], field) ? (0, _ramda.path)(['innerHTML'], document.querySelector("#field-".concat(input.name, " .rc-checkbox-checked + .radio-label"))) : (0, _ramda.path)(['innerHTML'], document.querySelector("#field-".concat(input.name, " .jobot-forms-rc-select-selection-item")));
|
|
126
|
+
|
|
127
|
+
if (field.type === 'money') {
|
|
128
|
+
var inputValue = document.querySelector("#field-".concat(input.name, " input#").concat(input.name)).value;
|
|
129
|
+
var moneyValue = "".concat(inputValue || '', " ").concat(selectValue || '');
|
|
130
|
+
input.value = moneyValue;
|
|
131
|
+
input.setAttribute('value', moneyValue);
|
|
132
|
+
} else if (selectValue) {
|
|
124
133
|
input.value = selectValue;
|
|
125
134
|
input.setAttribute('value', selectValue);
|
|
126
135
|
}
|
|
@@ -82,7 +82,7 @@ var styles = {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
var getConstructorOpd = function getConstructorOpd(opdSettings, language) {
|
|
85
|
-
var opdConstructor =
|
|
85
|
+
var opdConstructor = (0, _ramda.pathOr)([], ['data', 'opdConstructor'], opdSettings);
|
|
86
86
|
var text = (opdConstructor || []).reduce(function (res, cur) {
|
|
87
87
|
switch (cur.type) {
|
|
88
88
|
case 'question':
|
|
@@ -92,10 +92,10 @@ var getConstructorOpd = function getConstructorOpd(opdSettings, language) {
|
|
|
92
92
|
return res + (cur.text || '');
|
|
93
93
|
|
|
94
94
|
case 'checkbox':
|
|
95
|
-
return "".concat(res, "<
|
|
95
|
+
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"", "checkbox-".concat(cur.id), "\" ").concat(cur.required ? 'required="required"' : '', " />\n <label for=\"", "checkbox-".concat(cur.id), "\">").concat(cur.label || '', "</label>\n </div>");
|
|
96
96
|
|
|
97
97
|
case 'opdCheckbox':
|
|
98
|
-
return "".concat(res, "<
|
|
98
|
+
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"").concat(cur.opdType, "\" ").concat((0, _ramda.path)([cur.opdType, 'required'], opdSettings) ? 'required="required"' : '', " />\n <label for=\"").concat(cur.opdType, "\">").concat((0, _ramda.pathOr)('', [cur.opdType, 'label'], opdSettings), "</label>\n </div>");
|
|
99
99
|
|
|
100
100
|
default:
|
|
101
101
|
return res;
|
package/lib/styles/index.css
CHANGED
|
@@ -371,6 +371,11 @@
|
|
|
371
371
|
box-sizing: content-box;
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
+
.radio-wrapper .rc-checkbox-inner:after {
|
|
375
|
+
margin-top: -1px;
|
|
376
|
+
margin-left: -1px;
|
|
377
|
+
}
|
|
378
|
+
|
|
374
379
|
.radio-wrapper .rc-checkbox-inner {
|
|
375
380
|
border-radius: 50%;
|
|
376
381
|
}
|
|
@@ -411,6 +416,22 @@
|
|
|
411
416
|
border: 0;
|
|
412
417
|
}
|
|
413
418
|
|
|
419
|
+
body .rc-checkbox:hover .rc-checkbox-inner, body .rc-checkbox-input:focus + .rc-checkbox-inner {
|
|
420
|
+
border-color: #3a70ba;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.checkbox-wrapper .rc-checkbox.rc-checkbox-checked .rc-checkbox-inner:after {
|
|
424
|
+
left: 4px;
|
|
425
|
+
top: 1px;
|
|
426
|
+
width: 4px;
|
|
427
|
+
height: 7px;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.checkbox-wrapper .rc-checkbox-checked .rc-checkbox-inner {
|
|
431
|
+
border-color: #3a70ba;
|
|
432
|
+
background-color: #3a70ba;
|
|
433
|
+
}
|
|
434
|
+
|
|
414
435
|
.radio-wrapper .radio-label {
|
|
415
436
|
display: inline-block;
|
|
416
437
|
padding-left: 10px;
|
|
@@ -453,6 +474,9 @@
|
|
|
453
474
|
word-break: break-word;
|
|
454
475
|
}
|
|
455
476
|
@media screen and (max-width: 991px) {
|
|
477
|
+
.pda-modal {
|
|
478
|
+
width: 100%;
|
|
479
|
+
}
|
|
456
480
|
.pda-modal input.text {
|
|
457
481
|
width: 90%;
|
|
458
482
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component, Fragment } from 'react';
|
|
2
2
|
import { withTranslation } from 'react-i18next';
|
|
3
|
-
import { all, equals, find, forEach, includes, is, path, propEq, trim } from 'ramda';
|
|
3
|
+
import { all, equals, join, find, forEach, map, includes, is, path, propEq, trim } from 'ramda';
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
|
|
6
6
|
import styles from '../../styles/index.module.css';
|
|
@@ -18,6 +18,10 @@ const commonStyle = `
|
|
|
18
18
|
border-bottom: 1px solid #000;
|
|
19
19
|
font-size: 16px;
|
|
20
20
|
pointer-events: auto;
|
|
21
|
+
margin: 4px 0;
|
|
22
|
+
appearance: none;
|
|
23
|
+
-moz-appearance: none;
|
|
24
|
+
-webkit-appearance: none;
|
|
21
25
|
}
|
|
22
26
|
.opd-html-form label {
|
|
23
27
|
pointer-events: auto;
|
|
@@ -34,7 +38,7 @@ const commonStyle = `
|
|
|
34
38
|
.opd-html-form input[type="checkbox"] {
|
|
35
39
|
position: relative;
|
|
36
40
|
margin-right: 8px;
|
|
37
|
-
margin-bottom:
|
|
41
|
+
margin-bottom: -2px;
|
|
38
42
|
border: 1px solid #ccc;
|
|
39
43
|
appearance: none;
|
|
40
44
|
width: 18px;
|
|
@@ -68,13 +72,22 @@ const commonStyle = `
|
|
|
68
72
|
.opd-html-form.submitted input[type="checkbox"]:invalid {
|
|
69
73
|
border-color: red;
|
|
70
74
|
}
|
|
75
|
+
.opd-html-form > div > div {
|
|
76
|
+
margin: 4px 0;
|
|
77
|
+
}
|
|
71
78
|
.opd-html-form > div p {
|
|
72
79
|
display: inline-block;
|
|
73
|
-
margin:
|
|
80
|
+
margin: 4px 0;
|
|
74
81
|
}
|
|
75
82
|
.opd-html-form > div p + p {
|
|
76
83
|
display: block;
|
|
77
84
|
}
|
|
85
|
+
@media screen and (max-width: 991px) {
|
|
86
|
+
.opd-html-form input[type="checkbox"]:checked:before {
|
|
87
|
+
left: 6px;
|
|
88
|
+
top: 3px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
78
91
|
`;
|
|
79
92
|
|
|
80
93
|
export const getHtml = body => `
|
|
@@ -108,7 +121,7 @@ export const getHtml = body => `
|
|
|
108
121
|
`;
|
|
109
122
|
|
|
110
123
|
const TEXT_FIELDS = ['text', 'email', 'phone', 'date'];
|
|
111
|
-
const SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region'];
|
|
124
|
+
const SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region', 'money'];
|
|
112
125
|
|
|
113
126
|
class HtmlOpdForm extends Component {
|
|
114
127
|
state = {
|
|
@@ -142,9 +155,20 @@ class HtmlOpdForm extends Component {
|
|
|
142
155
|
input.value = value;
|
|
143
156
|
input.setAttribute('value', value);
|
|
144
157
|
} else if (field && includes(field.type, SELECT_FIELDS)) {
|
|
145
|
-
const selectValue = path(['
|
|
158
|
+
const selectValue = path(['settings', 'multiple'], field)
|
|
159
|
+
? path(['settings', 'checkboxes'], field)
|
|
160
|
+
? join(', ', map(el => path(['innerHTML'], el), document.querySelectorAll(`#field-${input.name} .rc-checkbox-checked + .checkbox-label`)))
|
|
161
|
+
: join(', ', map(el => path(['innerHTML'], el), document.querySelectorAll(`#field-${input.name} .jobot-forms-rc-select-selection-item-content`)))
|
|
162
|
+
: path(['settings', 'checkboxes'], field)
|
|
163
|
+
? path(['innerHTML'], document.querySelector(`#field-${input.name} .rc-checkbox-checked + .radio-label`))
|
|
164
|
+
: path(['innerHTML'], document.querySelector(`#field-${input.name} .jobot-forms-rc-select-selection-item`));
|
|
146
165
|
|
|
147
|
-
if (
|
|
166
|
+
if (field.type === 'money') {
|
|
167
|
+
const inputValue = document.querySelector(`#field-${input.name} input#${input.name}`).value;
|
|
168
|
+
const moneyValue = `${inputValue || ''} ${selectValue || ''}`;
|
|
169
|
+
input.value = moneyValue;
|
|
170
|
+
input.setAttribute('value', moneyValue);
|
|
171
|
+
} else if (selectValue) {
|
|
148
172
|
input.value = selectValue;
|
|
149
173
|
input.setAttribute('value', selectValue);
|
|
150
174
|
}
|
|
@@ -14,7 +14,7 @@ import { FormContext } from '../../context/FormContext';
|
|
|
14
14
|
import { getAttrs } from '../../utils/attrs';
|
|
15
15
|
|
|
16
16
|
const getConstructorOpd = (opdSettings, language) => {
|
|
17
|
-
const opdConstructor =
|
|
17
|
+
const opdConstructor = pathOr([], ['data', 'opdConstructor'], opdSettings);
|
|
18
18
|
|
|
19
19
|
const text = (opdConstructor || []).reduce((res, cur) => {
|
|
20
20
|
switch (cur.type) {
|
|
@@ -23,15 +23,15 @@ const getConstructorOpd = (opdSettings, language) => {
|
|
|
23
23
|
case 'formated':
|
|
24
24
|
return res + (cur.text || '');
|
|
25
25
|
case 'checkbox':
|
|
26
|
-
return `${res}<
|
|
26
|
+
return `${res}<div>
|
|
27
27
|
<input type="checkbox" id="${`checkbox-${cur.id}`}" ${cur.required ? 'required="required"' : ''} />
|
|
28
|
-
<label for="${`checkbox-${cur.id}`}">${cur.label || ''}
|
|
29
|
-
</
|
|
28
|
+
<label for="${`checkbox-${cur.id}`}">${cur.label || ''}</label>
|
|
29
|
+
</div>`;
|
|
30
30
|
case 'opdCheckbox':
|
|
31
|
-
return `${res}<
|
|
31
|
+
return `${res}<div>
|
|
32
32
|
<input type="checkbox" id="${cur.opdType}" ${path([cur.opdType, 'required'], opdSettings) ? 'required="required"' : ''} />
|
|
33
33
|
<label for="${cur.opdType}">${pathOr('', [cur.opdType, 'label'], opdSettings)}</label>
|
|
34
|
-
</
|
|
34
|
+
</div>`;
|
|
35
35
|
default:
|
|
36
36
|
return res;
|
|
37
37
|
}
|
package/src/styles/index.css
CHANGED
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
box-sizing: content-box;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
.radio-wrapper .rc-checkbox-inner:after {
|
|
44
|
+
margin-top: -1px;
|
|
45
|
+
margin-left: -1px;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
.radio-wrapper .rc-checkbox-inner {
|
|
44
49
|
border-radius: 50%;
|
|
45
50
|
}
|
|
@@ -80,6 +85,22 @@
|
|
|
80
85
|
border: 0;
|
|
81
86
|
}
|
|
82
87
|
|
|
88
|
+
body .rc-checkbox:hover .rc-checkbox-inner, body .rc-checkbox-input:focus + .rc-checkbox-inner {
|
|
89
|
+
border-color: #3a70ba;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.checkbox-wrapper .rc-checkbox.rc-checkbox-checked .rc-checkbox-inner:after {
|
|
93
|
+
left: 4px;
|
|
94
|
+
top: 1px;
|
|
95
|
+
width: 4px;
|
|
96
|
+
height: 7px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.checkbox-wrapper .rc-checkbox-checked .rc-checkbox-inner {
|
|
100
|
+
border-color: #3a70ba;
|
|
101
|
+
background-color: #3a70ba;
|
|
102
|
+
}
|
|
103
|
+
|
|
83
104
|
.radio-wrapper .radio-label {
|
|
84
105
|
display: inline-block;
|
|
85
106
|
padding-left: 10px;
|
|
@@ -122,6 +143,9 @@
|
|
|
122
143
|
word-break: break-word;
|
|
123
144
|
}
|
|
124
145
|
@media screen and (max-width: 991px) {
|
|
146
|
+
.pda-modal {
|
|
147
|
+
width: 100%;
|
|
148
|
+
}
|
|
125
149
|
.pda-modal input.text {
|
|
126
150
|
width: 90%;
|
|
127
151
|
}
|