@kineticdata/react 5.1.2 → 6.0.0
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/assets/task/icons/drag-handle.svg +3 -0
- package/assets/task/icons/plus_small.svg +2 -4
- package/lib/apis/agent/adapters.js +16 -12
- package/lib/apis/agent/bridges.js +54 -41
- package/lib/apis/agent/handlers.js +51 -38
- package/lib/apis/core/activity.js +19 -11
- package/lib/apis/core/attributeDefinitions.js +54 -46
- package/lib/apis/core/attributeDefinitions.test.js +47 -55
- package/lib/apis/core/authentication.js +58 -63
- package/lib/apis/core/backgroundJobs.js +38 -30
- package/lib/apis/core/bridgeModelAttributeMappings.js +42 -34
- package/lib/apis/core/bridgeModelAttributes.js +47 -37
- package/lib/apis/core/bridgeModelMappings.js +42 -34
- package/lib/apis/core/bridgeModelQualificationMappings.js +42 -34
- package/lib/apis/core/bridgeModelQualifications.js +42 -34
- package/lib/apis/core/bridgeModels.js +56 -46
- package/lib/apis/core/bridgeModels.test.js +64 -80
- package/lib/apis/core/bridgedresources.js +64 -72
- package/lib/apis/core/bridgedresources.test.js +33 -30
- package/lib/apis/core/categories.js +59 -52
- package/lib/apis/core/categories.test.js +36 -33
- package/lib/apis/core/fileResources.js +41 -33
- package/lib/apis/core/filestores.js +42 -34
- package/lib/apis/core/formTypes.js +50 -44
- package/lib/apis/core/forms.js +53 -49
- package/lib/apis/core/forms.test.js +60 -74
- package/lib/apis/core/kapps.js +45 -39
- package/lib/apis/core/kapps.test.js +45 -52
- package/lib/apis/core/logs.js +20 -16
- package/lib/apis/core/memberships.js +23 -20
- package/lib/apis/core/meta.js +31 -19
- package/lib/apis/core/notices.js +17 -9
- package/lib/apis/core/oauthClients.js +49 -45
- package/lib/apis/core/platformComponents.js +73 -57
- package/lib/apis/core/platformItems.js +22 -13
- package/lib/apis/core/profile.js +28 -21
- package/lib/apis/core/profile.test.js +20 -17
- package/lib/apis/core/securityPolicyDefinitions.js +48 -41
- package/lib/apis/core/securityPolicyDefinitions.test.js +50 -60
- package/lib/apis/core/space.js +23 -16
- package/lib/apis/core/space.test.js +31 -38
- package/lib/apis/core/submissions.js +213 -186
- package/lib/apis/core/submissions.test.js +39 -36
- package/lib/apis/core/teams.js +51 -44
- package/lib/apis/core/teams.test.js +42 -39
- package/lib/apis/core/translations.js +123 -130
- package/lib/apis/core/translations.test.js +278 -368
- package/lib/apis/core/users.js +56 -49
- package/lib/apis/core/users.test.js +42 -39
- package/lib/apis/core/version.js +20 -11
- package/lib/apis/core/webApis.js +42 -34
- package/lib/apis/core/webhooks.js +48 -41
- package/lib/apis/core/webhooks.test.js +50 -60
- package/lib/apis/core/webhooksJobs.js +30 -26
- package/lib/apis/core/workflows.js +52 -44
- package/lib/apis/http.js +89 -80
- package/lib/apis/http.test.js +37 -38
- package/lib/apis/index.js +506 -50
- package/lib/apis/system/index.js +228 -211
- package/lib/apis/task/index.js +280 -227
- package/lib/components/agent/bridge/BridgeForm.js +50 -50
- package/lib/components/agent/bridge/BridgeTable.js +12 -8
- package/lib/components/agent/filestore/FilestoreForm.js +49 -48
- package/lib/components/agent/filestore/FilestoreTable.js +12 -8
- package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
- package/lib/components/agent/handler/AgentHandlerTable.js +12 -8
- package/lib/components/common/AttributeSelect.js +15 -9
- package/lib/components/common/BridgeSelect.js +48 -43
- package/lib/components/common/ComponentConfigContext.js +9 -2
- package/lib/components/common/ContentEditable.js +36 -60
- package/lib/components/common/FormSelect.js +70 -58
- package/lib/components/common/NodeSelect.js +23 -19
- package/lib/components/common/Scroller.js +24 -23
- package/lib/components/common/StaticSelect.js +57 -50
- package/lib/components/common/TableInput.js +54 -57
- package/lib/components/common/TeamSelect.js +42 -39
- package/lib/components/common/Typeahead.js +121 -138
- package/lib/components/common/UserSelect.js +42 -41
- package/lib/components/common/authentication/AuthInterceptor.js +15 -19
- package/lib/components/common/authentication/AuthInterceptor.test.js +46 -64
- package/lib/components/common/authentication/AuthenticationContainer.js +350 -454
- package/lib/components/common/authentication/RequestInterceptor.js +16 -19
- package/lib/components/common/code_input/CodeInput.js +92 -122
- package/lib/components/common/code_input/draftHelpers.js +96 -90
- package/lib/components/common/code_input/languageHelpers.js +49 -47
- package/lib/components/common/code_input/languageHelpers.test.js +21 -16
- package/lib/components/core/CoreFormModal.js +26 -24
- package/lib/components/core/CoreModal.js +37 -31
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +24 -23
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +18 -15
- package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
- package/lib/components/core/bridge_model/BridgeModelTable.js +12 -8
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +17 -16
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +25 -21
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +20 -20
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +27 -22
- package/lib/components/core/category/CategoryForm.js +22 -22
- package/lib/components/core/category/CategoryTable.js +15 -10
- package/lib/components/core/core_form/CoreForm.js +209 -285
- package/lib/components/core/core_form/CoreForm.test.js +12 -10
- package/lib/components/core/core_form/defaults/index.js +52 -44
- package/lib/components/core/core_form/globals.js +14 -5
- package/lib/components/core/field_definition/FieldDefinitionForm.js +23 -21
- package/lib/components/core/field_definition/FieldDefinitionTable.js +15 -10
- package/lib/components/core/file_resource/FileResourceForm.js +38 -37
- package/lib/components/core/file_resource/FileResourceTable.js +16 -12
- package/lib/components/core/form/FormForm.js +56 -61
- package/lib/components/core/form/FormTable.js +25 -22
- package/lib/components/core/form_type/FormTypeForm.js +14 -13
- package/lib/components/core/form_type/FormTypeTable.js +12 -8
- package/lib/components/core/i18n/I18n.js +54 -61
- package/lib/components/core/i18n/I18nContext.js +9 -2
- package/lib/components/core/i18n/I18nProvider.js +40 -43
- package/lib/components/core/i18n/Moment.js +40 -50
- package/lib/components/core/index_definition/IndexDefinitionForm.js +23 -24
- package/lib/components/core/index_definition/IndexDefinitionTable.js +19 -11
- package/lib/components/core/index_job/IndexJobTable.js +20 -15
- package/lib/components/core/kapp/KappForm.js +57 -58
- package/lib/components/core/kapp/KappTable.js +17 -12
- package/lib/components/core/log/LogTable.js +35 -33
- package/lib/components/core/oauth_client/OAuthClientForm.js +17 -17
- package/lib/components/core/oauth_client/OAuthClientTable.js +12 -8
- package/lib/components/core/platform_component/AgentComponentForm.js +15 -15
- package/lib/components/core/platform_component/AgentComponentTable.js +10 -5
- package/lib/components/core/platform_component/TaskComponentForm.js +14 -14
- package/lib/components/core/profile/ProfileForm.js +40 -39
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +28 -25
- package/lib/components/core/security_definition/SecurityDefinitionTable.js +18 -13
- package/lib/components/core/space/SpaceForm.js +79 -90
- package/lib/components/core/submission/DatastoreSubmissionFilters.js +39 -40
- package/lib/components/core/submission/DatastoreSubmissionTable.js +37 -34
- package/lib/components/core/submission/FormSubmissionFilters.js +79 -75
- package/lib/components/core/submission/FormSubmissionTable.js +27 -20
- package/lib/components/core/submission/KappSubmissionTable.js +30 -29
- package/lib/components/core/submission/SubmissionForm.js +126 -55
- package/lib/components/core/submission/SubmissionTable.js +24 -20
- package/lib/components/core/submission/helpers.js +37 -33
- package/lib/components/core/submission/helpers.test.js +69 -20
- package/lib/components/core/team/TeamForm.js +24 -21
- package/lib/components/core/team/TeamTable.js +16 -11
- package/lib/components/core/translation/ContextForm.js +13 -10
- package/lib/components/core/translation/ContextTable.js +13 -10
- package/lib/components/core/translation/EntryForm.js +27 -24
- package/lib/components/core/translation/EntryTable.js +19 -16
- package/lib/components/core/translation/LocaleForm.js +16 -13
- package/lib/components/core/translation/LocaleTable.js +12 -8
- package/lib/components/core/user/UserForm.js +38 -37
- package/lib/components/core/user/UserTable.js +19 -15
- package/lib/components/core/webapi/WebApiForm.js +49 -61
- package/lib/components/core/webapi/WebApiTable.js +14 -10
- package/lib/components/core/webhook/WebhookForm.js +33 -32
- package/lib/components/core/webhook/WebhookTable.js +22 -20
- package/lib/components/core/webhook_job/WebhookJobTable.js +19 -16
- package/lib/components/form/Form.helpers.js +102 -90
- package/lib/components/form/Form.js +467 -524
- package/lib/components/form/Form.models.js +38 -24
- package/lib/components/form/FormState.js +8 -5
- package/lib/components/form/KitchenSinkForm.js +135 -4
- package/lib/components/form/defaults/AttributesField.js +48 -59
- package/lib/components/form/defaults/CheckboxField.js +14 -6
- package/lib/components/form/defaults/CodeField.js +15 -7
- package/lib/components/form/defaults/FormButtons.js +12 -4
- package/lib/components/form/defaults/FormError.js +12 -4
- package/lib/components/form/defaults/FormField.js +15 -7
- package/lib/components/form/defaults/FormLayout.js +12 -4
- package/lib/components/form/defaults/FormMultiField.js +15 -7
- package/lib/components/form/defaults/PasswordField.js +14 -6
- package/lib/components/form/defaults/RadioField.js +15 -7
- package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +17 -9
- package/lib/components/form/defaults/SelectField.js +16 -8
- package/lib/components/form/defaults/SelectMultiField.js +15 -7
- package/lib/components/form/defaults/TableField.js +14 -6
- package/lib/components/form/defaults/TeamField.js +15 -7
- package/lib/components/form/defaults/TeamMultiField.js +15 -7
- package/lib/components/form/defaults/TextField.js +14 -6
- package/lib/components/form/defaults/TextMultiField.js +26 -28
- package/lib/components/form/defaults/UserField.js +15 -7
- package/lib/components/form/defaults/UserMultiField.js +15 -7
- package/lib/components/form/defaults/index.js +48 -41
- package/lib/components/form/tests/Form.test.js +568 -864
- package/lib/components/form/tests/components.js +15 -25
- package/lib/components/form/tests/helpers.test.js +35 -33
- package/lib/components/index.js +981 -135
- package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
- package/lib/components/system/SystemFilestoreForm.js +28 -25
- package/lib/components/system/SystemForm.js +19 -16
- package/lib/components/system/SystemIngressForm.js +10 -9
- package/lib/components/system/SystemSecurityForm.js +17 -14
- package/lib/components/system/SystemSmtpForm.js +13 -13
- package/lib/components/system/SystemTaskAdapterForm.js +21 -17
- package/lib/components/system/SystemUserForm.js +15 -14
- package/lib/components/system/helpers.js +62 -60
- package/lib/components/system/helpers.test.js +16 -12
- package/lib/components/system/spaces/SystemSpaceForm.js +25 -24
- package/lib/components/system/spaces/SystemTenantForm.js +43 -40
- package/lib/components/system/spaces/SystemTenantTable.js +12 -8
- package/lib/components/table/Table.js +211 -224
- package/lib/components/table/Table.redux.js +292 -329
- package/lib/components/table/Table.redux.test.js +49 -47
- package/lib/components/table/Table.test.js +107 -132
- package/lib/components/table/defaults/BodyCell.js +12 -6
- package/lib/components/table/defaults/BodyRow.js +10 -4
- package/lib/components/table/defaults/BooleanFilter.js +17 -11
- package/lib/components/table/defaults/EmptyBodyRow.js +12 -6
- package/lib/components/table/defaults/FilterLayout.js +17 -11
- package/lib/components/table/defaults/Footer.js +11 -5
- package/lib/components/table/defaults/FooterCell.js +10 -4
- package/lib/components/table/defaults/FooterRow.js +10 -4
- package/lib/components/table/defaults/Header.js +10 -4
- package/lib/components/table/defaults/HeaderCell.js +16 -10
- package/lib/components/table/defaults/HeaderRow.js +10 -4
- package/lib/components/table/defaults/PaginationControl.js +18 -9
- package/lib/components/table/defaults/TableBody.js +10 -4
- package/lib/components/table/defaults/TableLayout.js +12 -6
- package/lib/components/table/defaults/TextFilter.js +16 -10
- package/lib/components/table/defaults/index.js +41 -33
- package/lib/components/task/builder/Connector.js +100 -111
- package/lib/components/task/builder/ConnectorForm.js +17 -11
- package/lib/components/task/builder/Node.js +101 -83
- package/lib/components/task/builder/NodeForm.js +30 -27
- package/lib/components/task/builder/NodeParametersForm.js +27 -24
- package/lib/components/task/builder/SvgCanvas.js +67 -96
- package/lib/components/task/builder/SvgText.js +19 -134
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +27 -22
- package/lib/components/task/builder/TreeBuilder.js +140 -115
- package/lib/components/task/builder/builder.redux.js +311 -326
- package/lib/components/task/builder/constants.js +94 -45
- package/lib/components/task/builder/helpers.js +184 -173
- package/lib/components/task/builder/helpers.test.js +20 -18
- package/lib/components/task/builder/models.js +121 -98
- package/lib/components/task/category/TaskCategoryForm.js +31 -29
- package/lib/components/task/category/TaskCategoryTable.js +12 -8
- package/lib/components/task/common/UsageTable.js +16 -12
- package/lib/components/task/engine/EngineSettingsForm.js +13 -11
- package/lib/components/task/errors/RunErrorTable.js +17 -13
- package/lib/components/task/errors/SystemErrorsTable.js +13 -9
- package/lib/components/task/handlers/HandlerForm.js +55 -55
- package/lib/components/task/handlers/HandlerTable.js +12 -8
- package/lib/components/task/handlers/MissingHandlerTable.js +12 -8
- package/lib/components/task/policy_rule/PolicyRuleForm.js +33 -32
- package/lib/components/task/policy_rule/PolicyRuleTable.js +12 -8
- package/lib/components/task/runs/CreateManualTriggerForm.js +17 -15
- package/lib/components/task/runs/RunTable.js +23 -20
- package/lib/components/task/runs/RunTaskTable.js +10 -6
- package/lib/components/task/sources/SourceForm.js +47 -47
- package/lib/components/task/sources/SourceTable.js +14 -11
- package/lib/components/task/triggers/TriggerTable.js +21 -18
- package/lib/components/task/workflows/LinkedWorkflowForm.js +48 -54
- package/lib/components/task/workflows/LinkedWorkflowTable.js +14 -10
- package/lib/components/task/workflows/MissingRoutineTable.js +12 -8
- package/lib/components/task/workflows/WorkflowForm.js +49 -44
- package/lib/components/task/workflows/WorkflowTable.js +17 -14
- package/lib/helpers/SearchBuilder.js +73 -127
- package/lib/helpers/SearchBuilder.test.js +184 -175
- package/lib/helpers/index.js +116 -74
- package/lib/index.js +86 -38
- package/lib/reducer.js +11 -3
- package/lib/saga.js +42 -38
- package/lib/store.js +59 -35
- package/package.json +3 -28
- package/proxyhelper.js +105 -46
- package/assets/discussions/images/avi_128.png +0 -0
- package/assets/discussions/images/excel_128.png +0 -0
- package/assets/discussions/images/html_128.png +0 -0
- package/assets/discussions/images/illustrator_128.png +0 -0
- package/assets/discussions/images/indesign_128.png +0 -0
- package/assets/discussions/images/movie_128.png +0 -0
- package/assets/discussions/images/mpeg_128.png +0 -0
- package/assets/discussions/images/pdf_128.png +0 -0
- package/assets/discussions/images/photoshop_128.png +0 -0
- package/assets/discussions/images/powerpoint_128.png +0 -0
- package/assets/discussions/images/txt_128.png +0 -0
- package/assets/discussions/images/unknown_128.png +0 -0
- package/assets/discussions/images/word_128.png +0 -0
- package/assets/discussions/styles/_discussion.scss +0 -506
- package/lib/apis/discussions/index.js +0 -395
- package/lib/apis/socket/index.js +0 -77
- package/lib/apis/socket/socket.js +0 -350
- package/lib/apis/socket/socket.test.js +0 -90
- package/lib/apis/socket/timer.js +0 -45
- package/lib/apis/socket/timer.test.js +0 -51
- package/lib/apis/socket/topic.js +0 -185
- package/lib/apis/topics/index.js +0 -19
- package/lib/components/discussions/ChatInputForm.js +0 -424
- package/lib/components/discussions/DateBanner.js +0 -10
- package/lib/components/discussions/Discussion.js +0 -202
- package/lib/components/discussions/DiscussionForm.js +0 -227
- package/lib/components/discussions/InvitationForm.js +0 -107
- package/lib/components/discussions/MessageHistory.js +0 -110
- package/lib/components/discussions/MessagesByDate.js +0 -40
- package/lib/components/discussions/MessagesList.js +0 -30
- package/lib/components/discussions/MoreMessagesBanner.js +0 -26
- package/lib/components/discussions/ScrollHelper.js +0 -84
- package/lib/components/discussions/SystemMessage.js +0 -88
- package/lib/components/discussions/SystemMessageGroup.js +0 -15
- package/lib/components/discussions/UserMessage.js +0 -163
- package/lib/components/discussions/UserMessageGroup.js +0 -34
- package/lib/components/discussions/redux.js +0 -178
- package/lib/components/discussions/sagas.js +0 -500
- package/lib/helpers/discussions/canManage.js +0 -30
- package/lib/helpers/discussions/canManage.test.js +0 -69
- package/lib/helpers/discussions/generateSystemMessageContent.js +0 -131
- package/lib/helpers/discussions/generateSystemMessageContent.test.js +0 -450
- package/lib/models/discussions.js +0 -76
- package/lib/models/index.js +0 -1
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
import { getIn, List, Map, Set } from 'immutable';
|
|
3
|
-
import { generateTable } from '../../table/Table';
|
|
4
|
-
import { fetchForm, fetchKapp, searchSubmissions, SubmissionSearch, VALID_KAPP_CORE_STATES } from '../../../apis';
|
|
1
|
+
"use strict";
|
|
5
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.KappSubmissionTable = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
9
|
+
var _immutable = require("immutable");
|
|
10
|
+
var _Table = require("../../table/Table");
|
|
11
|
+
var _apis = require("../../../apis");
|
|
6
12
|
var applyMeta = function applyMeta(query, op, rvalue) {
|
|
7
13
|
return rvalue ? query[op](rvalue) : query;
|
|
8
14
|
};
|
|
9
|
-
|
|
10
15
|
var applyOp = function applyOp(query, op, lvalue, rvalue) {
|
|
11
16
|
return rvalue ? query[op](lvalue, rvalue) : query;
|
|
12
17
|
};
|
|
13
|
-
|
|
14
18
|
var submissionSearch = function submissionSearch(_ref, include) {
|
|
15
19
|
var filters = _ref.filters,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var query = new SubmissionSearch().includes(Set([].concat(
|
|
20
|
+
pageSize = _ref.pageSize,
|
|
21
|
+
sortColumn = _ref.sortColumn,
|
|
22
|
+
sortDirection = _ref.sortDirection;
|
|
23
|
+
var query = new _apis.SubmissionSearch().includes((0, _immutable.Set)([].concat((0, _toConsumableArray2["default"])(typeof include === 'string' ? include.split(',') : Array.isArray(include) ? include : []), ['details', 'form'])).toJS()).sortBy(sortColumn || 'createdAt').sortDirection(sortDirection.toLocaleUpperCase()).limit(pageSize);
|
|
20
24
|
applyMeta(query, 'coreState', filters.get('coreState'));
|
|
21
25
|
applyMeta(query, 'startDate', filters.get('startDate') && new Date("".concat(filters.get('startDate'), "T00:00:00")));
|
|
22
26
|
applyMeta(query, 'endDate', filters.get('endDate') && new Date("".concat(filters.get('endDate'), "T00:00:00")));
|
|
23
27
|
applyOp(query, 'eq', 'handle', filters.get('handle'));
|
|
24
28
|
applyOp(query, 'eq', 'submittedBy', filters.getIn(['submittedBy', 'username']));
|
|
25
|
-
filters.get('values', Map()).forEach(function (value, field) {
|
|
29
|
+
filters.get('values', (0, _immutable.Map)()).forEach(function (value, field) {
|
|
26
30
|
return applyOp(query, 'eq', "values[".concat(field, "]"), value);
|
|
27
31
|
});
|
|
28
32
|
return query.build();
|
|
29
33
|
};
|
|
30
|
-
|
|
31
34
|
var dataSource = function dataSource(_ref2) {
|
|
32
35
|
var formSlug = _ref2.formSlug,
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
kappSlug = _ref2.kappSlug,
|
|
37
|
+
include = _ref2.include;
|
|
35
38
|
return {
|
|
36
|
-
fn: searchSubmissions,
|
|
39
|
+
fn: _apis.searchSubmissions,
|
|
37
40
|
params: function params(paramData) {
|
|
38
41
|
return [{
|
|
39
42
|
kapp: kappSlug,
|
|
@@ -50,19 +53,17 @@ var dataSource = function dataSource(_ref2) {
|
|
|
50
53
|
}
|
|
51
54
|
};
|
|
52
55
|
};
|
|
53
|
-
|
|
54
56
|
var onValidateFilters = function onValidateFilters(filters) {
|
|
55
|
-
return filters.getIn(['values', 'value'], List()).reduce(function (valid, value) {
|
|
57
|
+
return filters.getIn(['values', 'value'], (0, _immutable.List)()).reduce(function (valid, value) {
|
|
56
58
|
return valid && value.get('field') !== '' ? value.get('value') !== '' : valid;
|
|
57
59
|
}, true);
|
|
58
60
|
};
|
|
59
|
-
|
|
60
61
|
var filterDataSources = function filterDataSources(_ref3) {
|
|
61
62
|
var kappSlug = _ref3.kappSlug,
|
|
62
|
-
|
|
63
|
+
formSlug = _ref3.formSlug;
|
|
63
64
|
return {
|
|
64
65
|
kapp: {
|
|
65
|
-
fn: fetchKapp,
|
|
66
|
+
fn: _apis.fetchKapp,
|
|
66
67
|
params: [{
|
|
67
68
|
kappSlug: kappSlug,
|
|
68
69
|
include: 'fields'
|
|
@@ -73,7 +74,7 @@ var filterDataSources = function filterDataSources(_ref3) {
|
|
|
73
74
|
},
|
|
74
75
|
form: {
|
|
75
76
|
fn: function fn(formSlug) {
|
|
76
|
-
return formSlug ? fetchForm({
|
|
77
|
+
return formSlug ? (0, _apis.fetchForm)({
|
|
77
78
|
kappSlug: kappSlug,
|
|
78
79
|
formSlug: formSlug,
|
|
79
80
|
include: 'fields'
|
|
@@ -81,7 +82,7 @@ var filterDataSources = function filterDataSources(_ref3) {
|
|
|
81
82
|
},
|
|
82
83
|
params: function params(_ref4) {
|
|
83
84
|
var values = _ref4.values;
|
|
84
|
-
return [getIn(values, ['form', 'slug'], formSlug)];
|
|
85
|
+
return [(0, _immutable.getIn)(values, ['form', 'slug'], formSlug)];
|
|
85
86
|
},
|
|
86
87
|
transform: function transform(result) {
|
|
87
88
|
return result && result.form;
|
|
@@ -93,7 +94,7 @@ var filterDataSources = function filterDataSources(_ref3) {
|
|
|
93
94
|
},
|
|
94
95
|
params: function params(_ref5) {
|
|
95
96
|
var form = _ref5.form,
|
|
96
|
-
|
|
97
|
+
kapp = _ref5.kapp;
|
|
97
98
|
return kapp && [form, kapp];
|
|
98
99
|
},
|
|
99
100
|
transform: function transform(result) {
|
|
@@ -107,7 +108,7 @@ var filterDataSources = function filterDataSources(_ref3) {
|
|
|
107
108
|
},
|
|
108
109
|
coreStateOptions: {
|
|
109
110
|
fn: function fn() {
|
|
110
|
-
return VALID_KAPP_CORE_STATES;
|
|
111
|
+
return _apis.VALID_KAPP_CORE_STATES;
|
|
111
112
|
},
|
|
112
113
|
params: [],
|
|
113
114
|
transform: function transform(coreStates) {
|
|
@@ -121,10 +122,9 @@ var filterDataSources = function filterDataSources(_ref3) {
|
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
124
|
};
|
|
124
|
-
|
|
125
125
|
var filters = function filters(_ref6) {
|
|
126
126
|
var kappSlug = _ref6.kappSlug,
|
|
127
|
-
|
|
127
|
+
formSlug = _ref6.formSlug;
|
|
128
128
|
return function (_ref7) {
|
|
129
129
|
var coreStateOptions = _ref7.coreStateOptions;
|
|
130
130
|
return coreStateOptions && [{
|
|
@@ -168,7 +168,6 @@ var filters = function filters(_ref6) {
|
|
|
168
168
|
}];
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
|
-
|
|
172
171
|
var columns = [{
|
|
173
172
|
value: 'closedAt',
|
|
174
173
|
title: 'Closed At',
|
|
@@ -238,7 +237,7 @@ var columns = [{
|
|
|
238
237
|
title: 'Updated By',
|
|
239
238
|
sortable: false
|
|
240
239
|
}];
|
|
241
|
-
|
|
240
|
+
var KappSubmissionTable = (0, _Table.generateTable)({
|
|
242
241
|
tableOptions: ['kappSlug', 'formSlug', 'datastore', 'include'],
|
|
243
242
|
columns: columns,
|
|
244
243
|
dataSource: dataSource,
|
|
@@ -246,5 +245,7 @@ export var KappSubmissionTable = generateTable({
|
|
|
246
245
|
filters: filters,
|
|
247
246
|
onValidateFilters: onValidateFilters
|
|
248
247
|
});
|
|
248
|
+
exports.KappSubmissionTable = KappSubmissionTable;
|
|
249
249
|
KappSubmissionTable.displayName = 'KappSubmissionTable';
|
|
250
|
-
|
|
250
|
+
var _default = KappSubmissionTable;
|
|
251
|
+
exports["default"] = _default;
|
|
@@ -1,124 +1,195 @@
|
|
|
1
|
-
|
|
2
|
-
import { fetchSubmission, updateSubmission } from '../../../apis';
|
|
3
|
-
import { generateForm } from '../../form/Form';
|
|
4
|
-
import moment from 'moment';
|
|
1
|
+
"use strict";
|
|
5
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SubmissionForm = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
|
+
var _immutable = require("immutable");
|
|
10
|
+
var _apis = require("../../../apis");
|
|
11
|
+
var _Form = require("../../form/Form");
|
|
12
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
13
|
+
var _lodashEs = require("lodash-es");
|
|
6
14
|
var dataSources = function dataSources(_ref) {
|
|
7
|
-
var
|
|
15
|
+
var kappSlug = _ref.kappSlug,
|
|
16
|
+
formSlug = _ref.formSlug,
|
|
17
|
+
submissionId = _ref.submissionId;
|
|
8
18
|
return {
|
|
9
19
|
submission: {
|
|
10
|
-
fn: fetchSubmission,
|
|
11
|
-
params: [{
|
|
20
|
+
fn: _apis.fetchSubmission,
|
|
21
|
+
params: submissionId && [{
|
|
12
22
|
id: submissionId,
|
|
13
|
-
include: 'details,values,form,form.fields,form.fields.details,form.pages'
|
|
23
|
+
include: 'details,values.raw,form,form.fields,form.fields.details,form.pages'
|
|
14
24
|
}],
|
|
15
25
|
transform: function transform(result) {
|
|
16
26
|
return result.submission;
|
|
17
27
|
}
|
|
28
|
+
},
|
|
29
|
+
form: {
|
|
30
|
+
fn: _apis.fetchForm,
|
|
31
|
+
params: kappSlug && formSlug && [{
|
|
32
|
+
kappSlug: kappSlug,
|
|
33
|
+
formSlug: formSlug,
|
|
34
|
+
include: 'pages'
|
|
35
|
+
}],
|
|
36
|
+
transform: function transform(result) {
|
|
37
|
+
return result.form;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
pages: {
|
|
41
|
+
fn: function fn(form) {
|
|
42
|
+
return form.get('pages');
|
|
43
|
+
},
|
|
44
|
+
params: function params(_ref2) {
|
|
45
|
+
var form = _ref2.form,
|
|
46
|
+
submission = _ref2.submission;
|
|
47
|
+
return submission ? [submission.get('form')] : form ? [form] : null;
|
|
48
|
+
}
|
|
18
49
|
}
|
|
19
50
|
};
|
|
20
51
|
};
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
52
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
53
|
+
var kappSlug = _ref3.kappSlug,
|
|
54
|
+
formSlug = _ref3.formSlug,
|
|
55
|
+
id = _ref3.submissionId;
|
|
24
56
|
return function (values) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
57
|
+
// Remove the new files to upload from the values.
|
|
58
|
+
var processedValues = values.map(function (value) {
|
|
59
|
+
return (0, _lodashEs.isArray)(value) || _immutable.List.isList(value) ? value.filter(function (entry) {
|
|
60
|
+
return !(entry instanceof File);
|
|
61
|
+
}) : value;
|
|
62
|
+
});
|
|
31
63
|
|
|
64
|
+
// Construct a list of files to upload by iterating through the values,
|
|
65
|
+
// flattening if the value is a List/Array and then filtering to only keep
|
|
66
|
+
// values that are instances of File, which represent new files to upload.
|
|
67
|
+
var files = values.entrySeq().flatMap(function (_ref4) {
|
|
68
|
+
var _ref5 = (0, _slicedToArray2["default"])(_ref4, 2),
|
|
69
|
+
field = _ref5[0],
|
|
70
|
+
vals = _ref5[1];
|
|
71
|
+
return (0, _lodashEs.isArray)(vals) || _immutable.List.isList(vals) ? (0, _immutable.List)(vals).filter(function (val) {
|
|
72
|
+
return val instanceof File;
|
|
73
|
+
}).map(function (file) {
|
|
74
|
+
return (0, _immutable.Map)({
|
|
75
|
+
field: field,
|
|
76
|
+
file: file
|
|
77
|
+
});
|
|
78
|
+
}) : [];
|
|
79
|
+
}).toList();
|
|
80
|
+
return (0, _apis.saveSubmissionMultipart)({
|
|
81
|
+
kappSlug: kappSlug,
|
|
82
|
+
formSlug: formSlug,
|
|
83
|
+
id: id,
|
|
84
|
+
values: processedValues,
|
|
85
|
+
files: files
|
|
86
|
+
}).then(function (_ref6) {
|
|
87
|
+
var submission = _ref6.submission,
|
|
88
|
+
error = _ref6.error;
|
|
32
89
|
if (error) {
|
|
33
90
|
throw error.statusCode === 400 && error.message || 'There was an error saving the submission';
|
|
34
91
|
}
|
|
35
|
-
|
|
36
92
|
return submission;
|
|
37
93
|
});
|
|
38
94
|
};
|
|
39
95
|
};
|
|
40
|
-
|
|
41
96
|
var traverseElement = function traverseElement(traverse, iteratee, acc) {
|
|
42
97
|
var element = traverse.get(0);
|
|
43
98
|
var elements = traverse.shift();
|
|
44
|
-
var childElements = element.get('elements', List());
|
|
45
|
-
var result = iteratee(element, acc);
|
|
46
|
-
|
|
99
|
+
var childElements = element.get('elements', (0, _immutable.List)());
|
|
100
|
+
var result = iteratee(element, acc);
|
|
101
|
+
// If the current element has child elements make a recursive call.
|
|
47
102
|
if (childElements.size > 0) {
|
|
48
103
|
result = traverseElement(childElements, iteratee, result);
|
|
49
104
|
}
|
|
50
|
-
|
|
51
105
|
if (elements.size > 0) {
|
|
52
106
|
return traverseElement(elements, iteratee, result);
|
|
53
107
|
}
|
|
54
|
-
|
|
55
108
|
return result;
|
|
56
109
|
};
|
|
57
|
-
|
|
58
110
|
var convertRenderType = function convertRenderType(element) {
|
|
59
111
|
if (element.get('renderType') === 'dropdown') {
|
|
60
112
|
return element.get('choicesResourceName') ? 'text' : 'select';
|
|
61
113
|
} else if (element.get('renderType') === 'checkbox') {
|
|
62
114
|
return 'text-multi';
|
|
63
115
|
} else if (element.get('renderType') === 'attachment') {
|
|
64
|
-
|
|
116
|
+
if (element.get('allowMultiple')) {
|
|
117
|
+
return 'file-multi';
|
|
118
|
+
} else {
|
|
119
|
+
return 'file';
|
|
120
|
+
}
|
|
65
121
|
}
|
|
66
|
-
|
|
67
122
|
return element.get('renderType');
|
|
68
123
|
};
|
|
69
|
-
|
|
70
124
|
var getInitialValue = function getInitialValue(submission, element, type) {
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
125
|
+
var fieldKey = element.get('key');
|
|
126
|
+
var value = (0, _immutable.getIn)(submission, ['valuesRaw', fieldKey, 'value'], ['checkbox', 'attachment'].includes(element.get('renderType')) ? (0, _immutable.List)() : '') || '';
|
|
127
|
+
|
|
128
|
+
// To update a submission with existing submissions we need to grab the
|
|
129
|
+
// documentId and insert that into the attachment value normally returned with
|
|
130
|
+
// the submission.
|
|
131
|
+
if (element.get('renderType') === 'attachment') {
|
|
132
|
+
var rawValue = JSON.parse((0, _immutable.getIn)(submission, ['valuesRaw', fieldKey, 'rawValue'], null));
|
|
133
|
+
value = value.map(function (attachment, i) {
|
|
134
|
+
return attachment.set('documentId', (0, _immutable.getIn)(rawValue, [i, 'documentId'], null));
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return type === 'datetime' && value ? (0, _moment["default"])(value).format('yyyy-MM-DDThh:mm') : type === 'date' && value ? (0, _moment["default"])(value).format('yyyy-MM-DD') : value;
|
|
75
138
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var values = _ref4.values;
|
|
139
|
+
var serializer = function serializer(element) {
|
|
140
|
+
return function (_ref7) {
|
|
141
|
+
var values = _ref7.values;
|
|
80
142
|
var name = element.get('name');
|
|
81
|
-
|
|
143
|
+
var type = element.get('renderType');
|
|
144
|
+
switch (type) {
|
|
145
|
+
case 'datetime':
|
|
146
|
+
return values.get(name) && (0, _moment["default"])(values.get(name)).format();
|
|
147
|
+
case 'attachment':
|
|
148
|
+
// When updating a submission with existing attachment values, there will
|
|
149
|
+
// be a link property returned from the API that has to be removed from
|
|
150
|
+
// the payload we are going to submit.
|
|
151
|
+
return values.get(name).map(function (attachment) {
|
|
152
|
+
return attachment instanceof File ? attachment : (0, _immutable.remove)(attachment, 'link');
|
|
153
|
+
});
|
|
154
|
+
default:
|
|
155
|
+
return values.get(name);
|
|
156
|
+
}
|
|
82
157
|
};
|
|
83
|
-
};
|
|
84
|
-
// label/value mapping from and not actual choices.
|
|
85
|
-
|
|
158
|
+
};
|
|
86
159
|
|
|
160
|
+
// If the element uses bridged options then the `choices` value represents the
|
|
161
|
+
// label/value mapping from and not actual choices.
|
|
87
162
|
var getChoices = function getChoices(element) {
|
|
88
|
-
return !!element.get('choicesResourceName') ? List() : element.get('choices');
|
|
163
|
+
return !!element.get('choicesResourceName') ? (0, _immutable.List)() : element.get('choices');
|
|
89
164
|
};
|
|
90
|
-
|
|
91
165
|
var fields = function fields() {
|
|
92
|
-
return function (
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
166
|
+
return function (_ref8) {
|
|
167
|
+
var form = _ref8.form,
|
|
168
|
+
pages = _ref8.pages,
|
|
169
|
+
submission = _ref8.submission;
|
|
170
|
+
if (pages) {
|
|
97
171
|
var values = traverseElement(pages, function (element, values) {
|
|
98
172
|
var name = element.get('name');
|
|
99
173
|
var type = convertRenderType(element);
|
|
100
|
-
var initialValue = getInitialValue(submission, element, type);
|
|
101
|
-
var isAttachment = element.get('renderType') === 'attachment';
|
|
174
|
+
var initialValue = getInitialValue(submission || {}, element, type);
|
|
102
175
|
return element.get('type') === 'field' ? values.push({
|
|
103
176
|
name: name,
|
|
104
177
|
label: name,
|
|
105
178
|
type: type,
|
|
106
179
|
options: getChoices(element, initialValue),
|
|
107
180
|
initialValue: initialValue,
|
|
108
|
-
enabled: !isAttachment,
|
|
109
|
-
"transient": isAttachment,
|
|
110
181
|
serialize: serializer(element, type)
|
|
111
182
|
}) : values;
|
|
112
|
-
}, List());
|
|
183
|
+
}, (0, _immutable.List)());
|
|
113
184
|
return values.toJS();
|
|
114
185
|
}
|
|
115
186
|
};
|
|
116
187
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
formOptions: ['submissionId'],
|
|
188
|
+
var SubmissionForm = (0, _Form.generateForm)({
|
|
189
|
+
formOptions: ['kappSlug', 'formSlug', 'submissionId'],
|
|
120
190
|
dataSources: dataSources,
|
|
121
191
|
fields: fields,
|
|
122
192
|
handleSubmit: handleSubmit
|
|
123
193
|
});
|
|
194
|
+
exports.SubmissionForm = SubmissionForm;
|
|
124
195
|
SubmissionForm.displayName = 'SubmissionForm';
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import FormSubmissionTable from './FormSubmissionTable';
|
|
7
|
-
import DatastoreSubmissionTable from './DatastoreSubmissionTable';
|
|
8
|
-
import KappSubmissionTable from './KappSubmissionTable';
|
|
9
|
-
export var SubmissionTable = /*#__PURE__*/function (_Component) {
|
|
10
|
-
_inherits(SubmissionTable, _Component);
|
|
11
|
-
|
|
12
|
-
var _super = _createSuper(SubmissionTable);
|
|
1
|
+
"use strict";
|
|
13
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SubmissionTable = void 0;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
|
12
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _FormSubmissionTable = _interopRequireDefault(require("./FormSubmissionTable"));
|
|
15
|
+
var _DatastoreSubmissionTable = _interopRequireDefault(require("./DatastoreSubmissionTable"));
|
|
16
|
+
var _KappSubmissionTable = _interopRequireDefault(require("./KappSubmissionTable"));
|
|
17
|
+
var SubmissionTable = /*#__PURE__*/function (_Component) {
|
|
18
|
+
(0, _inherits2["default"])(SubmissionTable, _Component);
|
|
19
|
+
var _super = (0, _createSuper2["default"])(SubmissionTable);
|
|
14
20
|
function SubmissionTable() {
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
(0, _classCallCheck2["default"])(this, SubmissionTable);
|
|
17
22
|
return _super.apply(this, arguments);
|
|
18
23
|
}
|
|
19
|
-
|
|
20
|
-
_createClass(SubmissionTable, [{
|
|
24
|
+
(0, _createClass2["default"])(SubmissionTable, [{
|
|
21
25
|
key: "componentDidMount",
|
|
22
26
|
value: function componentDidMount() {
|
|
23
27
|
if (this.props.mode === 'space') {
|
|
@@ -29,10 +33,10 @@ export var SubmissionTable = /*#__PURE__*/function (_Component) {
|
|
|
29
33
|
}, {
|
|
30
34
|
key: "render",
|
|
31
35
|
value: function render() {
|
|
32
|
-
var TableComponent = this.props.mode === 'form' ?
|
|
33
|
-
return /*#__PURE__*/
|
|
36
|
+
var TableComponent = this.props.mode === 'form' ? _FormSubmissionTable["default"] : this.props.mode === 'space' ? _DatastoreSubmissionTable["default"] : this.props.mode === 'kapp' ? _KappSubmissionTable["default"] : _KappSubmissionTable["default"];
|
|
37
|
+
return /*#__PURE__*/_react["default"].createElement(TableComponent, this.props, this.props.children);
|
|
34
38
|
}
|
|
35
39
|
}]);
|
|
36
|
-
|
|
37
40
|
return SubmissionTable;
|
|
38
|
-
}(Component);
|
|
41
|
+
}(_react.Component);
|
|
42
|
+
exports.SubmissionTable = SubmissionTable;
|
|
@@ -1,95 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
import { TIMELINES, MAX_PART_LENGTH } from '../../../helpers';
|
|
3
|
-
export var getUsedFields = function getUsedFields(values, partIndex) {
|
|
4
|
-
var partType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'eq';
|
|
5
|
-
var equalities = List();
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getUsedFields = exports.getRemainingParts = exports.availableParts = void 0;
|
|
7
|
+
var _immutable = require("immutable");
|
|
8
|
+
var _helpers = require("../../../helpers");
|
|
9
|
+
var getUsedFields = function getUsedFields(values, partIndex) {
|
|
10
|
+
var partType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'eq';
|
|
11
|
+
var equalities = (0, _immutable.List)();
|
|
7
12
|
if (partType === 'eq' && partIndex === 0) {
|
|
8
|
-
equalities = List();
|
|
13
|
+
equalities = (0, _immutable.List)();
|
|
9
14
|
} else if (partType === 'eq' && partIndex === 1) {
|
|
10
|
-
equalities = List([values.get('op0-part')]);
|
|
15
|
+
equalities = (0, _immutable.List)([values.get('op0-part')]);
|
|
11
16
|
} else if (partType === 'eq') {
|
|
12
|
-
equalities = Range(0, partIndex).map(function (i) {
|
|
17
|
+
equalities = (0, _immutable.Range)(0, partIndex).map(function (i) {
|
|
13
18
|
return values.get("op".concat(i, "-part"));
|
|
14
19
|
}).toList().filter(function (f) {
|
|
15
20
|
return f !== '';
|
|
16
21
|
});
|
|
17
22
|
} else if (partType === 'range') {
|
|
18
|
-
var orders = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
23
|
+
var orders = (0, _immutable.Range)(0, _helpers.MAX_PART_LENGTH).map(function (i) {
|
|
19
24
|
return values.get("orderby".concat(i, "-part"));
|
|
20
25
|
}).toList().filter(function (f) {
|
|
21
26
|
return f !== '' && f !== values.get('range-part');
|
|
22
27
|
});
|
|
23
|
-
equalities = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
28
|
+
equalities = (0, _immutable.Range)(0, _helpers.MAX_PART_LENGTH).map(function (i) {
|
|
24
29
|
return values.get("op".concat(i, "-part"));
|
|
25
30
|
}).toList().concat(orders).filter(function (f) {
|
|
26
31
|
return f !== '';
|
|
27
32
|
});
|
|
28
33
|
} else if (partType === 'orderBy') {
|
|
29
34
|
var _orders;
|
|
30
|
-
|
|
31
35
|
if (partIndex === 0) {
|
|
32
|
-
_orders = List();
|
|
36
|
+
_orders = (0, _immutable.List)();
|
|
33
37
|
} else if (partIndex === 1) {
|
|
34
|
-
_orders = List([values.get('orderby0-part')]);
|
|
38
|
+
_orders = (0, _immutable.List)([values.get('orderby0-part')]);
|
|
35
39
|
} else {
|
|
36
|
-
_orders = Range(0, partIndex).map(function (i) {
|
|
40
|
+
_orders = (0, _immutable.Range)(0, partIndex).map(function (i) {
|
|
37
41
|
return values.get("orderby".concat(i, "-part"));
|
|
38
42
|
}).toList().filter(function (f) {
|
|
39
43
|
return f !== '';
|
|
40
44
|
});
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
equalities = Range(0, MAX_PART_LENGTH).map(function (i) {
|
|
46
|
+
equalities = (0, _immutable.Range)(0, _helpers.MAX_PART_LENGTH).map(function (i) {
|
|
44
47
|
return values.get("op".concat(i, "-part"));
|
|
45
48
|
}).toList().concat(_orders).filter(function (f) {
|
|
46
49
|
return f !== '';
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
|
-
|
|
50
52
|
return equalities;
|
|
51
53
|
};
|
|
52
|
-
|
|
54
|
+
exports.getUsedFields = getUsedFields;
|
|
55
|
+
var availableParts = function availableParts(values, indexes, equalityFields) {
|
|
53
56
|
var partType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'eq';
|
|
54
57
|
var remainingParts = indexes.map(function (index) {
|
|
55
|
-
return getRemainingParts(index.get('parts', List()), equalityFields);
|
|
58
|
+
return getRemainingParts(index.get('parts', (0, _immutable.List)()), equalityFields);
|
|
56
59
|
});
|
|
57
60
|
var containsTimeline = equalityFields.some(function (index) {
|
|
58
|
-
return TIMELINES.includes(index);
|
|
61
|
+
return _helpers.TIMELINES.includes(index);
|
|
59
62
|
});
|
|
60
63
|
var anyAtLast = remainingParts.some(function (index) {
|
|
61
64
|
return index && index.size === 0;
|
|
62
65
|
});
|
|
63
66
|
var rangePart = values.get('range-part');
|
|
64
|
-
var timelinesAvailable = anyAtLast && !containsTimeline ? TIMELINES : containsTimeline ? getRemainingParts(List([equalityFields.last()]), fromJS(TIMELINES)) : List();
|
|
65
|
-
|
|
67
|
+
var timelinesAvailable = anyAtLast && !containsTimeline ? _helpers.TIMELINES : containsTimeline ? getRemainingParts((0, _immutable.List)([equalityFields.last()]), (0, _immutable.fromJS)(_helpers.TIMELINES)) : (0, _immutable.List)();
|
|
66
68
|
if (partType === 'range') {
|
|
67
69
|
var rangeRemaining = remainingParts.filter(function (index) {
|
|
68
70
|
return index && index.size === 1;
|
|
69
71
|
});
|
|
70
|
-
return rangeRemaining.concat(rangePart && rangeRemaining.size === 0 && values.get('orderby0-part') && values.get('orderby0-part') !== rangePart ? List([]) : timelinesAvailable || List([]));
|
|
72
|
+
return rangeRemaining.concat(rangePart && rangeRemaining.size === 0 && values.get('orderby0-part') && values.get('orderby0-part') !== rangePart ? (0, _immutable.List)([]) : timelinesAvailable || (0, _immutable.List)([]));
|
|
71
73
|
} else if (partType === 'orderBy') {
|
|
72
|
-
return (rangePart ? List([rangePart]) : remainingParts.filter(function (index) {
|
|
74
|
+
return (rangePart ? (0, _immutable.List)([rangePart]) : remainingParts.filter(function (index) {
|
|
73
75
|
return index && index.size > 0;
|
|
74
76
|
}).map(function (index) {
|
|
75
77
|
return index.first();
|
|
76
|
-
})).concat(TIMELINES.includes(rangePart) ? List([rangePart]) : anyAtLast ? fromJS(TIMELINES) : equalityFields.size === 0 ? fromJS(TIMELINES) : List()).toSet().toList();
|
|
78
|
+
})).concat(_helpers.TIMELINES.includes(rangePart) ? (0, _immutable.List)([rangePart]) : anyAtLast ? (0, _immutable.fromJS)(_helpers.TIMELINES) : equalityFields.size === 0 ? (0, _immutable.fromJS)(_helpers.TIMELINES) : (0, _immutable.List)()).toSet().toList();
|
|
77
79
|
} else {
|
|
78
80
|
return remainingParts.filterNot(function (index) {
|
|
79
81
|
return !index || index.size === 0;
|
|
80
82
|
}).map(function (index) {
|
|
81
83
|
return index.first();
|
|
82
84
|
}).toSet().toList().filterNot(function (p) {
|
|
83
|
-
return TIMELINES.includes(p);
|
|
85
|
+
return _helpers.TIMELINES.includes(p);
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
exports.availableParts = availableParts;
|
|
90
|
+
var getRemainingParts = function getRemainingParts(src, dst) {
|
|
91
|
+
if (src.size === 0 && dst.size === 0) return (0, _immutable.List)();
|
|
92
|
+
// If we're matching so far, and the are no more to compare it's a match.
|
|
93
|
+
if (src.size > 0 && dst.size === 0) return src;
|
|
94
|
+
// If we're out of elements but there's more to match, it's not a match.
|
|
95
|
+
if (src.size === 0 && dst.size > 0) return (0, _immutable.List)();
|
|
93
96
|
if (src.first() === dst.first()) return getRemainingParts(src.shift(), dst.shift());
|
|
94
97
|
return null;
|
|
95
|
-
};
|
|
98
|
+
};
|
|
99
|
+
exports.getRemainingParts = getRemainingParts;
|