react-form-builder-more-flexibility 1.0.15 → 1.0.16
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/README.md +2 -1
- package/dist/1.app.js +1 -1
- package/dist/app.js +5 -5
- package/lib/form-elements/date-picker.js +1 -1
- package/lib/form.js +29 -1
- package/lib/language-provider/entries/it-it.js +17 -0
- package/lib/language-provider/index.js +8 -1
- package/lib/language-provider/locales/it-it.json +97 -0
- package/lib/toolbar.js +1 -1
- package/lib/utils/custom-date-picker.js +94 -0
- package/package.json +2 -1
- package/types/index.d.ts +3 -0
|
@@ -20,7 +20,7 @@ var _componentLabel = _interopRequireDefault(require("./component-label"));
|
|
|
20
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
23
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
23
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } // import ReactDatePicker from '../utils/custom-date-picker';
|
|
24
24
|
// This is the utility function that will attempt to parse a date string
|
|
25
25
|
// using several different formats until it finds one that works.
|
|
26
26
|
function parseDate(dateStr, formatMask) {
|
package/lib/form.js
CHANGED
|
@@ -67,6 +67,11 @@ var ReactForm = /*#__PURE__*/function (_React$Component) {
|
|
|
67
67
|
_this.answerData = _this._convert(props.answer_data);
|
|
68
68
|
_this.emitter = new _fbemitter.EventEmitter();
|
|
69
69
|
_this.getDataById = _this.getDataById.bind((0, _assertThisInitialized2["default"])(_this));
|
|
70
|
+
|
|
71
|
+
// Bind handleBlur and handleChange methods
|
|
72
|
+
_this.handleBlur = _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this));
|
|
73
|
+
_this.handleChange = _this.handleChange.bind((0, _assertThisInitialized2["default"])(_this));
|
|
74
|
+
_this.handleSubmit = _this.handleSubmit.bind((0, _assertThisInitialized2["default"])(_this));
|
|
70
75
|
return _this;
|
|
71
76
|
}
|
|
72
77
|
(0, _createClass2["default"])(ReactForm, [{
|
|
@@ -194,6 +199,7 @@ var ReactForm = /*#__PURE__*/function (_React$Component) {
|
|
|
194
199
|
key: "_collect",
|
|
195
200
|
value: function _collect(item) {
|
|
196
201
|
var itemData = {
|
|
202
|
+
id: item.id,
|
|
197
203
|
name: item.field_name,
|
|
198
204
|
custom_name: item.custom_name || item.field_name
|
|
199
205
|
};
|
|
@@ -273,6 +279,26 @@ var ReactForm = /*#__PURE__*/function (_React$Component) {
|
|
|
273
279
|
}
|
|
274
280
|
}
|
|
275
281
|
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "handleBlur",
|
|
284
|
+
value: function handleBlur(event) {
|
|
285
|
+
// Call submit function on blur
|
|
286
|
+
if (this.props.onBlur) {
|
|
287
|
+
var onBlur = this.props.onBlur;
|
|
288
|
+
var data = this._collectFormData(this.props.data);
|
|
289
|
+
onBlur(data);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, {
|
|
293
|
+
key: "handleChange",
|
|
294
|
+
value: function handleChange(event) {
|
|
295
|
+
// Call submit function on change
|
|
296
|
+
if (this.props.onChange) {
|
|
297
|
+
var onChange = this.props.onChange;
|
|
298
|
+
var data = this._collectFormData(this.props.data);
|
|
299
|
+
onChange(data);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
276
302
|
}, {
|
|
277
303
|
key: "validateForm",
|
|
278
304
|
value: function validateForm() {
|
|
@@ -547,7 +573,9 @@ var ReactForm = /*#__PURE__*/function (_React$Component) {
|
|
|
547
573
|
return _this8.form = c;
|
|
548
574
|
},
|
|
549
575
|
action: this.props.form_action,
|
|
550
|
-
|
|
576
|
+
onBlur: this.handleBlur,
|
|
577
|
+
onChange: this.handleChange,
|
|
578
|
+
onSubmit: this.handleSubmit,
|
|
551
579
|
method: this.props.form_method
|
|
552
580
|
}, this.props.authenticity_token && /*#__PURE__*/_react["default"].createElement("div", {
|
|
553
581
|
style: formTokenStyle
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _itIt = _interopRequireDefault(require("../locales/it-it.json"));
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
var ItLang = {
|
|
13
|
+
messages: _objectSpread({}, _itIt["default"]),
|
|
14
|
+
locale: 'it-IT'
|
|
15
|
+
};
|
|
16
|
+
var _default = ItLang;
|
|
17
|
+
exports["default"] = _default;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = exports.AppLanguages = void 0;
|
|
8
8
|
var _enUs = _interopRequireDefault(require("./entries/en-us"));
|
|
9
|
+
var _itIt = _interopRequireDefault(require("./entries/it-it"));
|
|
9
10
|
var _viVn = _interopRequireDefault(require("./entries/vi-vn"));
|
|
10
11
|
var AppLanguages = [{
|
|
11
12
|
languageId: 'vietnamese',
|
|
@@ -17,11 +18,17 @@ var AppLanguages = [{
|
|
|
17
18
|
locale: 'en',
|
|
18
19
|
name: 'English',
|
|
19
20
|
icon: 'us'
|
|
21
|
+
}, {
|
|
22
|
+
languageId: 'italian',
|
|
23
|
+
locale: 'it',
|
|
24
|
+
name: 'Italiano',
|
|
25
|
+
icon: 'it'
|
|
20
26
|
}];
|
|
21
27
|
exports.AppLanguages = AppLanguages;
|
|
22
28
|
var AppLocale = {
|
|
23
29
|
en: _enUs["default"],
|
|
24
|
-
vi: _viVn["default"]
|
|
30
|
+
vi: _viVn["default"],
|
|
31
|
+
it: _itIt["default"]
|
|
25
32
|
};
|
|
26
33
|
var _default = AppLocale;
|
|
27
34
|
exports["default"] = _default;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"display-label": "Visualizza etichetta",
|
|
3
|
+
"choose-file": "Scegli file",
|
|
4
|
+
"choose-file-type": "Scegli tipo di file",
|
|
5
|
+
"select-file-type": "Scegli tipo di file",
|
|
6
|
+
"text-to-display": "Testo visualizzato",
|
|
7
|
+
"link-to": "Link to",
|
|
8
|
+
"center": "Centro",
|
|
9
|
+
"width": "Larghezza",
|
|
10
|
+
"height": "Altezza",
|
|
11
|
+
"required": "Obbligatorio",
|
|
12
|
+
"read-only": "Sola lettura",
|
|
13
|
+
"default-to-today": "Default oggi",
|
|
14
|
+
"show-time-select": "Visualizza selettore orario",
|
|
15
|
+
"show-time-select-only": "Visualizza solo orario",
|
|
16
|
+
"show-time-input": "Visualizza input orario",
|
|
17
|
+
"display-horizontal": "Visualizza orizzontale",
|
|
18
|
+
"variable-key": "Chiave variabile",
|
|
19
|
+
"variable-key-desc": "Ciò fornirà all'elemento una chiave che può essere utilizzata per sostituire il contenuto con un valore di runtime",
|
|
20
|
+
"print-options": "Opzioni di stampa",
|
|
21
|
+
"page-break-before-elements": "Interruzione di pagina prima dell'elemento",
|
|
22
|
+
"alternate-signature-page": "Pagina alternativa/firma",
|
|
23
|
+
"display-on-alternate-signature-page": "Visualizza su pagina alternativa/firma",
|
|
24
|
+
"step": "Step",
|
|
25
|
+
"min": "Min",
|
|
26
|
+
"max": "Max",
|
|
27
|
+
"default-selected": "Selezionato di default",
|
|
28
|
+
"text-style": "Stile testo",
|
|
29
|
+
"bold": "Grassetto",
|
|
30
|
+
"italic": "Corsivo",
|
|
31
|
+
"description": "Descrizione",
|
|
32
|
+
"correct-answer" : "Risposta corretta",
|
|
33
|
+
"populate-options-from-api" : "Popola opzione da API",
|
|
34
|
+
"populate" : "Popola",
|
|
35
|
+
"pdf" : "PDF",
|
|
36
|
+
"word" : "Word",
|
|
37
|
+
"excel" : "Excel",
|
|
38
|
+
"ppt" : "PPT",
|
|
39
|
+
|
|
40
|
+
"options" : "Opzioni",
|
|
41
|
+
"value" : "Valore",
|
|
42
|
+
"correct" : "Corretto",
|
|
43
|
+
|
|
44
|
+
"dismiss" : "Scarta",
|
|
45
|
+
|
|
46
|
+
"place-holder-option-1" : "Segnaposto opzione 1",
|
|
47
|
+
"place-holder-option-2" : "Segnaposto opzione 2",
|
|
48
|
+
"place-holder-option-3" : "Segnaposto opzione 3",
|
|
49
|
+
"place-holder-tag-1" : "Segnaposto opzione 1",
|
|
50
|
+
"place-holder-tag-2" : "Segnaposto opzione 2",
|
|
51
|
+
"place-holder-tag-3" : "Segnaposto opzione 3",
|
|
52
|
+
|
|
53
|
+
"toolbox" : "Toolbox",
|
|
54
|
+
"header-text" : "Testo Header",
|
|
55
|
+
"label" : "Etichetta",
|
|
56
|
+
"paragraph" : "Paragrafo",
|
|
57
|
+
"line-break" : "Linea Interruzione",
|
|
58
|
+
"dropdown" : "Dropdown",
|
|
59
|
+
"tags": "Tags",
|
|
60
|
+
"checkboxes" : "Checkboxes",
|
|
61
|
+
"multiple-choice":"Scelta multipla",
|
|
62
|
+
"text-input":"Input testo",
|
|
63
|
+
"email-input":"Email",
|
|
64
|
+
"phone-input":"Numero di telefono",
|
|
65
|
+
"number-input":"Input numerico",
|
|
66
|
+
"multi-line-input":"Input multi linea",
|
|
67
|
+
"fieldset":"Set di campi",
|
|
68
|
+
"two-columns-row":"Layout 2 colonne",
|
|
69
|
+
"three-columns-row":"Layout 3 colonne",
|
|
70
|
+
"four-columns-row":"Layout 4 colonne",
|
|
71
|
+
"five-columns-row":"Layout 5 colonne",
|
|
72
|
+
"six-columns-row":"Layout 6 colonne",
|
|
73
|
+
"image":"Immagine",
|
|
74
|
+
"rating":"Valutazione",
|
|
75
|
+
"date":"Data",
|
|
76
|
+
"signature":"Firma",
|
|
77
|
+
"website":"Sito web",
|
|
78
|
+
"file-attachment":"Allegato file",
|
|
79
|
+
"range":"Range",
|
|
80
|
+
"camera":"Camera",
|
|
81
|
+
"file-upload":"Upload file",
|
|
82
|
+
"place-holder-text": "Testo segnaposto...",
|
|
83
|
+
"place-holder-label": "Etichetta segnaposto",
|
|
84
|
+
"place-holder-website-link": "Segnaposto link sito...",
|
|
85
|
+
"place-holder-file-name": "Segnaposto nome file...",
|
|
86
|
+
"place-holder-email": "E-Mail",
|
|
87
|
+
"place-holder-phone-number": "Numero di telefono",
|
|
88
|
+
"easy": "Facile",
|
|
89
|
+
"difficult": "Difficile",
|
|
90
|
+
"drop-zone": "Dropzone",
|
|
91
|
+
|
|
92
|
+
"message.is-required": "è obbligatorio",
|
|
93
|
+
"message.was-answered-incorrectly": "è stato risposto in modo errato",
|
|
94
|
+
"message.was-not-registered": "non è stato registrato",
|
|
95
|
+
"message.invalid-email": "il campo richiede un indirizzo email valido",
|
|
96
|
+
"message.invalid-phone-number": "campo richiede un numero di telefono valido"
|
|
97
|
+
}
|
package/lib/toolbar.js
CHANGED
|
@@ -445,7 +445,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
445
445
|
key: "addCustomOptions",
|
|
446
446
|
value: function addCustomOptions(item, elementOptions) {
|
|
447
447
|
if (item.type === 'custom') {
|
|
448
|
-
var customOptions =
|
|
448
|
+
var customOptions = _objectSpread(_objectSpread({}, item), elementOptions);
|
|
449
449
|
customOptions.custom = true;
|
|
450
450
|
customOptions.component = item.component || null;
|
|
451
451
|
customOptions.custom_options = item.custom_options || [];
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactDatepicker = _interopRequireDefault(require("react-datepicker"));
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
function DatePickerComponent(props) {
|
|
12
|
+
var showTimeInput = props.showTimeInput,
|
|
13
|
+
dateFormat = props.dateFormat,
|
|
14
|
+
selected = props.selected,
|
|
15
|
+
_onChange = props.onChange,
|
|
16
|
+
isClearable = props.isClearable,
|
|
17
|
+
portalId = props.portalId;
|
|
18
|
+
var ButtonDatePicker = function ButtonDatePicker(_ref) {
|
|
19
|
+
var value = _ref.value,
|
|
20
|
+
onClick = _ref.onClick;
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
className: "form-control",
|
|
24
|
+
style: {
|
|
25
|
+
minWidth: 140,
|
|
26
|
+
textAlign: 'left'
|
|
27
|
+
},
|
|
28
|
+
onClick: onClick
|
|
29
|
+
}, value || 'mm/dd/yyyy');
|
|
30
|
+
};
|
|
31
|
+
var years = (0, _lodash.range)(2010, new Date().getFullYear() + 10, 1);
|
|
32
|
+
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(_reactDatepicker["default"], {
|
|
34
|
+
name: props.name,
|
|
35
|
+
ref: props.ref,
|
|
36
|
+
selected: selected,
|
|
37
|
+
onChange: function onChange(date) {
|
|
38
|
+
return _onChange(date);
|
|
39
|
+
},
|
|
40
|
+
todayButton: 'Today',
|
|
41
|
+
className: "form-control",
|
|
42
|
+
showTimeSelect: props.showTimeSelect,
|
|
43
|
+
showTimeSelectOnly: props.showTimeSelectOnly,
|
|
44
|
+
autoComplete: "off",
|
|
45
|
+
placeholderText: props.placeholderText,
|
|
46
|
+
portalId: portalId,
|
|
47
|
+
showTimeInput: showTimeInput,
|
|
48
|
+
dateFormat: dateFormat,
|
|
49
|
+
isClearable: isClearable,
|
|
50
|
+
customInput: /*#__PURE__*/_react["default"].createElement(ButtonDatePicker, null),
|
|
51
|
+
renderCustomHeader: function renderCustomHeader(_ref2) {
|
|
52
|
+
var date = _ref2.date,
|
|
53
|
+
changeYear = _ref2.changeYear,
|
|
54
|
+
changeMonth = _ref2.changeMonth,
|
|
55
|
+
decreaseMonth = _ref2.decreaseMonth,
|
|
56
|
+
increaseMonth = _ref2.increaseMonth,
|
|
57
|
+
prevMonthButtonDisabled = _ref2.prevMonthButtonDisabled,
|
|
58
|
+
nextMonthButtonDisabled = _ref2.nextMonthButtonDisabled;
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("button", {
|
|
60
|
+
onClick: decreaseMonth,
|
|
61
|
+
disabled: prevMonthButtonDisabled,
|
|
62
|
+
type: "button"
|
|
63
|
+
}, '<'), /*#__PURE__*/_react["default"].createElement("select", {
|
|
64
|
+
value: date.getFullYear(),
|
|
65
|
+
onChange: function onChange(_ref3) {
|
|
66
|
+
var value = _ref3.target.value;
|
|
67
|
+
return changeYear(value);
|
|
68
|
+
}
|
|
69
|
+
}, years.map(function (option) {
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement("option", {
|
|
71
|
+
key: option,
|
|
72
|
+
value: option
|
|
73
|
+
}, option);
|
|
74
|
+
})), /*#__PURE__*/_react["default"].createElement("select", {
|
|
75
|
+
value: months[date.getMonth()],
|
|
76
|
+
onChange: function onChange(_ref4) {
|
|
77
|
+
var value = _ref4.target.value;
|
|
78
|
+
return changeMonth(months.indexOf(value));
|
|
79
|
+
}
|
|
80
|
+
}, months.map(function (option) {
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement("option", {
|
|
82
|
+
key: option,
|
|
83
|
+
value: option
|
|
84
|
+
}, option);
|
|
85
|
+
})), /*#__PURE__*/_react["default"].createElement("button", {
|
|
86
|
+
onClick: increaseMonth,
|
|
87
|
+
disabled: nextMonthButtonDisabled,
|
|
88
|
+
type: "button"
|
|
89
|
+
}, '>'));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var _default = DatePickerComponent;
|
|
94
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-form-builder-more-flexibility",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "A complete form builder for react.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"file-saver": "^2.0.5",
|
|
39
39
|
"immutability-helper": "^3.1.1",
|
|
40
40
|
"isomorphic-fetch": "^3.0.0",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
41
42
|
"prop-types": "^15.7.2",
|
|
42
43
|
"react-bootstrap-slider": "^2.2.3",
|
|
43
44
|
"react-datepicker": "^3.4.1",
|
package/types/index.d.ts
CHANGED
|
@@ -135,6 +135,7 @@ export interface FormBuilderProps {
|
|
|
135
135
|
export class ReactFormBuilder extends React.Component<FormBuilderProps> {}
|
|
136
136
|
|
|
137
137
|
export interface FormGeneratorOnSubmitParams {
|
|
138
|
+
id: number;
|
|
138
139
|
name: string;
|
|
139
140
|
custom_name: string;
|
|
140
141
|
value: string | string[];
|
|
@@ -144,7 +145,9 @@ export interface FormGeneratorProps {
|
|
|
144
145
|
form_action: string;
|
|
145
146
|
form_method: string;
|
|
146
147
|
action_name?: string;
|
|
148
|
+
onBlur?: (info: FormGeneratorOnSubmitParams[]) => void;
|
|
147
149
|
onSubmit?: (info: FormGeneratorOnSubmitParams[]) => void;
|
|
150
|
+
onChange?: (info: FormGeneratorOnSubmitParams[]) => void;
|
|
148
151
|
data: any[];
|
|
149
152
|
back_action?: string;
|
|
150
153
|
back_name?: string;
|