@experium/findy-form 1.2.28 → 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.
|
@@ -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
|
}
|
package/lib/styles/index.css
CHANGED
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';
|
|
@@ -121,7 +121,7 @@ export const getHtml = body => `
|
|
|
121
121
|
`;
|
|
122
122
|
|
|
123
123
|
const TEXT_FIELDS = ['text', 'email', 'phone', 'date'];
|
|
124
|
-
const SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region'];
|
|
124
|
+
const SELECT_FIELDS = ['dictionary', 'company_dictionary', 'list', 'city', 'country', 'region', 'money'];
|
|
125
125
|
|
|
126
126
|
class HtmlOpdForm extends Component {
|
|
127
127
|
state = {
|
|
@@ -155,9 +155,20 @@ class HtmlOpdForm extends Component {
|
|
|
155
155
|
input.value = value;
|
|
156
156
|
input.setAttribute('value', value);
|
|
157
157
|
} else if (field && includes(field.type, SELECT_FIELDS)) {
|
|
158
|
-
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`));
|
|
159
165
|
|
|
160
|
-
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) {
|
|
161
172
|
input.value = selectValue;
|
|
162
173
|
input.setAttribute('value', selectValue);
|
|
163
174
|
}
|