@experium/findy-form 1.3.6 → 1.3.7
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.
|
@@ -85,7 +85,7 @@ var styles = {
|
|
|
85
85
|
"modalButtonGroup": "index__modalButtonGroup"
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
var getConstructorOpd = function getConstructorOpd(opdSettings, language) {
|
|
88
|
+
var getConstructorOpd = function getConstructorOpd(opdSettings, pdaLanguage, language) {
|
|
89
89
|
var opdConstructor = (0, _ramda.pathOr)([], ['data', 'opdConstructor'], opdSettings);
|
|
90
90
|
var text = (opdConstructor || []).reduce(function (res, cur) {
|
|
91
91
|
switch (cur.type) {
|
|
@@ -93,10 +93,10 @@ var getConstructorOpd = function getConstructorOpd(opdSettings, language) {
|
|
|
93
93
|
return "".concat(res, "<input name=\"").concat(cur.question, "\" placeholder=\"").concat((0, _ramda.path)(['translations', language], cur) || cur.placeholder || '', "\" type=\"text\" ").concat(cur.required ? 'required' : '', " /> ");
|
|
94
94
|
|
|
95
95
|
case 'formated':
|
|
96
|
-
return res + ((0, _ramda.path)(['translations',
|
|
96
|
+
return res + ((0, _ramda.path)(['translations', pdaLanguage], cur) || cur.text || '');
|
|
97
97
|
|
|
98
98
|
case 'checkbox':
|
|
99
|
-
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((0, _ramda.path)(['translations',
|
|
99
|
+
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((0, _ramda.path)(['translations', pdaLanguage], cur) || cur.label || '', "</label>\n </div>");
|
|
100
100
|
|
|
101
101
|
case 'opdCheckbox':
|
|
102
102
|
return "".concat(res, "<div>\n <input type=\"checkbox\" id=\"").concat(cur.opdType, "\" name=\"").concat(cur.opdType, "\" data-separate-field=\"").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, 'translations', language], opdSettings) || (0, _ramda.pathOr)('', [cur.opdType, 'label'], opdSettings), "</label>\n </div>");
|
|
@@ -152,7 +152,7 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
152
152
|
renderOpdLabel = _this$props.renderOpdLabel,
|
|
153
153
|
opd = _this$props.opd,
|
|
154
154
|
opdSettings = _this$props.opdSettings,
|
|
155
|
-
language = _this$props.
|
|
155
|
+
language = _this$props.language;
|
|
156
156
|
var label = t('opdLabelCustom');
|
|
157
157
|
var modalLinkProps = {
|
|
158
158
|
className: opd ? styles.formLink : styles.withoutOpd,
|
|
@@ -216,7 +216,7 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
216
216
|
return {};
|
|
217
217
|
});
|
|
218
218
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isHtmlOpd", function () {
|
|
219
|
-
var constructorOpd = (0, _ramda.path)(['useConstructor'], _this.props.opdSettings) ? getConstructorOpd(_this.props.opdSettings, _this.props.language) : null;
|
|
219
|
+
var constructorOpd = (0, _ramda.path)(['useConstructor'], _this.props.opdSettings) ? getConstructorOpd(_this.props.opdSettings, _this.props.pdaLanguage, _this.props.language) : null;
|
|
220
220
|
return !!(_this.props.htmlOpd || constructorOpd);
|
|
221
221
|
});
|
|
222
222
|
return _this;
|
|
@@ -229,9 +229,10 @@ var PersonalDataAgreementComponent = /*#__PURE__*/function (_Component) {
|
|
|
229
229
|
|
|
230
230
|
var _this$props3 = this.props,
|
|
231
231
|
opdSettings = _this$props3.opdSettings,
|
|
232
|
-
|
|
232
|
+
pdaLanguage = _this$props3.pdaLanguage,
|
|
233
|
+
language = _this$props3.language;
|
|
233
234
|
var isHtmlOpd = this.isHtmlOpd();
|
|
234
|
-
var constructorOpd = (0, _ramda.path)(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings, language) : null;
|
|
235
|
+
var constructorOpd = (0, _ramda.path)(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings, pdaLanguage, language) : null;
|
|
235
236
|
return /*#__PURE__*/_react["default"].createElement(_FormContext.FormContext.Consumer, null, function (_ref) {
|
|
236
237
|
var htmlAttrs = _ref.htmlAttrs;
|
|
237
238
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement(_Checkbox.Checkbox, (0, _extends2["default"])({
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import HtmlOpdForm, { HtmlOpdFormClear } from './HtmlOpdForm';
|
|
|
10
10
|
import { FormContext } from '../../context/FormContext';
|
|
11
11
|
import { getAttrs } from '../../utils/attrs';
|
|
12
12
|
|
|
13
|
-
const getConstructorOpd = (opdSettings, language) => {
|
|
13
|
+
const getConstructorOpd = (opdSettings, pdaLanguage, language) => {
|
|
14
14
|
const opdConstructor = pathOr([], ['data', 'opdConstructor'], opdSettings);
|
|
15
15
|
|
|
16
16
|
const text = (opdConstructor || []).reduce((res, cur) => {
|
|
@@ -18,11 +18,11 @@ const getConstructorOpd = (opdSettings, language) => {
|
|
|
18
18
|
case 'question':
|
|
19
19
|
return `${res}<input name="${cur.question}" placeholder="${path(['translations', language], cur) || cur.placeholder || ''}" type="text" ${cur.required ? 'required' : ''} /> `;
|
|
20
20
|
case 'formated':
|
|
21
|
-
return res + (path(['translations',
|
|
21
|
+
return res + (path(['translations', pdaLanguage], cur) || cur.text || '');
|
|
22
22
|
case 'checkbox':
|
|
23
23
|
return `${res}<div>
|
|
24
24
|
<input type="checkbox" id="${`checkbox-${cur.id}`}" ${cur.required ? 'required="required"' : ''} />
|
|
25
|
-
<label for="${`checkbox-${cur.id}`}">${path(['translations',
|
|
25
|
+
<label for="${`checkbox-${cur.id}`}">${path(['translations', pdaLanguage], cur) || cur.label || ''}</label>
|
|
26
26
|
</div>`;
|
|
27
27
|
case 'opdCheckbox':
|
|
28
28
|
return `${res}<div>
|
|
@@ -61,7 +61,7 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
61
61
|
closeHtml = () => this.setState({ openedHtml: false });
|
|
62
62
|
|
|
63
63
|
getLabel = () => {
|
|
64
|
-
const { t, renderOpdLabel, opd, opdSettings,
|
|
64
|
+
const { t, renderOpdLabel, opd, opdSettings, language } = this.props;
|
|
65
65
|
const label = t('opdLabelCustom');
|
|
66
66
|
const modalLinkProps = {
|
|
67
67
|
className: opd ? styles.formLink : styles.withoutOpd,
|
|
@@ -140,14 +140,14 @@ class PersonalDataAgreementComponent extends Component {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
isHtmlOpd = () => {
|
|
143
|
-
const constructorOpd = path(['useConstructor'], this.props.opdSettings) ? getConstructorOpd(this.props.opdSettings, this.props.language) : null;
|
|
143
|
+
const constructorOpd = path(['useConstructor'], this.props.opdSettings) ? getConstructorOpd(this.props.opdSettings, this.props.pdaLanguage, this.props.language) : null;
|
|
144
144
|
return !!(this.props.htmlOpd || constructorOpd);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
render() {
|
|
148
|
-
const { opdSettings, pdaLanguage
|
|
148
|
+
const { opdSettings, pdaLanguage, language } = this.props;
|
|
149
149
|
const isHtmlOpd = this.isHtmlOpd();
|
|
150
|
-
const constructorOpd = path(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings, language) : null;
|
|
150
|
+
const constructorOpd = path(['useConstructor'], opdSettings) ? getConstructorOpd(opdSettings, pdaLanguage, language) : null;
|
|
151
151
|
|
|
152
152
|
return <FormContext.Consumer>{ ({ htmlAttrs }) => (
|
|
153
153
|
<Fragment>
|