@kineticdata/react 6.0.1 → 6.0.3
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/CHANGELOG.md +86 -0
- package/lib/apis/agent/adapters.js +2 -3
- package/lib/apis/agent/bridges.js +7 -13
- package/lib/apis/agent/handlers.js +7 -13
- package/lib/apis/core/activity.js +2 -3
- package/lib/apis/core/attributeDefinitions.js +6 -11
- package/lib/apis/core/attributeDefinitions.test.js +201 -213
- package/lib/apis/core/authentication.js +74 -84
- package/lib/apis/core/backgroundJobs.js +5 -9
- package/lib/apis/core/bridgeModelAttributeMappings.js +5 -10
- package/lib/apis/core/bridgeModelAttributes.js +6 -11
- package/lib/apis/core/bridgeModelMappings.js +5 -10
- package/lib/apis/core/bridgeModelQualificationMappings.js +5 -10
- package/lib/apis/core/bridgeModelQualifications.js +5 -10
- package/lib/apis/core/bridgeModels.js +7 -13
- package/lib/apis/core/bridgeModels.test.js +313 -333
- package/lib/apis/core/bridgedresources.js +7 -13
- package/lib/apis/core/categories.js +6 -11
- package/lib/apis/core/fileResources.js +5 -10
- package/lib/apis/core/filestores.js +5 -10
- package/lib/apis/core/formTypes.js +6 -11
- package/lib/apis/core/forms.js +6 -11
- package/lib/apis/core/forms.test.js +201 -213
- package/lib/apis/core/kapps.js +6 -11
- package/lib/apis/core/kapps.test.js +122 -130
- package/lib/apis/core/logs.js +3 -5
- package/lib/apis/core/memberships.js +3 -5
- package/lib/apis/core/meta.js +6 -11
- package/lib/apis/core/notices.js +2 -3
- package/lib/apis/core/oauthClients.js +6 -11
- package/lib/apis/core/platformComponents.js +10 -19
- package/lib/apis/core/platformItems.js +2 -3
- package/lib/apis/core/profile.js +3 -5
- package/lib/apis/core/securityPolicyDefinitions.js +6 -11
- package/lib/apis/core/securityPolicyDefinitions.test.js +254 -268
- package/lib/apis/core/space.js +3 -5
- package/lib/apis/core/space.test.js +106 -114
- package/lib/apis/core/submissions.js +19 -35
- package/lib/apis/core/teams.js +6 -11
- package/lib/apis/core/translations.js +18 -35
- package/lib/apis/core/translations.test.js +1343 -1437
- package/lib/apis/core/users.js +6 -11
- package/lib/apis/core/version.js +2 -3
- package/lib/apis/core/webApis.js +5 -10
- package/lib/apis/core/webhooks.js +6 -11
- package/lib/apis/core/webhooks.test.js +243 -257
- package/lib/apis/core/webhooksJobs.js +3 -5
- package/lib/apis/core/workflows.js +7 -13
- package/lib/apis/http.js +16 -31
- package/lib/apis/system/index.js +46 -91
- package/lib/apis/task/index.js +60 -119
- package/lib/components/agent/bridge/BridgeForm.js +1 -2
- package/lib/components/agent/bridge/BridgeTable.js +1 -2
- package/lib/components/agent/filestore/FilestoreForm.js +1 -2
- package/lib/components/agent/filestore/FilestoreTable.js +1 -2
- package/lib/components/agent/handler/AgentHandlerForm.js +1 -2
- package/lib/components/agent/handler/AgentHandlerTable.js +1 -2
- package/lib/components/common/AttributeSelect.js +2 -3
- package/lib/components/common/BridgeSelect.js +16 -17
- package/lib/components/common/ComponentConfigContext.js +1 -2
- package/lib/components/common/ContentEditable.js +23 -3
- package/lib/components/common/FormSelect.js +16 -17
- package/lib/components/common/NodeSelect.js +2 -3
- package/lib/components/common/Scroller.js +2 -3
- package/lib/components/common/StaticSelect.js +14 -15
- package/lib/components/common/TableInput.js +276 -63
- package/lib/components/common/TeamSelect.js +16 -17
- package/lib/components/common/ToastContainer.js +7 -12
- package/lib/components/common/Typeahead.js +15 -2
- package/lib/components/common/UserSelect.js +16 -17
- package/lib/components/common/authentication/AuthInterceptor.js +2 -3
- package/lib/components/common/authentication/AuthInterceptor.test.js +141 -153
- package/lib/components/common/authentication/AuthenticationContainer.js +332 -343
- package/lib/components/common/authentication/RequestInterceptor.js +2 -10
- package/lib/components/common/code_input/CodeInput.js +4 -9
- package/lib/components/common/code_input/draftHelpers.js +20 -37
- package/lib/components/common/code_input/languageHelpers.js +6 -12
- package/lib/components/common/code_input/languageHelpers.test.js +10 -8
- package/lib/components/common/defaults/Toast.js +1 -2
- package/lib/components/common/defaults/index.js +2 -3
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -2
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -2
- package/lib/components/core/bridge_model/BridgeModelForm.js +52 -55
- package/lib/components/core/bridge_model/BridgeModelTable.js +1 -2
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +1 -2
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +1 -2
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +1 -2
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +1 -2
- package/lib/components/core/category/CategoryForm.js +1 -2
- package/lib/components/core/category/CategoryTable.js +1 -2
- package/lib/components/core/core_form/CoreForm.js +11 -22
- package/lib/components/core/core_form/defaults/index.js +11 -19
- package/lib/components/core/core_form/globals.js +3 -5
- package/lib/components/core/field_definition/FieldDefinitionForm.js +1 -2
- package/lib/components/core/field_definition/FieldDefinitionTable.js +2 -4
- package/lib/components/core/file_resource/FileResourceForm.js +1 -2
- package/lib/components/core/file_resource/FileResourceTable.js +1 -2
- package/lib/components/core/form/FormForm.js +4 -4
- package/lib/components/core/form/FormTable.js +1 -2
- package/lib/components/core/form_type/FormTypeForm.js +1 -2
- package/lib/components/core/form_type/FormTypeTable.js +1 -2
- package/lib/components/core/i18n/I18n.js +2 -4
- package/lib/components/core/i18n/I18nContext.js +1 -2
- package/lib/components/core/i18n/I18nProvider.js +2 -3
- package/lib/components/core/i18n/Moment.js +10 -9
- package/lib/components/core/index_definition/IndexDefinitionForm.js +1 -2
- package/lib/components/core/index_definition/IndexDefinitionTable.js +1 -2
- package/lib/components/core/index_job/IndexJobTable.js +1 -2
- package/lib/components/core/kapp/KappForm.js +1 -2
- package/lib/components/core/kapp/KappTable.js +1 -2
- package/lib/components/core/log/LogTable.js +2 -4
- package/lib/components/core/oauth_client/OAuthClientForm.js +1 -2
- package/lib/components/core/oauth_client/OAuthClientTable.js +1 -2
- package/lib/components/core/platform_component/AgentComponentForm.js +1 -2
- package/lib/components/core/platform_component/AgentComponentTable.js +1 -2
- package/lib/components/core/platform_component/TaskComponentForm.js +1 -2
- package/lib/components/core/profile/ProfileForm.js +1 -2
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +3 -6
- package/lib/components/core/security_definition/SecurityDefinitionTable.js +1 -2
- package/lib/components/core/space/SpaceForm.js +1 -2
- package/lib/components/core/submission/DatastoreSubmissionFilters.js +3 -5
- package/lib/components/core/submission/DatastoreSubmissionTable.js +2 -4
- package/lib/components/core/submission/FormSubmissionFilters.js +4 -7
- package/lib/components/core/submission/FormSubmissionTable.js +2 -4
- package/lib/components/core/submission/KappSubmissionTable.js +2 -4
- package/lib/components/core/submission/SubmissionForm.js +1 -2
- package/lib/components/core/submission/SubmissionTable.js +2 -3
- package/lib/components/core/submission/helpers.js +4 -7
- package/lib/components/core/team/TeamForm.js +1 -2
- package/lib/components/core/team/TeamTable.js +1 -2
- package/lib/components/core/translation/ContextForm.js +1 -2
- package/lib/components/core/translation/ContextTable.js +1 -2
- package/lib/components/core/translation/EntryForm.js +1 -2
- package/lib/components/core/translation/EntryTable.js +1 -2
- package/lib/components/core/translation/LocaleForm.js +1 -2
- package/lib/components/core/translation/LocaleTable.js +1 -2
- package/lib/components/core/user/UserForm.js +1 -2
- package/lib/components/core/user/UserTable.js +1 -2
- package/lib/components/core/webapi/WebApiForm.js +97 -101
- package/lib/components/core/webapi/WebApiTable.js +1 -2
- package/lib/components/core/webhook/WebhookForm.js +1 -2
- package/lib/components/core/webhook/WebhookTable.js +1 -2
- package/lib/components/core/webhook_job/WebhookJobTable.js +1 -2
- package/lib/components/form/Form.helpers.js +10 -19
- package/lib/components/form/Form.js +312 -355
- package/lib/components/form/Form.models.js +6 -11
- package/lib/components/form/FormState.js +3 -3
- package/lib/components/form/KitchenSinkForm.js +23 -3
- package/lib/components/form/SimpleForm.helpers.js +262 -0
- package/lib/components/form/SimpleForm.js +462 -0
- package/lib/components/form/SimpleForm.models.js +62 -0
- package/lib/components/form/defaults/AttributesField.js +3 -4
- package/lib/components/form/defaults/CheckboxField.js +2 -3
- package/lib/components/form/defaults/CodeField.js +2 -3
- package/lib/components/form/defaults/FormButtons.js +2 -3
- package/lib/components/form/defaults/FormError.js +2 -3
- package/lib/components/form/defaults/FormField.js +2 -3
- package/lib/components/form/defaults/FormLayout.js +2 -3
- package/lib/components/form/defaults/FormMultiField.js +2 -3
- package/lib/components/form/defaults/PasswordField.js +2 -3
- package/lib/components/form/defaults/RadioField.js +2 -3
- package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +2 -3
- package/lib/components/form/defaults/SelectField.js +2 -3
- package/lib/components/form/defaults/SelectMultiField.js +2 -3
- package/lib/components/form/defaults/TableField.js +2 -3
- package/lib/components/form/defaults/TeamField.js +2 -3
- package/lib/components/form/defaults/TeamMultiField.js +2 -3
- package/lib/components/form/defaults/TextField.js +2 -3
- package/lib/components/form/defaults/TextMultiField.js +2 -3
- package/lib/components/form/defaults/UserField.js +2 -3
- package/lib/components/form/defaults/UserMultiField.js +2 -3
- package/lib/components/form/defaults/index.js +2 -3
- package/lib/components/form/tests/Form.test.js +4354 -4508
- package/lib/components/form/tests/components.js +73 -64
- package/lib/components/index.js +7 -0
- package/lib/components/system/SystemBackgroundTasksTable.js +1 -2
- package/lib/components/system/SystemCassandraForm.js +1 -2
- package/lib/components/system/SystemElasticSearchForm.js +1 -2
- package/lib/components/system/SystemFilestoreForm.js +2 -3
- package/lib/components/system/SystemForm.js +1 -2
- package/lib/components/system/SystemIngressForm.js +1 -2
- package/lib/components/system/SystemSecurityForm.js +1 -2
- package/lib/components/system/SystemSmtpForm.js +1 -2
- package/lib/components/system/SystemTaskAdapterForm.js +1 -2
- package/lib/components/system/SystemTrustedCertificateForm.js +1 -2
- package/lib/components/system/SystemTrustedCertificatesTable.js +1 -2
- package/lib/components/system/SystemUserForm.js +1 -2
- package/lib/components/system/helpers.js +11 -21
- package/lib/components/system/spaces/SystemSpaceForm.js +2 -3
- package/lib/components/system/spaces/SystemTenantForm.js +2 -3
- package/lib/components/system/spaces/SystemTenantTable.js +1 -2
- package/lib/components/table/Table.js +48 -51
- package/lib/components/table/Table.redux.js +161 -188
- package/lib/components/table/Table.test.js +115 -123
- package/lib/components/table/defaults/BodyCell.js +1 -2
- package/lib/components/table/defaults/BodyRow.js +1 -2
- package/lib/components/table/defaults/BooleanFilter.js +1 -2
- package/lib/components/table/defaults/ColumnControl.js +1 -2
- package/lib/components/table/defaults/EmptyBodyRow.js +1 -2
- package/lib/components/table/defaults/FilterLayout.js +1 -2
- package/lib/components/table/defaults/Footer.js +1 -2
- package/lib/components/table/defaults/FooterCell.js +1 -2
- package/lib/components/table/defaults/FooterRow.js +1 -2
- package/lib/components/table/defaults/Header.js +1 -2
- package/lib/components/table/defaults/HeaderCell.js +1 -2
- package/lib/components/table/defaults/HeaderRow.js +1 -2
- package/lib/components/table/defaults/PaginationControl.js +2 -4
- package/lib/components/table/defaults/TableBody.js +1 -2
- package/lib/components/table/defaults/TableLayout.js +1 -2
- package/lib/components/table/defaults/TextFilter.js +1 -2
- package/lib/components/table/defaults/index.js +2 -3
- package/lib/components/table/tests/Table.redux.test.js +162 -0
- package/lib/components/table/tests/Table.test.js +767 -0
- package/lib/components/table/tests/components.js +182 -0
- package/lib/components/task/builder/Connector.js +26 -11
- package/lib/components/task/builder/ConnectorForm.js +1 -2
- package/lib/components/task/builder/Node.js +18 -9
- package/lib/components/task/builder/NodeForm.js +1 -2
- package/lib/components/task/builder/NodeParametersForm.js +1 -2
- package/lib/components/task/builder/SvgCanvas.js +2 -3
- package/lib/components/task/builder/SvgText.js +2 -3
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +3 -6
- package/lib/components/task/builder/TreeBuilder.js +14 -5
- package/lib/components/task/builder/builder.redux.js +187 -186
- package/lib/components/task/builder/constants.js +38 -76
- package/lib/components/task/builder/helpers.js +23 -40
- package/lib/components/task/builder/models.js +24 -35
- package/lib/components/task/category/TaskCategoryForm.js +2 -3
- package/lib/components/task/category/TaskCategoryTable.js +1 -2
- package/lib/components/task/common/UsageTable.js +1 -2
- package/lib/components/task/engine/EngineSettingsForm.js +2 -3
- package/lib/components/task/errors/RunErrorTable.js +2 -3
- package/lib/components/task/errors/SystemErrorsTable.js +1 -2
- package/lib/components/task/handlers/HandlerForm.js +2 -3
- package/lib/components/task/handlers/HandlerTable.js +1 -2
- package/lib/components/task/handlers/MissingHandlerTable.js +1 -2
- package/lib/components/task/policy_rule/PolicyRuleForm.js +2 -3
- package/lib/components/task/policy_rule/PolicyRuleTable.js +1 -2
- package/lib/components/task/runs/CreateManualTriggerForm.js +1 -2
- package/lib/components/task/runs/RunTable.js +2 -3
- package/lib/components/task/runs/RunTaskTable.js +1 -2
- package/lib/components/task/sources/SourceForm.js +1 -2
- package/lib/components/task/sources/SourceTable.js +1 -2
- package/lib/components/task/triggers/TriggerTable.js +2 -3
- package/lib/components/task/workflows/LinkedWorkflowForm.js +3 -5
- package/lib/components/task/workflows/LinkedWorkflowTable.js +1 -2
- package/lib/components/task/workflows/MissingRoutineTable.js +1 -2
- package/lib/components/task/workflows/WorkflowForm.js +91 -41
- package/lib/components/task/workflows/WorkflowTable.js +1 -2
- package/lib/helpers/SearchBuilder.js +2 -4
- package/lib/helpers/index.js +13 -26
- package/lib/index.js +3 -6
- package/lib/reducer.js +3 -5
- package/lib/saga.js +32 -48
- package/lib/store.js +32 -42
- package/package.json +12 -15
- package/lib/components/core/CoreFormModal.js +0 -64
- package/lib/components/core/CoreModal.js +0 -114
|
@@ -28,14 +28,12 @@ var _Form = require("./Form.models");
|
|
|
28
28
|
var _Form2 = require("./Form.helpers");
|
|
29
29
|
var _excluded = ["components"];
|
|
30
30
|
var _marked = /*#__PURE__*/_regeneratorRuntime3().mark(runDataSource);
|
|
31
|
-
var getTimestamp = function getTimestamp() {
|
|
31
|
+
var getTimestamp = exports.getTimestamp = function getTimestamp() {
|
|
32
32
|
return Math.floor(new Date().getTime() / 1000);
|
|
33
33
|
};
|
|
34
|
-
exports.
|
|
35
|
-
var isEmpty = function isEmpty(value) {
|
|
34
|
+
var isEmpty = exports.isEmpty = function isEmpty(value) {
|
|
36
35
|
return value === null || value === undefined || value === false || value === '' || (0, _immutable.isImmutable)(value) && value.isEmpty();
|
|
37
36
|
};
|
|
38
|
-
exports.isEmpty = isEmpty;
|
|
39
37
|
var reinitializeFields = function reinitializeFields(fields) {
|
|
40
38
|
return fields.map(function (field) {
|
|
41
39
|
return field.merge({
|
|
@@ -54,15 +52,13 @@ var resetValues = function resetValues(fields) {
|
|
|
54
52
|
});
|
|
55
53
|
});
|
|
56
54
|
};
|
|
57
|
-
var checkRequired = function checkRequired(field) {
|
|
55
|
+
var checkRequired = exports.checkRequired = function checkRequired(field) {
|
|
58
56
|
return field.required && isEmpty(field.value) ? (0, _immutable.List)([field.requiredMessage]) : (0, _immutable.List)();
|
|
59
57
|
};
|
|
60
|
-
exports.
|
|
61
|
-
var checkPattern = function checkPattern(field) {
|
|
58
|
+
var checkPattern = exports.checkPattern = function checkPattern(field) {
|
|
62
59
|
return field.pattern && field.type === 'text' && field.value !== '' && !field.value.match(field.pattern) ? (0, _immutable.List)([field.patternMessage]) : (0, _immutable.List)();
|
|
63
60
|
};
|
|
64
|
-
exports.
|
|
65
|
-
var checkConstraint = function checkConstraint(bindings) {
|
|
61
|
+
var checkConstraint = exports.checkConstraint = function checkConstraint(bindings) {
|
|
66
62
|
return function (field) {
|
|
67
63
|
if (field.constraint) {
|
|
68
64
|
var result = field.constraint(bindings);
|
|
@@ -77,16 +73,14 @@ var checkConstraint = function checkConstraint(bindings) {
|
|
|
77
73
|
return (0, _immutable.List)();
|
|
78
74
|
};
|
|
79
75
|
};
|
|
80
|
-
exports.
|
|
81
|
-
var validateField = function validateField(bindings) {
|
|
76
|
+
var validateField = exports.validateField = function validateField(bindings) {
|
|
82
77
|
return function (field) {
|
|
83
78
|
return field.set('errors', (0, _immutable.List)([checkRequired, checkPattern, checkConstraint(bindings)]).flatMap(function (fn) {
|
|
84
79
|
return fn(field);
|
|
85
80
|
}));
|
|
86
81
|
};
|
|
87
82
|
};
|
|
88
|
-
exports.
|
|
89
|
-
var evaluateFieldProps = function evaluateFieldProps(bindings) {
|
|
83
|
+
var evaluateFieldProps = exports.evaluateFieldProps = function evaluateFieldProps(bindings) {
|
|
90
84
|
return function (field) {
|
|
91
85
|
return field.functions.filter(function (fn) {
|
|
92
86
|
return !!fn;
|
|
@@ -95,7 +89,6 @@ var evaluateFieldProps = function evaluateFieldProps(bindings) {
|
|
|
95
89
|
}, field);
|
|
96
90
|
};
|
|
97
91
|
};
|
|
98
|
-
exports.evaluateFieldProps = evaluateFieldProps;
|
|
99
92
|
var initializeFields = function initializeFields(formState) {
|
|
100
93
|
if (!formState.fields) {
|
|
101
94
|
var fields = (0, _Form2.resolveFieldConfig)(formState.formOptions, formState.bindings, formState.fieldsFn, formState.addFields, formState.alterFields);
|
|
@@ -211,7 +204,7 @@ var digest = function digest(formState) {
|
|
|
211
204
|
},
|
|
212
205
|
RESET: function RESET(state, _ref10) {
|
|
213
206
|
var formKey = _ref10.payload.formKey;
|
|
214
|
-
return state.
|
|
207
|
+
return !!state.getIn(['forms', formKey]) ? state.updateIn(['forms', formKey, 'fields'], resetValues).updateIn(['forms', formKey], digest) : state;
|
|
215
208
|
},
|
|
216
209
|
SUBMIT: function SUBMIT(state, _ref11) {
|
|
217
210
|
var _ref11$payload = _ref11.payload,
|
|
@@ -261,72 +254,66 @@ var selectDataSource = function selectDataSource(formKey, name) {
|
|
|
261
254
|
(0, _store.regSaga)('CHECK_ON_LOAD', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
|
262
255
|
var checkActions;
|
|
263
256
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
264
|
-
while (1) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
_context.next = 7;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
_context.next = 7;
|
|
287
|
-
return (0, _effects.call)(formState.onLoad, formState.bindings);
|
|
288
|
-
case 7:
|
|
289
|
-
_context.next = 12;
|
|
290
|
-
break;
|
|
291
|
-
case 9:
|
|
292
|
-
_context.prev = 9;
|
|
293
|
-
_context.t0 = _context["catch"](0);
|
|
294
|
-
console.error(_context.t0);
|
|
295
|
-
case 12:
|
|
296
|
-
case "end":
|
|
297
|
-
return _context.stop();
|
|
257
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
258
|
+
case 0:
|
|
259
|
+
checkActions = ['CONFIGURE_FORM', 'RESOLVE_DATA_SOURCE'];
|
|
260
|
+
_context2.next = 3;
|
|
261
|
+
return (0, _effects.takeEvery)(checkActions, function (_ref16) {
|
|
262
|
+
var formKey = _ref16.payload.formKey;
|
|
263
|
+
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
264
|
+
var formState;
|
|
265
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
266
|
+
while (1) switch (_context.prev = _context.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
_context.prev = 0;
|
|
269
|
+
_context.next = 3;
|
|
270
|
+
return (0, _effects.select)(selectForm(formKey));
|
|
271
|
+
case 3:
|
|
272
|
+
formState = _context.sent;
|
|
273
|
+
if (!(formState && formState.callOnLoad && typeof formState.onLoad === 'function')) {
|
|
274
|
+
_context.next = 7;
|
|
275
|
+
break;
|
|
298
276
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
277
|
+
_context.next = 7;
|
|
278
|
+
return (0, _effects.call)(formState.onLoad, formState.bindings);
|
|
279
|
+
case 7:
|
|
280
|
+
_context.next = 12;
|
|
281
|
+
break;
|
|
282
|
+
case 9:
|
|
283
|
+
_context.prev = 9;
|
|
284
|
+
_context.t0 = _context["catch"](0);
|
|
285
|
+
console.error(_context.t0);
|
|
286
|
+
case 12:
|
|
287
|
+
case "end":
|
|
288
|
+
return _context.stop();
|
|
289
|
+
}
|
|
290
|
+
}, _callee, null, [[0, 9]]);
|
|
291
|
+
})();
|
|
292
|
+
});
|
|
293
|
+
case 3:
|
|
294
|
+
case "end":
|
|
295
|
+
return _context2.stop();
|
|
307
296
|
}
|
|
308
297
|
}, _callee2);
|
|
309
298
|
}));
|
|
310
299
|
(0, _store.regSaga)((0, _effects.takeEvery)('CONFIGURE_FORM', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3(action) {
|
|
311
300
|
var formKey, _yield$select, dataSources;
|
|
312
301
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
|
313
|
-
while (1) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return (0, _effects.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
return _context3.stop();
|
|
329
|
-
}
|
|
302
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
303
|
+
case 0:
|
|
304
|
+
formKey = action.payload.formKey;
|
|
305
|
+
_context3.next = 3;
|
|
306
|
+
return (0, _effects.select)(selectForm(formKey));
|
|
307
|
+
case 3:
|
|
308
|
+
_yield$select = _context3.sent;
|
|
309
|
+
dataSources = _yield$select.dataSources;
|
|
310
|
+
_context3.next = 7;
|
|
311
|
+
return (0, _effects.all)(dataSources.map(function (ds, name) {
|
|
312
|
+
return (0, _effects.fork)(runDataSource, formKey, name, ds);
|
|
313
|
+
}).valueSeq().toArray());
|
|
314
|
+
case 7:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context3.stop();
|
|
330
317
|
}
|
|
331
318
|
}, _callee3);
|
|
332
319
|
})));
|
|
@@ -338,77 +325,75 @@ var selectDataSource = function selectDataSource(formKey, name) {
|
|
|
338
325
|
function runDataSource(formKey, name, dataSource) {
|
|
339
326
|
var params, paramsFn, prevParams, _yield$race, _yield$race2, checkAction, unmountAction, formState, _params, nextParams;
|
|
340
327
|
return (0, _regeneratorRuntime2["default"])().wrap(function runDataSource$(_context4) {
|
|
341
|
-
while (1) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if (!params) {
|
|
347
|
-
_context4.next = 5;
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
328
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
329
|
+
case 0:
|
|
330
|
+
params = dataSource.params, paramsFn = dataSource.paramsFn;
|
|
331
|
+
prevParams = (0, _immutable.fromJS)(params);
|
|
332
|
+
if (!params) {
|
|
350
333
|
_context4.next = 5;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
_context4.next =
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
_context4.next = 20;
|
|
384
|
-
return (0, _effects.select)(selectForm(formKey));
|
|
385
|
-
case 20:
|
|
386
|
-
formState = _context4.sent;
|
|
387
|
-
_params = formState.getIn(['dataSources', name, 'params']);
|
|
388
|
-
nextParams = (0, _immutable.fromJS)(_params);
|
|
389
|
-
if ((0, _immutable.is)(nextParams, prevParams)) {
|
|
390
|
-
_context4.next = 27;
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
prevParams = nextParams;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
_context4.next = 5;
|
|
337
|
+
return (0, _effects.put)((0, _store.action)('CALL_DATA_SOURCE', {
|
|
338
|
+
formKey: formKey,
|
|
339
|
+
name: name,
|
|
340
|
+
params: params
|
|
341
|
+
}));
|
|
342
|
+
case 5:
|
|
343
|
+
if (!paramsFn) {
|
|
344
|
+
_context4.next = 29;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case 6:
|
|
348
|
+
if (!true) {
|
|
349
|
+
_context4.next = 29;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
_context4.next = 9;
|
|
353
|
+
return (0, _effects.race)([(0, _effects.take)(['CONFIGURE_FORM', 'REJECT_DATA_SOURCE', 'RESET', 'RESOLVE_DATA_SOURCE', 'SET_VALUE', 'TOGGLE_MULTI_VALUE', 'SUBMIT_SUCCESS']), (0, _effects.take)('UNMOUNT_FORM')]);
|
|
354
|
+
case 9:
|
|
355
|
+
_yield$race = _context4.sent;
|
|
356
|
+
_yield$race2 = (0, _slicedToArray2["default"])(_yield$race, 2);
|
|
357
|
+
checkAction = _yield$race2[0];
|
|
358
|
+
unmountAction = _yield$race2[1];
|
|
359
|
+
if (!(unmountAction && unmountAction.payload.formKey === formKey)) {
|
|
360
|
+
_context4.next = 17;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
return _context4.abrupt("break", 29);
|
|
364
|
+
case 17:
|
|
365
|
+
if (!(checkAction && checkAction.payload.formKey === formKey)) {
|
|
394
366
|
_context4.next = 27;
|
|
395
|
-
return (0, _effects.put)(_params ? (0, _store.action)('CALL_DATA_SOURCE', {
|
|
396
|
-
formKey: formKey,
|
|
397
|
-
name: name,
|
|
398
|
-
params: _params
|
|
399
|
-
}) : (0, _store.action)('RESOLVE_DATA_SOURCE', {
|
|
400
|
-
formKey: formKey,
|
|
401
|
-
name: name,
|
|
402
|
-
data: null,
|
|
403
|
-
timestamp: null
|
|
404
|
-
}));
|
|
405
|
-
case 27:
|
|
406
|
-
_context4.next = 6;
|
|
407
367
|
break;
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
368
|
+
}
|
|
369
|
+
_context4.next = 20;
|
|
370
|
+
return (0, _effects.select)(selectForm(formKey));
|
|
371
|
+
case 20:
|
|
372
|
+
formState = _context4.sent;
|
|
373
|
+
_params = formState.getIn(['dataSources', name, 'params']);
|
|
374
|
+
nextParams = (0, _immutable.fromJS)(_params);
|
|
375
|
+
if ((0, _immutable.is)(nextParams, prevParams)) {
|
|
376
|
+
_context4.next = 27;
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
prevParams = nextParams;
|
|
380
|
+
_context4.next = 27;
|
|
381
|
+
return (0, _effects.put)(_params ? (0, _store.action)('CALL_DATA_SOURCE', {
|
|
382
|
+
formKey: formKey,
|
|
383
|
+
name: name,
|
|
384
|
+
params: _params
|
|
385
|
+
}) : (0, _store.action)('RESOLVE_DATA_SOURCE', {
|
|
386
|
+
formKey: formKey,
|
|
387
|
+
name: name,
|
|
388
|
+
data: null,
|
|
389
|
+
timestamp: null
|
|
390
|
+
}));
|
|
391
|
+
case 27:
|
|
392
|
+
_context4.next = 6;
|
|
393
|
+
break;
|
|
394
|
+
case 29:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context4.stop();
|
|
412
397
|
}
|
|
413
398
|
}, _marked);
|
|
414
399
|
}
|
|
@@ -420,100 +405,94 @@ function runDataSource(formKey, name, dataSource) {
|
|
|
420
405
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
|
421
406
|
var _yield$select2, fn, transform, data, timestamp;
|
|
422
407
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context5) {
|
|
423
|
-
while (1) {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return _context5.stop();
|
|
458
|
-
}
|
|
408
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
409
|
+
case 0:
|
|
410
|
+
_context5.prev = 0;
|
|
411
|
+
_context5.next = 3;
|
|
412
|
+
return (0, _effects.select)(selectDataSource(formKey, name));
|
|
413
|
+
case 3:
|
|
414
|
+
_yield$select2 = _context5.sent;
|
|
415
|
+
fn = _yield$select2.fn;
|
|
416
|
+
transform = _yield$select2.transform;
|
|
417
|
+
_context5.next = 8;
|
|
418
|
+
return _effects.call.apply(void 0, [fn].concat((0, _toConsumableArray2["default"])(params)));
|
|
419
|
+
case 8:
|
|
420
|
+
data = _context5.sent;
|
|
421
|
+
_context5.next = 11;
|
|
422
|
+
return (0, _effects.call)(getTimestamp);
|
|
423
|
+
case 11:
|
|
424
|
+
timestamp = _context5.sent;
|
|
425
|
+
_context5.next = 14;
|
|
426
|
+
return (0, _effects.put)((0, _store.action)('RESOLVE_DATA_SOURCE', {
|
|
427
|
+
formKey: formKey,
|
|
428
|
+
name: name,
|
|
429
|
+
data: transform ? transform(data) : data,
|
|
430
|
+
timestamp: timestamp
|
|
431
|
+
}));
|
|
432
|
+
case 14:
|
|
433
|
+
_context5.next = 19;
|
|
434
|
+
break;
|
|
435
|
+
case 16:
|
|
436
|
+
_context5.prev = 16;
|
|
437
|
+
_context5.t0 = _context5["catch"](0);
|
|
438
|
+
console.error(_context5.t0);
|
|
439
|
+
case 19:
|
|
440
|
+
case "end":
|
|
441
|
+
return _context5.stop();
|
|
459
442
|
}
|
|
460
443
|
}, _callee4, null, [[0, 16]]);
|
|
461
444
|
})();
|
|
462
445
|
}));
|
|
463
446
|
(0, _store.regSaga)('HANDLE_SET_VALUE', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee6() {
|
|
464
447
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee6$(_context7) {
|
|
465
|
-
while (1) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
_context6.next = 11;
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
_context6.next = 4;
|
|
486
|
-
return (0, _effects.select)(selectForm(formKey));
|
|
487
|
-
case 4:
|
|
488
|
-
_yield$select3 = _context6.sent;
|
|
489
|
-
bindings = _yield$select3.bindings;
|
|
490
|
-
fields = _yield$select3.fields;
|
|
491
|
-
_fields$get = fields.get(name), _onChange = _fields$get.onChange;
|
|
492
|
-
if (!_onChange) {
|
|
493
|
-
_context6.next = 11;
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
496
|
-
_context6.next = 11;
|
|
497
|
-
return (0, _effects.call)(_onChange, bindings, bindActions(formKey));
|
|
498
|
-
case 11:
|
|
499
|
-
_context6.next = 16;
|
|
500
|
-
break;
|
|
501
|
-
case 13:
|
|
502
|
-
_context6.prev = 13;
|
|
503
|
-
_context6.t0 = _context6["catch"](0);
|
|
504
|
-
console.error(_context6.t0);
|
|
505
|
-
case 16:
|
|
506
|
-
case "end":
|
|
507
|
-
return _context6.stop();
|
|
448
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
449
|
+
case 0:
|
|
450
|
+
_context7.next = 2;
|
|
451
|
+
return (0, _effects.takeEvery)(['SET_VALUE', 'TOGGLE_MULTI_VALUE'], function (_ref18) {
|
|
452
|
+
var _ref18$payload = _ref18.payload,
|
|
453
|
+
formKey = _ref18$payload.formKey,
|
|
454
|
+
name = _ref18$payload.name,
|
|
455
|
+
triggerChange = _ref18$payload.triggerChange;
|
|
456
|
+
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee5() {
|
|
457
|
+
var _yield$select3, bindings, fields, _fields$get, _onChange;
|
|
458
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context6) {
|
|
459
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
460
|
+
case 0:
|
|
461
|
+
_context6.prev = 0;
|
|
462
|
+
if (!triggerChange) {
|
|
463
|
+
_context6.next = 11;
|
|
464
|
+
break;
|
|
508
465
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
466
|
+
_context6.next = 4;
|
|
467
|
+
return (0, _effects.select)(selectForm(formKey));
|
|
468
|
+
case 4:
|
|
469
|
+
_yield$select3 = _context6.sent;
|
|
470
|
+
bindings = _yield$select3.bindings;
|
|
471
|
+
fields = _yield$select3.fields;
|
|
472
|
+
_fields$get = fields.get(name), _onChange = _fields$get.onChange;
|
|
473
|
+
if (!_onChange) {
|
|
474
|
+
_context6.next = 11;
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
_context6.next = 11;
|
|
478
|
+
return (0, _effects.call)(_onChange, bindings, bindActions(formKey));
|
|
479
|
+
case 11:
|
|
480
|
+
_context6.next = 16;
|
|
481
|
+
break;
|
|
482
|
+
case 13:
|
|
483
|
+
_context6.prev = 13;
|
|
484
|
+
_context6.t0 = _context6["catch"](0);
|
|
485
|
+
console.error(_context6.t0);
|
|
486
|
+
case 16:
|
|
487
|
+
case "end":
|
|
488
|
+
return _context6.stop();
|
|
489
|
+
}
|
|
490
|
+
}, _callee5, null, [[0, 13]]);
|
|
491
|
+
})();
|
|
492
|
+
});
|
|
493
|
+
case 2:
|
|
494
|
+
case "end":
|
|
495
|
+
return _context7.stop();
|
|
517
496
|
}
|
|
518
497
|
}, _callee6);
|
|
519
498
|
}));
|
|
@@ -521,15 +500,13 @@ function runDataSource(formKey, name, dataSource) {
|
|
|
521
500
|
var payload = _ref19.payload;
|
|
522
501
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee7() {
|
|
523
502
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee7$(_context8) {
|
|
524
|
-
while (1) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return _context8.stop();
|
|
532
|
-
}
|
|
503
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
504
|
+
case 0:
|
|
505
|
+
_context8.next = 2;
|
|
506
|
+
return (0, _effects.call)(console.error, 'REJECT_DATA_SOURCE', payload);
|
|
507
|
+
case 2:
|
|
508
|
+
case "end":
|
|
509
|
+
return _context8.stop();
|
|
533
510
|
}
|
|
534
511
|
}, _callee7);
|
|
535
512
|
})();
|
|
@@ -542,95 +519,93 @@ function runDataSource(formKey, name, dataSource) {
|
|
|
542
519
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee8() {
|
|
543
520
|
var _yield$select4, bindings, fields, _onSubmit, onSave, onError, computedFieldSet, values, errors, result;
|
|
544
521
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee8$(_context9) {
|
|
545
|
-
while (1) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
if (!onSave) {
|
|
583
|
-
_context9.next = 21;
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
522
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
523
|
+
case 0:
|
|
524
|
+
_context9.prev = 0;
|
|
525
|
+
_context9.next = 3;
|
|
526
|
+
return (0, _effects.select)(selectForm(formKey));
|
|
527
|
+
case 3:
|
|
528
|
+
_yield$select4 = _context9.sent;
|
|
529
|
+
bindings = _yield$select4.bindings;
|
|
530
|
+
fields = _yield$select4.fields;
|
|
531
|
+
_onSubmit = _yield$select4.onSubmit;
|
|
532
|
+
onSave = _yield$select4.onSave;
|
|
533
|
+
onError = _yield$select4.onError;
|
|
534
|
+
computedFieldSet = computeFieldSet(fields, fieldSet);
|
|
535
|
+
values = serializeImpl({
|
|
536
|
+
bindings: bindings,
|
|
537
|
+
fields: fields
|
|
538
|
+
}, fieldSet);
|
|
539
|
+
errors = fields.filter(function (field) {
|
|
540
|
+
return computedFieldSet.contains(field.name);
|
|
541
|
+
}).map(function (field) {
|
|
542
|
+
return field.errors;
|
|
543
|
+
}).filter(function (errors) {
|
|
544
|
+
return !errors.isEmpty();
|
|
545
|
+
});
|
|
546
|
+
if (!errors.isEmpty()) {
|
|
547
|
+
_context9.next = 32;
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
_context9.prev = 13;
|
|
551
|
+
_context9.next = 16;
|
|
552
|
+
return (0, _effects.call)(_onSubmit, values, bindings);
|
|
553
|
+
case 16:
|
|
554
|
+
result = _context9.sent;
|
|
555
|
+
(0, _store.dispatch)('SUBMIT_SUCCESS', {
|
|
556
|
+
formKey: formKey
|
|
557
|
+
});
|
|
558
|
+
if (!onSave) {
|
|
586
559
|
_context9.next = 21;
|
|
587
|
-
return (0, _effects.call)(onSave, result);
|
|
588
|
-
case 21:
|
|
589
|
-
_context9.next = 30;
|
|
590
560
|
break;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
561
|
+
}
|
|
562
|
+
_context9.next = 21;
|
|
563
|
+
return (0, _effects.call)(onSave, result);
|
|
564
|
+
case 21:
|
|
565
|
+
_context9.next = 30;
|
|
566
|
+
break;
|
|
567
|
+
case 23:
|
|
568
|
+
_context9.prev = 23;
|
|
569
|
+
_context9.t0 = _context9["catch"](13);
|
|
570
|
+
(0, _store.dispatch)('SUBMIT_ERROR', {
|
|
571
|
+
formKey: formKey,
|
|
572
|
+
error: typeof _context9.t0 === 'string' ? _context9.t0 : 'Unexpected error occurred'
|
|
573
|
+
});
|
|
574
|
+
if (typeof _context9.t0 !== 'string') {
|
|
575
|
+
console.error('Error handling form submit', _context9.t0);
|
|
576
|
+
}
|
|
577
|
+
if (!onError) {
|
|
605
578
|
_context9.next = 30;
|
|
606
|
-
return (0, _effects.call)(onError, _context9.t0);
|
|
607
|
-
case 30:
|
|
608
|
-
_context9.next = 34;
|
|
609
|
-
break;
|
|
610
|
-
case 32:
|
|
611
|
-
(0, _store.dispatch)('SUBMIT_FIELD_ERRORS', {
|
|
612
|
-
formKey: formKey,
|
|
613
|
-
fieldNames: errors.keySeq()
|
|
614
|
-
});
|
|
615
|
-
if ((0, _lodashEs.isFunction)(onInvalid)) {
|
|
616
|
-
onInvalid(errors);
|
|
617
|
-
}
|
|
618
|
-
case 34:
|
|
619
|
-
_context9.next = 39;
|
|
620
579
|
break;
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
580
|
+
}
|
|
581
|
+
_context9.next = 30;
|
|
582
|
+
return (0, _effects.call)(onError, _context9.t0);
|
|
583
|
+
case 30:
|
|
584
|
+
_context9.next = 34;
|
|
585
|
+
break;
|
|
586
|
+
case 32:
|
|
587
|
+
(0, _store.dispatch)('SUBMIT_FIELD_ERRORS', {
|
|
588
|
+
formKey: formKey,
|
|
589
|
+
fieldNames: errors.keySeq()
|
|
590
|
+
});
|
|
591
|
+
if ((0, _lodashEs.isFunction)(onInvalid)) {
|
|
592
|
+
onInvalid(errors);
|
|
593
|
+
}
|
|
594
|
+
case 34:
|
|
595
|
+
_context9.next = 39;
|
|
596
|
+
break;
|
|
597
|
+
case 36:
|
|
598
|
+
_context9.prev = 36;
|
|
599
|
+
_context9.t1 = _context9["catch"](0);
|
|
600
|
+
console.error(_context9.t1);
|
|
601
|
+
case 39:
|
|
602
|
+
case "end":
|
|
603
|
+
return _context9.stop();
|
|
629
604
|
}
|
|
630
605
|
}, _callee8, null, [[0, 36], [13, 23]]);
|
|
631
606
|
})();
|
|
632
607
|
}));
|
|
633
|
-
var setValue = function setValue(formKey, name, value) {
|
|
608
|
+
var setValue = exports.setValue = function setValue(formKey, name, value) {
|
|
634
609
|
var triggerChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
635
610
|
(0, _store.dispatch)('SET_VALUE', {
|
|
636
611
|
formKey: formKey,
|
|
@@ -639,8 +614,7 @@ var setValue = function setValue(formKey, name, value) {
|
|
|
639
614
|
triggerChange: triggerChange
|
|
640
615
|
});
|
|
641
616
|
};
|
|
642
|
-
exports.
|
|
643
|
-
var toggleMultiValue = function toggleMultiValue(formKey, name, value) {
|
|
617
|
+
var toggleMultiValue = exports.toggleMultiValue = function toggleMultiValue(formKey, name, value) {
|
|
644
618
|
var triggerChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
645
619
|
(0, _store.dispatch)('TOGGLE_MULTI_VALUE', {
|
|
646
620
|
formKey: formKey,
|
|
@@ -649,7 +623,6 @@ var toggleMultiValue = function toggleMultiValue(formKey, name, value) {
|
|
|
649
623
|
triggerChange: triggerChange
|
|
650
624
|
});
|
|
651
625
|
};
|
|
652
|
-
exports.toggleMultiValue = toggleMultiValue;
|
|
653
626
|
var actions = {
|
|
654
627
|
setValue: function setValue(formKey) {
|
|
655
628
|
return function (name, value) {
|
|
@@ -682,7 +655,7 @@ var bindActions = function bindActions(formKey) {
|
|
|
682
655
|
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, acc), {}, (0, _defineProperty2["default"])({}, name, fn(formKey)));
|
|
683
656
|
}, {});
|
|
684
657
|
};
|
|
685
|
-
var onFocus = function onFocus(_ref23) {
|
|
658
|
+
var onFocus = exports.onFocus = function onFocus(_ref23) {
|
|
686
659
|
var formKey = _ref23.formKey,
|
|
687
660
|
name = _ref23.name;
|
|
688
661
|
return function () {
|
|
@@ -692,8 +665,7 @@ var onFocus = function onFocus(_ref23) {
|
|
|
692
665
|
});
|
|
693
666
|
};
|
|
694
667
|
};
|
|
695
|
-
exports.
|
|
696
|
-
var onBlur = function onBlur(_ref24) {
|
|
668
|
+
var onBlur = exports.onBlur = function onBlur(_ref24) {
|
|
697
669
|
var formKey = _ref24.formKey,
|
|
698
670
|
name = _ref24.name;
|
|
699
671
|
return function () {
|
|
@@ -703,9 +675,8 @@ var onBlur = function onBlur(_ref24) {
|
|
|
703
675
|
});
|
|
704
676
|
};
|
|
705
677
|
};
|
|
706
|
-
exports.onBlur = onBlur;
|
|
707
678
|
var LIST_VALUE_TYPES = ['checkbox-multi'];
|
|
708
|
-
var onChange = function onChange(_ref25) {
|
|
679
|
+
var onChange = exports.onChange = function onChange(_ref25) {
|
|
709
680
|
var formKey = _ref25.formKey,
|
|
710
681
|
type = _ref25.type,
|
|
711
682
|
name = _ref25.name;
|
|
@@ -733,8 +704,7 @@ var onChange = function onChange(_ref25) {
|
|
|
733
704
|
}
|
|
734
705
|
};
|
|
735
706
|
};
|
|
736
|
-
exports.
|
|
737
|
-
var onSubmit = function onSubmit(formKey, fieldSet) {
|
|
707
|
+
var onSubmit = exports.onSubmit = function onSubmit(formKey, fieldSet) {
|
|
738
708
|
return function (event) {
|
|
739
709
|
event && event.preventDefault && event.preventDefault();
|
|
740
710
|
(0, _store.dispatch)('SUBMIT', {
|
|
@@ -743,51 +713,43 @@ var onSubmit = function onSubmit(formKey, fieldSet) {
|
|
|
743
713
|
});
|
|
744
714
|
};
|
|
745
715
|
};
|
|
746
|
-
exports.
|
|
747
|
-
var onReset = function onReset(formKey) {
|
|
716
|
+
var onReset = exports.onReset = function onReset(formKey) {
|
|
748
717
|
return function () {
|
|
749
718
|
return resetForm(formKey);
|
|
750
719
|
};
|
|
751
720
|
};
|
|
752
|
-
exports.
|
|
753
|
-
var clearError = function clearError(formKey) {
|
|
721
|
+
var clearError = exports.clearError = function clearError(formKey) {
|
|
754
722
|
return function (event) {
|
|
755
723
|
(0, _store.dispatch)('CLEAR_ERROR', {
|
|
756
724
|
formKey: formKey
|
|
757
725
|
});
|
|
758
726
|
};
|
|
759
727
|
};
|
|
760
|
-
exports.
|
|
761
|
-
var mountForm = function mountForm(formKey) {
|
|
728
|
+
var mountForm = exports.mountForm = function mountForm(formKey) {
|
|
762
729
|
return (0, _store.dispatch)('MOUNT_FORM', {
|
|
763
730
|
formKey: formKey
|
|
764
731
|
});
|
|
765
732
|
};
|
|
766
|
-
exports.
|
|
767
|
-
var unmountForm = function unmountForm(formKey) {
|
|
733
|
+
var unmountForm = exports.unmountForm = function unmountForm(formKey) {
|
|
768
734
|
return (0, _store.dispatch)('UNMOUNT_FORM', {
|
|
769
735
|
formKey: formKey
|
|
770
736
|
});
|
|
771
737
|
};
|
|
772
|
-
exports.
|
|
773
|
-
var resetForm = function resetForm(formKey) {
|
|
738
|
+
var resetForm = exports.resetForm = function resetForm(formKey) {
|
|
774
739
|
return (0, _store.dispatch)('RESET', {
|
|
775
740
|
formKey: formKey
|
|
776
741
|
});
|
|
777
742
|
};
|
|
778
|
-
exports.
|
|
779
|
-
var reloadDataSource = function reloadDataSource(formKey, name) {
|
|
743
|
+
var reloadDataSource = exports.reloadDataSource = function reloadDataSource(formKey, name) {
|
|
780
744
|
return (0, _store.dispatch)('CALL_DATA_SOURCE', {
|
|
781
745
|
formKey: formKey,
|
|
782
746
|
name: name
|
|
783
747
|
});
|
|
784
748
|
};
|
|
785
|
-
exports.
|
|
786
|
-
var configureForm = function configureForm(config) {
|
|
749
|
+
var configureForm = exports.configureForm = function configureForm(config) {
|
|
787
750
|
return (0, _store.dispatch)('CONFIGURE_FORM', config);
|
|
788
751
|
};
|
|
789
|
-
exports.
|
|
790
|
-
var submitForm = function submitForm(formKey, _ref26) {
|
|
752
|
+
var submitForm = exports.submitForm = function submitForm(formKey, _ref26) {
|
|
791
753
|
var fieldSet = _ref26.fieldSet,
|
|
792
754
|
onInvalid = _ref26.onInvalid,
|
|
793
755
|
values = _ref26.values;
|
|
@@ -798,13 +760,11 @@ var submitForm = function submitForm(formKey, _ref26) {
|
|
|
798
760
|
values: values
|
|
799
761
|
});
|
|
800
762
|
};
|
|
801
|
-
exports.
|
|
802
|
-
var serializeForm = function serializeForm(formKey) {
|
|
763
|
+
var serializeForm = exports.serializeForm = function serializeForm(formKey) {
|
|
803
764
|
var _ref27 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
804
765
|
fieldSet = _ref27.fieldSet;
|
|
805
766
|
return serializeImpl(selectForm(formKey)(_store.store.getState()), fieldSet);
|
|
806
767
|
};
|
|
807
|
-
exports.serializeForm = serializeForm;
|
|
808
768
|
var serializeImpl = function serializeImpl(_ref28, fieldSet) {
|
|
809
769
|
var bindings = _ref28.bindings,
|
|
810
770
|
fields = _ref28.fields;
|
|
@@ -827,7 +787,7 @@ var serializeImpl = function serializeImpl(_ref28, fieldSet) {
|
|
|
827
787
|
/**
|
|
828
788
|
* @component
|
|
829
789
|
*/
|
|
830
|
-
var Form = /*#__PURE__*/function (_Component) {
|
|
790
|
+
var Form = exports.Form = /*#__PURE__*/function (_Component) {
|
|
831
791
|
(0, _inherits2["default"])(Form, _Component);
|
|
832
792
|
var _super = (0, _createSuper2["default"])(Form);
|
|
833
793
|
function Form(props) {
|
|
@@ -871,7 +831,6 @@ var Form = /*#__PURE__*/function (_Component) {
|
|
|
871
831
|
}]);
|
|
872
832
|
return Form;
|
|
873
833
|
}(_react.Component);
|
|
874
|
-
exports.Form = Form;
|
|
875
834
|
var computeFieldSet = function computeFieldSet(fields, fieldSetProp) {
|
|
876
835
|
var defaultFieldSet = (0, _immutable.OrderedSet)(fields.keySeq());
|
|
877
836
|
return (0, _immutable.OrderedSet)(!fieldSetProp ? defaultFieldSet : typeof fieldSetProp === 'function' ? fieldSetProp(defaultFieldSet) : fieldSetProp);
|
|
@@ -1012,14 +971,13 @@ var FormImplComponent = /*#__PURE__*/function (_Component2) {
|
|
|
1012
971
|
}]);
|
|
1013
972
|
return FormImplComponent;
|
|
1014
973
|
}(_react.Component);
|
|
1015
|
-
var mapStateToProps = function mapStateToProps(state, props) {
|
|
974
|
+
var mapStateToProps = exports.mapStateToProps = function mapStateToProps(state, props) {
|
|
1016
975
|
return {
|
|
1017
976
|
formState: selectForm(props.formKey)(state)
|
|
1018
977
|
};
|
|
1019
978
|
};
|
|
1020
|
-
exports.mapStateToProps = mapStateToProps;
|
|
1021
979
|
var FormImpl = (0, _store.connect)(mapStateToProps)(FormImplComponent);
|
|
1022
|
-
var generateForm = function generateForm(_ref31) {
|
|
980
|
+
var generateForm = exports.generateForm = function generateForm(_ref31) {
|
|
1023
981
|
var dataSources = _ref31.dataSources,
|
|
1024
982
|
fields = _ref31.fields,
|
|
1025
983
|
handleSubmit = _ref31.handleSubmit,
|
|
@@ -1044,5 +1002,4 @@ var generateForm = function generateForm(_ref31) {
|
|
|
1044
1002
|
readOnly: configurationProps.readOnly
|
|
1045
1003
|
}, configurationProps.children);
|
|
1046
1004
|
};
|
|
1047
|
-
};
|
|
1048
|
-
exports.generateForm = generateForm;
|
|
1005
|
+
};
|