envoc-form 2.0.1-1 → 2.0.1-13
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 +7 -7
- package/dist/css/envoc-form-styles.css +43 -5
- package/dist/css/envoc-form-styles.css.map +1 -1
- package/es/AddressInput/AddressInput.js +8 -7
- package/es/ConfirmBaseForm/ConfirmBaseForm.js +3 -2
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +3 -2
- package/es/DatePickerInput/DatePickerInput.js +3 -2
- package/es/FileInput/DefaultFileList.js +36 -0
- package/es/FileInput/DropzoneFileInput.js +58 -0
- package/es/FileInput/FileInput.js +31 -9
- package/es/FileInput/index.js +2 -1
- package/es/Form/Form.js +11 -33
- package/es/Form/FormBasedPreventNavigation.js +1 -1
- package/es/FormGroupWrapper.js +2 -1
- package/es/FormInput/FormInput.js +29 -10
- package/es/FormInputArray/FormInputArray.js +39 -24
- package/es/IconInput.js +2 -1
- package/es/ReactSelectField/ReactSelectField.js +6 -3
- package/es/SubmitFormButton.js +2 -1
- package/es/__Tests__/FormTestBase.js +5 -2
- package/es/normalizers.js +10 -5
- package/es/useStandardFormInput.js +4 -2
- package/es/utils/index.js +3 -0
- package/es/utils/objectContainsNonSerializableProperty.js +16 -0
- package/es/utils/objectToFormData.js +65 -0
- package/es/utils/typeChecks.js +25 -0
- package/lib/AddressInput/AddressInput.js +15 -9
- package/lib/ConfirmBaseForm/ConfirmBaseForm.js +4 -2
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +6 -4
- package/lib/DatePickerInput/DatePickerInput.js +4 -2
- package/lib/FileInput/DefaultFileList.js +47 -0
- package/lib/FileInput/DropzoneFileInput.js +75 -0
- package/lib/FileInput/FileInput.js +39 -10
- package/lib/FileInput/index.js +13 -3
- package/lib/Form/Form.js +19 -39
- package/lib/Form/FormBasedPreventNavigation.js +7 -3
- package/lib/FormGroupWrapper.js +3 -1
- package/lib/FormInput/FormInput.js +31 -11
- package/lib/FormInputArray/FormInputArray.js +47 -26
- package/lib/FormSection.js +5 -1
- package/lib/IconInput.js +3 -1
- package/lib/ReactSelectField/ReactSelectField.js +13 -5
- package/lib/ReactSelectField/index.js +6 -2
- package/lib/SubmitFormButton.js +3 -1
- package/lib/__Tests__/FormTestBase.js +6 -2
- package/lib/index.js +7 -3
- package/lib/normalizers.js +10 -5
- package/lib/useStandardFormInput.js +5 -2
- package/lib/utils/index.js +23 -0
- package/lib/utils/objectContainsNonSerializableProperty.js +24 -0
- package/lib/utils/objectToFormData.js +73 -0
- package/lib/utils/typeChecks.js +58 -0
- package/lib/validators/index.js +5 -1
- package/package.json +99 -90
- package/src/AddressInput/AddesssInput.test.js +23 -23
- package/src/AddressInput/AddressInput.js +73 -73
- package/src/AddressInput/UsStates.js +53 -53
- package/src/AddressInput/__snapshots__/AddesssInput.test.js.snap +207 -207
- package/src/AddressInput/index.js +2 -2
- package/src/BoolInput/BoolInput.js +7 -7
- package/src/BoolInput/BoolInput.test.js +23 -23
- package/src/BoolInput/InlineBoolInput.js +7 -7
- package/src/BoolInput/__snapshots__/BoolInput.test.js.snap +89 -89
- package/src/BoolInput/boolOptions.js +6 -6
- package/src/BoolInput/index.js +4 -4
- package/src/ConfirmBaseForm/ConfirmBaseForm.js +37 -37
- package/src/ConfirmBaseForm/ConfirmBaseForm.test.js +14 -14
- package/src/ConfirmBaseForm/__snapshots__/ConfirmBaseForm.test.js.snap +23 -23
- package/src/ConfirmBaseForm/index.js +1 -1
- package/src/ConfirmDeleteForm/ConfirmDeleteForm.js +39 -39
- package/src/ConfirmDeleteForm/ConfirmDeleteForm.test.js +24 -24
- package/src/ConfirmDeleteForm/__snapshots__/ConfirmDeleteForm.test.js.snap +25 -25
- package/src/ConfirmDeleteForm/index.js +1 -1
- package/src/DatePickerInput/DatePickerInput.js +46 -46
- package/src/DatePickerInput/DatePickerInput.test.js +74 -74
- package/src/DatePickerInput/__snapshots__/DatePickerInput.test.js.snap +134 -131
- package/src/DatePickerInput/date-picker-input.scss +42 -42
- package/src/DatePickerInput/index.js +3 -3
- package/src/ErrorScrollTarget.js +6 -6
- package/src/FileInput/DefaultFileList.js +39 -0
- package/src/FileInput/DropzoneFileInput.js +56 -0
- package/src/FileInput/DropzoneFileInput.test.js +24 -0
- package/src/FileInput/FileInput.js +77 -49
- package/src/FileInput/FileInput.test.js +24 -15
- package/src/FileInput/__snapshots__/DropzoneFileInput.test.js.snap +57 -0
- package/src/FileInput/__snapshots__/FileInput.test.js.snap +58 -22
- package/src/FileInput/file-input.scss +58 -17
- package/src/FileInput/index.js +4 -3
- package/src/Form/FocusError.js +48 -48
- package/src/Form/Form.js +139 -161
- package/src/Form/Form.test.js +23 -23
- package/src/Form/FormBasedPreventNavigation.js +25 -25
- package/src/Form/ServerErrorContext.js +7 -7
- package/src/Form/__snapshots__/Form.test.js.snap +9 -9
- package/src/Form/index.js +3 -3
- package/src/FormGroup.js +30 -30
- package/src/FormGroupWrapper.js +28 -28
- package/src/FormInput/FormInput.js +144 -136
- package/src/FormInput/FormInput.test.js +66 -66
- package/src/FormInput/__snapshots__/FormInput.test.js.snap +323 -313
- package/src/FormInput/form-input.scss +9 -9
- package/src/FormInput/index.js +2 -2
- package/src/FormInputArray/FormInputArray.js +224 -210
- package/src/FormInputArray/FormInputArray.test.js +108 -59
- package/src/FormInputArray/__snapshots__/FormInputArray.test.js.snap +52 -40
- package/src/FormInputArray/form-input-array.scss +13 -8
- package/src/FormInputArray/index.js +2 -2
- package/src/FormSection.js +13 -13
- package/src/IconInput.js +31 -31
- package/src/InlineFormInput/InlineFormInput.js +6 -6
- package/src/InlineFormInput/InlineFormInput.test.js +23 -23
- package/src/InlineFormInput/__snapshots__/InlineFormInput.test.js.snap +26 -26
- package/src/InlineFormInput/index.js +3 -3
- package/src/InlineFormInput/inline-form-input.scss +3 -3
- package/src/MoneyInput/InlineMoneyInput.js +7 -7
- package/src/MoneyInput/MoneyInput.js +7 -7
- package/src/MoneyInput/MoneyInputs.test.js +43 -43
- package/src/MoneyInput/__snapshots__/MoneyInputs.test.js.snap +81 -81
- package/src/MoneyInput/index.js +4 -4
- package/src/MoneyInput/money-input.scss +3 -3
- package/src/MoneyInput/moneyInputProps.js +12 -12
- package/src/NestedFormFieldContext.js +6 -6
- package/src/ReactSelectField/ReactSelectField.js +122 -120
- package/src/ReactSelectField/index.js +6 -6
- package/src/ReactSelectField/react-select-field.scss +5 -5
- package/src/StandardFormActions.js +27 -27
- package/src/SubmitFormButton.js +28 -28
- package/src/__Tests__/FormTestBase.js +14 -11
- package/src/__Tests__/IconInput.test.js +23 -23
- package/src/__Tests__/StandardFormActions.test.js +23 -23
- package/src/__Tests__/SubmitFormButton.test.js +23 -23
- package/src/__Tests__/__snapshots__/IconInput.test.js.snap +38 -38
- package/src/__Tests__/__snapshots__/StandardFormActions.test.js.snap +25 -25
- package/src/__Tests__/__snapshots__/SubmitFormButton.test.js.snap +18 -18
- package/src/__Tests__/index.js +2 -2
- package/src/_variables.scss +11 -11
- package/src/index.js +33 -33
- package/src/normalizers.js +42 -32
- package/src/selectors.js +3 -3
- package/src/styles.scss +7 -7
- package/src/useStandardFormInput.js +118 -118
- package/src/utils/index.js +3 -0
- package/src/utils/objectContainsNonSerializableProperty.js +15 -0
- package/src/utils/objectContainsNonSerializableProperty.test.js +49 -0
- package/src/utils/objectToFormData.js +89 -0
- package/src/utils/objectToFormData.test.js +76 -0
- package/src/utils/typeChecks.js +18 -0
- package/src/validators/index.js +2 -2
- package/src/validators/validators.js +93 -93
- package/src/validators/validators.test.js +79 -79
- package/CHANGELOG.json +0 -95
- package/CHANGELOG.md +0 -58
- package/es/FormInput/utilities.js +0 -71
- package/lib/FormInput/utilities.js +0 -86
- package/src/FormInput/utilities.js +0 -26
@@ -1,71 +0,0 @@
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
|
-
import lru from 'lru-cache';
|
5
|
-
import axios from 'axios'; // 500 options list max, each living no more than 5 minutes
|
6
|
-
|
7
|
-
var optionCache = new lru({
|
8
|
-
max: 500,
|
9
|
-
maxAge: 1000 * 60 * 5
|
10
|
-
});
|
11
|
-
export function loadOptionsData(_x, _x2) {
|
12
|
-
return _loadOptionsData.apply(this, arguments);
|
13
|
-
}
|
14
|
-
|
15
|
-
function _loadOptionsData() {
|
16
|
-
_loadOptionsData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(optionsUrl, cancelToken) {
|
17
|
-
var result, resp, newData;
|
18
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
19
|
-
while (1) {
|
20
|
-
switch (_context.prev = _context.next) {
|
21
|
-
case 0:
|
22
|
-
result = optionCache.get(optionsUrl);
|
23
|
-
|
24
|
-
if (!result) {
|
25
|
-
_context.next = 3;
|
26
|
-
break;
|
27
|
-
}
|
28
|
-
|
29
|
-
return _context.abrupt("return", result);
|
30
|
-
|
31
|
-
case 3:
|
32
|
-
_context.prev = 3;
|
33
|
-
_context.next = 6;
|
34
|
-
return axios.get(optionsUrl, {
|
35
|
-
hasLoadingMessage: true,
|
36
|
-
cancelToken: cancelToken.token
|
37
|
-
});
|
38
|
-
|
39
|
-
case 6:
|
40
|
-
resp = _context.sent;
|
41
|
-
newData = [{
|
42
|
-
key: null,
|
43
|
-
value: null
|
44
|
-
}].concat(_toConsumableArray(resp.data.result));
|
45
|
-
optionCache.set(optionsUrl, newData);
|
46
|
-
return _context.abrupt("return", newData);
|
47
|
-
|
48
|
-
case 12:
|
49
|
-
_context.prev = 12;
|
50
|
-
_context.t0 = _context["catch"](3);
|
51
|
-
|
52
|
-
if (!_context.t0.handled) {
|
53
|
-
_context.next = 16;
|
54
|
-
break;
|
55
|
-
}
|
56
|
-
|
57
|
-
return _context.abrupt("return", null);
|
58
|
-
|
59
|
-
case 16:
|
60
|
-
console.error(_context.t0);
|
61
|
-
return _context.abrupt("return", null);
|
62
|
-
|
63
|
-
case 18:
|
64
|
-
case "end":
|
65
|
-
return _context.stop();
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}, _callee, null, [[3, 12]]);
|
69
|
-
}));
|
70
|
-
return _loadOptionsData.apply(this, arguments);
|
71
|
-
}
|
@@ -1,86 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports.loadOptionsData = loadOptionsData;
|
9
|
-
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
11
|
-
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
13
|
-
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
15
|
-
|
16
|
-
var _lruCache = _interopRequireDefault(require("lru-cache"));
|
17
|
-
|
18
|
-
var _axios = _interopRequireDefault(require("axios"));
|
19
|
-
|
20
|
-
// 500 options list max, each living no more than 5 minutes
|
21
|
-
var optionCache = new _lruCache["default"]({
|
22
|
-
max: 500,
|
23
|
-
maxAge: 1000 * 60 * 5
|
24
|
-
});
|
25
|
-
|
26
|
-
function loadOptionsData(_x, _x2) {
|
27
|
-
return _loadOptionsData.apply(this, arguments);
|
28
|
-
}
|
29
|
-
|
30
|
-
function _loadOptionsData() {
|
31
|
-
_loadOptionsData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(optionsUrl, cancelToken) {
|
32
|
-
var result, resp, newData;
|
33
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
34
|
-
while (1) {
|
35
|
-
switch (_context.prev = _context.next) {
|
36
|
-
case 0:
|
37
|
-
result = optionCache.get(optionsUrl);
|
38
|
-
|
39
|
-
if (!result) {
|
40
|
-
_context.next = 3;
|
41
|
-
break;
|
42
|
-
}
|
43
|
-
|
44
|
-
return _context.abrupt("return", result);
|
45
|
-
|
46
|
-
case 3:
|
47
|
-
_context.prev = 3;
|
48
|
-
_context.next = 6;
|
49
|
-
return _axios["default"].get(optionsUrl, {
|
50
|
-
hasLoadingMessage: true,
|
51
|
-
cancelToken: cancelToken.token
|
52
|
-
});
|
53
|
-
|
54
|
-
case 6:
|
55
|
-
resp = _context.sent;
|
56
|
-
newData = [{
|
57
|
-
key: null,
|
58
|
-
value: null
|
59
|
-
}].concat((0, _toConsumableArray2["default"])(resp.data.result));
|
60
|
-
optionCache.set(optionsUrl, newData);
|
61
|
-
return _context.abrupt("return", newData);
|
62
|
-
|
63
|
-
case 12:
|
64
|
-
_context.prev = 12;
|
65
|
-
_context.t0 = _context["catch"](3);
|
66
|
-
|
67
|
-
if (!_context.t0.handled) {
|
68
|
-
_context.next = 16;
|
69
|
-
break;
|
70
|
-
}
|
71
|
-
|
72
|
-
return _context.abrupt("return", null);
|
73
|
-
|
74
|
-
case 16:
|
75
|
-
console.error(_context.t0);
|
76
|
-
return _context.abrupt("return", null);
|
77
|
-
|
78
|
-
case 18:
|
79
|
-
case "end":
|
80
|
-
return _context.stop();
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}, _callee, null, [[3, 12]]);
|
84
|
-
}));
|
85
|
-
return _loadOptionsData.apply(this, arguments);
|
86
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import lru from 'lru-cache';
|
2
|
-
import axios from 'axios';
|
3
|
-
|
4
|
-
// 500 options list max, each living no more than 5 minutes
|
5
|
-
const optionCache = new lru({ max: 500, maxAge: 1000 * 60 * 5 });
|
6
|
-
export async function loadOptionsData(optionsUrl, cancelToken) {
|
7
|
-
const result = optionCache.get(optionsUrl);
|
8
|
-
if (result) {
|
9
|
-
return result;
|
10
|
-
}
|
11
|
-
try {
|
12
|
-
const resp = await axios.get(optionsUrl, {
|
13
|
-
hasLoadingMessage: true,
|
14
|
-
cancelToken: cancelToken.token,
|
15
|
-
});
|
16
|
-
const newData = [{ key: null, value: null }, ...resp.data.result];
|
17
|
-
optionCache.set(optionsUrl, newData);
|
18
|
-
return newData;
|
19
|
-
} catch (e) {
|
20
|
-
if (e.handled) {
|
21
|
-
return null;
|
22
|
-
}
|
23
|
-
console.error(e);
|
24
|
-
return null;
|
25
|
-
}
|
26
|
-
}
|