@kineticdata/react 5.1.2 → 6.0.1
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 +121 -80
- package/lib/apis/http.test.js +137 -38
- package/lib/apis/index.js +506 -50
- package/lib/apis/system/index.js +363 -215
- package/lib/apis/task/index.js +294 -227
- package/lib/components/agent/bridge/BridgeForm.js +50 -50
- package/lib/components/agent/bridge/BridgeTable.js +16 -9
- package/lib/components/agent/filestore/FilestoreForm.js +49 -48
- package/lib/components/agent/filestore/FilestoreTable.js +16 -9
- package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
- package/lib/components/agent/handler/AgentHandlerTable.js +17 -10
- 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/ToastContainer.js +170 -0
- 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/common/defaults/Toast.js +26 -0
- package/lib/components/common/defaults/index.js +13 -0
- 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 +25 -18
- package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
- package/lib/components/core/bridge_model/BridgeModelTable.js +17 -10
- 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 +28 -16
- 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 +26 -15
- 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 +47 -33
- package/lib/components/core/form_type/FormTypeForm.js +14 -13
- package/lib/components/core/form_type/FormTypeTable.js +15 -9
- 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 +31 -16
- 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 +34 -44
- package/lib/components/core/log/LogTable.js +42 -34
- 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 +27 -17
- 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 +64 -39
- package/lib/components/core/submission/KappSubmissionTable.js +67 -48
- 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 +27 -16
- 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 +42 -20
- package/lib/components/core/webapi/WebApiForm.js +87 -80
- package/lib/components/core/webapi/WebApiTable.js +28 -17
- package/lib/components/core/webhook/WebhookForm.js +33 -32
- package/lib/components/core/webhook/WebhookTable.js +41 -29
- package/lib/components/core/webhook_job/WebhookJobTable.js +58 -35
- package/lib/components/form/Form.helpers.js +182 -108
- package/lib/components/form/Form.js +467 -524
- package/lib/components/form/Form.models.js +39 -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 +1034 -135
- package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
- package/lib/components/system/SystemCassandraForm.js +98 -0
- package/lib/components/system/SystemElasticSearchForm.js +98 -0
- package/lib/components/system/SystemFilestoreForm.js +36 -28
- package/lib/components/system/SystemForm.js +19 -16
- package/lib/components/system/SystemIngressForm.js +85 -36
- package/lib/components/system/SystemSecurityForm.js +17 -14
- package/lib/components/system/SystemSmtpForm.js +13 -13
- package/lib/components/system/SystemTaskAdapterForm.js +49 -21
- package/lib/components/system/SystemTrustedCertificateForm.js +40 -0
- package/lib/components/system/SystemTrustedCertificatesTable.js +74 -0
- package/lib/components/system/SystemUserForm.js +15 -14
- package/lib/components/system/helpers.js +281 -98
- 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 +112 -68
- package/lib/components/system/spaces/SystemTenantTable.js +12 -8
- package/lib/components/table/Table.js +295 -227
- package/lib/components/table/Table.redux.js +339 -355
- package/lib/components/table/Table.redux.test.js +49 -47
- package/lib/components/table/Table.test.js +146 -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/ColumnControl.js +26 -0
- 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 +43 -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 +50 -27
- 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 +35 -19
- 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 +45 -29
- 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 +29 -18
- package/lib/components/task/triggers/TriggerTable.js +71 -41
- package/lib/components/task/workflows/LinkedWorkflowForm.js +48 -54
- package/lib/components/task/workflows/LinkedWorkflowTable.js +46 -26
- 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 +47 -29
- 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 +87 -38
- package/lib/reducer.js +11 -3
- package/lib/saga.js +42 -38
- package/lib/store.js +59 -35
- package/package.json +17 -29
- package/proxyhelper.js +122 -57
- 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,45 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
5
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
|
6
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
7
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../../index");
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
var _enzyme = require("enzyme");
|
|
12
|
+
var _immutable = require("immutable");
|
|
13
|
+
var _fixtures = require("../../../tests/fixtures");
|
|
14
|
+
var _defaults = require("./defaults");
|
|
15
|
+
var _Table = require("./Table");
|
|
16
|
+
var _excluded = ["dataSource", "filters", "filterDataSources", "columns", "tableOptions", "tableKey", "TableView"];
|
|
14
17
|
var buildProps = function buildProps(props) {
|
|
15
|
-
props.columnComponents = extractColumnComponents(props.columns);
|
|
18
|
+
props.columnComponents = (0, _Table.extractColumnComponents)(props.columns);
|
|
16
19
|
return props;
|
|
17
|
-
};
|
|
18
|
-
// tableOptions, columns, dataSource, sortable
|
|
20
|
+
};
|
|
19
21
|
|
|
22
|
+
// Things passed in from generateTables
|
|
23
|
+
// tableOptions, columns, dataSource, sortable
|
|
20
24
|
|
|
21
25
|
var TABLE_KEY = 'mock-table-key';
|
|
22
|
-
|
|
23
26
|
var TableViewMock = function TableViewMock(props) {
|
|
24
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, props.table, props.pagination, props.filter);
|
|
25
28
|
};
|
|
26
|
-
|
|
27
29
|
var mountTable = function mountTable(_ref) {
|
|
28
30
|
var dataSource = _ref.dataSource,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
filters = _ref.filters,
|
|
32
|
+
filterDataSources = _ref.filterDataSources,
|
|
33
|
+
_ref$columns = _ref.columns,
|
|
34
|
+
columns = _ref$columns === void 0 ? [] : _ref$columns,
|
|
35
|
+
_ref$tableOptions = _ref.tableOptions,
|
|
36
|
+
tableOptions = _ref$tableOptions === void 0 ? {} : _ref$tableOptions,
|
|
37
|
+
_ref$tableKey = _ref.tableKey,
|
|
38
|
+
tableKey = _ref$tableKey === void 0 ? TABLE_KEY : _ref$tableKey,
|
|
39
|
+
_ref$TableView = _ref.TableView,
|
|
40
|
+
TableView = _ref$TableView === void 0 ? TableViewMock : _ref$TableView,
|
|
41
|
+
tableProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
41
42
|
// Generate a new Table type using the options.
|
|
42
|
-
var Table = generateTable({
|
|
43
|
+
var Table = (0, _Table.generateTable)({
|
|
43
44
|
dataSource: dataSource,
|
|
44
45
|
columns: columns,
|
|
45
46
|
filters: filters,
|
|
@@ -47,32 +48,31 @@ var mountTable = function mountTable(_ref) {
|
|
|
47
48
|
tableOptions: Object.keys(tableOptions)
|
|
48
49
|
});
|
|
49
50
|
return new Promise(function (resolve) {
|
|
50
|
-
var result = mount( /*#__PURE__*/
|
|
51
|
+
var result = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement(Table, Object.assign({
|
|
51
52
|
tableKey: tableKey,
|
|
52
53
|
uncontrolled: true
|
|
53
54
|
}, tableProps, tableOptions), function (props) {
|
|
54
|
-
return /*#__PURE__*/
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(TableView, props);
|
|
55
56
|
})));
|
|
56
|
-
|
|
57
57
|
var ready = function ready() {
|
|
58
|
-
return !(store.getState().getIn(['tables', tableKey, 'loading'], true) || store.getState().getIn(['tables', tableKey, 'initializing'], true));
|
|
58
|
+
return !(_store.store.getState().getIn(['tables', tableKey, 'loading'], true) || _store.store.getState().getIn(['tables', tableKey, 'initializing'], true));
|
|
59
59
|
};
|
|
60
|
-
|
|
61
60
|
if (ready()) {
|
|
62
61
|
result.update();
|
|
63
62
|
resolve(result);
|
|
64
63
|
} else {
|
|
65
|
-
var unsub = store.subscribe(function () {
|
|
64
|
+
var unsub = _store.store.subscribe(function () {
|
|
66
65
|
if (ready()) {
|
|
67
66
|
result.update();
|
|
68
|
-
resolve(result);
|
|
69
|
-
|
|
67
|
+
resolve(result);
|
|
68
|
+
// Remove the store listener since we're done.
|
|
70
69
|
unsub();
|
|
71
70
|
}
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
74
|
};
|
|
75
|
+
|
|
76
76
|
/*
|
|
77
77
|
|
|
78
78
|
* Repeat for: server-side, server-side w/client sort and paginate, client-side
|
|
@@ -97,7 +97,6 @@ var mountTable = function mountTable(_ref) {
|
|
|
97
97
|
|
|
98
98
|
*/
|
|
99
99
|
|
|
100
|
-
|
|
101
100
|
describe('<Table />', function () {
|
|
102
101
|
describe('render', function () {
|
|
103
102
|
var data, columns, wrapper, dataSourceFn;
|
|
@@ -139,16 +138,15 @@ describe('<Table />', function () {
|
|
|
139
138
|
wrapper.unmount();
|
|
140
139
|
}
|
|
141
140
|
});
|
|
142
|
-
test('kitchen sink', /*#__PURE__*/
|
|
141
|
+
test('kitchen sink', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
143
142
|
var ActionCell, addColumns;
|
|
144
|
-
return
|
|
143
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
145
144
|
while (1) {
|
|
146
145
|
switch (_context.prev = _context.next) {
|
|
147
146
|
case 0:
|
|
148
147
|
ActionCell = function ActionCell(props) {
|
|
149
|
-
return /*#__PURE__*/
|
|
148
|
+
return /*#__PURE__*/_react["default"].createElement("td", null, props.value);
|
|
150
149
|
};
|
|
151
|
-
|
|
152
150
|
addColumns = [{
|
|
153
151
|
value: '_action',
|
|
154
152
|
label: 'Actions',
|
|
@@ -174,11 +172,9 @@ describe('<Table />', function () {
|
|
|
174
172
|
};
|
|
175
173
|
}
|
|
176
174
|
});
|
|
177
|
-
|
|
178
175
|
case 4:
|
|
179
176
|
wrapper = _context.sent;
|
|
180
177
|
expect(wrapper).toMatchSnapshot();
|
|
181
|
-
|
|
182
178
|
case 6:
|
|
183
179
|
case "end":
|
|
184
180
|
return _context.stop();
|
|
@@ -187,9 +183,9 @@ describe('<Table />', function () {
|
|
|
187
183
|
}, _callee);
|
|
188
184
|
})));
|
|
189
185
|
describe('filters', function () {
|
|
190
|
-
test('legacy filters', /*#__PURE__*/
|
|
186
|
+
test('legacy filters', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
|
191
187
|
var filterLayout;
|
|
192
|
-
return
|
|
188
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
193
189
|
while (1) {
|
|
194
190
|
switch (_context2.prev = _context2.next) {
|
|
195
191
|
case 0:
|
|
@@ -209,13 +205,11 @@ describe('<Table />', function () {
|
|
|
209
205
|
};
|
|
210
206
|
}
|
|
211
207
|
});
|
|
212
|
-
|
|
213
208
|
case 2:
|
|
214
209
|
wrapper = _context2.sent;
|
|
215
210
|
filterLayout = wrapper.find('FilterLayout');
|
|
216
211
|
expect(filterLayout).toBeDefined();
|
|
217
212
|
expect(filterLayout).toMatchSnapshot();
|
|
218
|
-
|
|
219
213
|
case 6:
|
|
220
214
|
case "end":
|
|
221
215
|
return _context2.stop();
|
|
@@ -223,9 +217,9 @@ describe('<Table />', function () {
|
|
|
223
217
|
}
|
|
224
218
|
}, _callee2);
|
|
225
219
|
})));
|
|
226
|
-
test('filter form', /*#__PURE__*/
|
|
220
|
+
test('filter form', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
|
227
221
|
var filterForm;
|
|
228
|
-
return
|
|
222
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
|
229
223
|
while (1) {
|
|
230
224
|
switch (_context3.prev = _context3.next) {
|
|
231
225
|
case 0:
|
|
@@ -258,13 +252,11 @@ describe('<Table />', function () {
|
|
|
258
252
|
};
|
|
259
253
|
}
|
|
260
254
|
});
|
|
261
|
-
|
|
262
255
|
case 2:
|
|
263
256
|
wrapper = _context3.sent;
|
|
264
257
|
filterForm = wrapper.find('FilterForm');
|
|
265
258
|
expect(filterForm).toBeDefined();
|
|
266
259
|
expect(filterForm).toMatchSnapshot();
|
|
267
|
-
|
|
268
260
|
case 6:
|
|
269
261
|
case "end":
|
|
270
262
|
return _context3.stop();
|
|
@@ -274,8 +266,8 @@ describe('<Table />', function () {
|
|
|
274
266
|
})));
|
|
275
267
|
});
|
|
276
268
|
describe('dataSource', function () {
|
|
277
|
-
test('dataSource resolves', /*#__PURE__*/
|
|
278
|
-
return
|
|
269
|
+
test('dataSource resolves', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
|
270
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
|
|
279
271
|
while (1) {
|
|
280
272
|
switch (_context4.prev = _context4.next) {
|
|
281
273
|
case 0:
|
|
@@ -295,12 +287,10 @@ describe('<Table />', function () {
|
|
|
295
287
|
};
|
|
296
288
|
}
|
|
297
289
|
});
|
|
298
|
-
|
|
299
290
|
case 2:
|
|
300
291
|
wrapper = _context4.sent;
|
|
301
292
|
expect(wrapper).toMatchSnapshot();
|
|
302
293
|
expect(dataSourceFn.mock.calls).toMatchSnapshot();
|
|
303
|
-
|
|
304
294
|
case 5:
|
|
305
295
|
case "end":
|
|
306
296
|
return _context4.stop();
|
|
@@ -313,115 +303,109 @@ describe('<Table />', function () {
|
|
|
313
303
|
describe('build methods', function () {
|
|
314
304
|
var props;
|
|
315
305
|
var data = [];
|
|
316
|
-
var columns = List([]);
|
|
317
|
-
var columnSet = List([]);
|
|
306
|
+
var columns = (0, _immutable.List)([]);
|
|
307
|
+
var columnSet = (0, _immutable.List)([]);
|
|
318
308
|
beforeEach(function () {
|
|
319
|
-
data = users(2);
|
|
320
|
-
columns = List([Map({
|
|
309
|
+
data = (0, _fixtures.users)(2);
|
|
310
|
+
columns = (0, _immutable.List)([(0, _immutable.Map)({
|
|
321
311
|
value: 'username',
|
|
322
312
|
title: 'Username'
|
|
323
313
|
})]);
|
|
324
|
-
columnSet = List(['username']);
|
|
314
|
+
columnSet = (0, _immutable.List)(['username']);
|
|
325
315
|
props = {
|
|
326
316
|
// Spread in the default components since the method tests will not be getting
|
|
327
317
|
// any components from the context since we're bypassing the top level `Table`
|
|
328
318
|
// component for testing.
|
|
329
|
-
components:
|
|
319
|
+
components: (0, _objectSpread2["default"])({}, _defaults.DefaultTableConfig.toJS()),
|
|
330
320
|
data: data,
|
|
331
321
|
columns: columns,
|
|
332
322
|
columnSet: columnSet,
|
|
333
|
-
rows: List(data).map(function (r) {
|
|
334
|
-
return Map(r);
|
|
323
|
+
rows: (0, _immutable.List)(data).map(function (r) {
|
|
324
|
+
return (0, _immutable.Map)(r);
|
|
335
325
|
})
|
|
336
326
|
};
|
|
337
327
|
});
|
|
338
328
|
describe('#buildTable', function () {
|
|
339
329
|
test('it renders normally', function () {
|
|
340
|
-
var wrapper = render( /*#__PURE__*/
|
|
330
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTable)(buildProps(props))));
|
|
341
331
|
expect(wrapper.is('table')).toBeTruthy();
|
|
342
332
|
expect(wrapper.is('table.custom-table')).toBeFalsy();
|
|
343
333
|
});
|
|
344
334
|
test('it renders a custom table', function () {
|
|
345
335
|
var TableLayout = function TableLayout() {
|
|
346
|
-
return /*#__PURE__*/
|
|
336
|
+
return /*#__PURE__*/_react["default"].createElement("table", {
|
|
347
337
|
className: "custom-table"
|
|
348
338
|
});
|
|
349
339
|
};
|
|
350
|
-
|
|
351
340
|
props.components.TableLayout = TableLayout;
|
|
352
|
-
var wrapper = render( /*#__PURE__*/
|
|
341
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTable)(buildProps(props))));
|
|
353
342
|
expect(wrapper.is('table.custom-table')).toBeTruthy();
|
|
354
343
|
});
|
|
355
344
|
});
|
|
356
345
|
describe('#buildTableHeader', function () {
|
|
357
346
|
test('it renders normally', function () {
|
|
358
|
-
var wrapper = render( /*#__PURE__*/
|
|
347
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeader)(buildProps(props))));
|
|
359
348
|
expect(wrapper.is('thead')).toBeTruthy();
|
|
360
349
|
expect(wrapper.is('thead.custom-thead')).toBeFalsy();
|
|
361
350
|
});
|
|
362
351
|
test('it does not render when omitHeader is set', function () {
|
|
363
352
|
props.omitHeader = true;
|
|
364
|
-
var wrapper = render( /*#__PURE__*/
|
|
353
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeader)(buildProps(props))));
|
|
365
354
|
expect(wrapper.is('thead')).toBeFalsy();
|
|
366
355
|
});
|
|
367
356
|
test('it renders a custom thead', function () {
|
|
368
357
|
var Header = function Header() {
|
|
369
|
-
return /*#__PURE__*/
|
|
358
|
+
return /*#__PURE__*/_react["default"].createElement("thead", {
|
|
370
359
|
className: "custom-thead"
|
|
371
360
|
});
|
|
372
361
|
};
|
|
373
|
-
|
|
374
362
|
props.components.Header = Header;
|
|
375
|
-
var wrapper = render( /*#__PURE__*/
|
|
363
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeader)(buildProps(props))));
|
|
376
364
|
expect(wrapper.is('thead.custom-thead')).toBeTruthy();
|
|
377
365
|
});
|
|
378
366
|
});
|
|
379
367
|
describe('#buildTableHeaderRow', function () {
|
|
380
368
|
test('it renders normally', function () {
|
|
381
|
-
var wrapper = render( /*#__PURE__*/
|
|
369
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeaderRow)(buildProps(props))));
|
|
382
370
|
expect(wrapper.is('tr')).toBeTruthy();
|
|
383
371
|
expect(wrapper.is('tr.custom-tr')).toBeFalsy();
|
|
384
372
|
});
|
|
385
373
|
test('it renders a custom thead', function () {
|
|
386
374
|
var HeaderRow = function HeaderRow() {
|
|
387
|
-
return /*#__PURE__*/
|
|
375
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
388
376
|
className: "custom-tr"
|
|
389
377
|
});
|
|
390
378
|
};
|
|
391
|
-
|
|
392
379
|
props.components.HeaderRow = HeaderRow;
|
|
393
|
-
var wrapper = render( /*#__PURE__*/
|
|
380
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeaderRow)(buildProps(props))));
|
|
394
381
|
expect(wrapper.is('tr.custom-tr')).toBeTruthy();
|
|
395
382
|
});
|
|
396
383
|
});
|
|
397
384
|
describe('#buildTableHeaderCell', function () {
|
|
398
385
|
test('it renders normally', function () {
|
|
399
386
|
var column = columns.first();
|
|
400
|
-
var wrapper = render( /*#__PURE__*/
|
|
387
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeaderCell)(buildProps(props))(column, 0)));
|
|
401
388
|
expect(wrapper.is('th')).toBeTruthy();
|
|
402
389
|
expect(wrapper.is('td.custom-td')).toBeFalsy();
|
|
403
390
|
});
|
|
404
391
|
test('it renders a custom th', function () {
|
|
405
392
|
var column = columns.first();
|
|
406
|
-
|
|
407
393
|
var HeaderCell = function HeaderCell() {
|
|
408
|
-
return /*#__PURE__*/
|
|
394
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
409
395
|
className: "custom-th"
|
|
410
396
|
});
|
|
411
397
|
};
|
|
412
|
-
|
|
413
398
|
props.components.HeaderCell = HeaderCell;
|
|
414
|
-
var wrapper = render( /*#__PURE__*/
|
|
399
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeaderCell)(buildProps(props))(column, 0)));
|
|
415
400
|
expect(wrapper.is('th.custom-th')).toBeTruthy();
|
|
416
401
|
});
|
|
417
402
|
test('it renders a custom th for a specific column', function () {
|
|
418
403
|
var HeaderCell = function HeaderCell() {
|
|
419
|
-
return /*#__PURE__*/
|
|
404
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
420
405
|
className: "custom-cell-th"
|
|
421
406
|
});
|
|
422
407
|
};
|
|
423
|
-
|
|
424
|
-
props.columns = props.columns.push(Map({
|
|
408
|
+
props.columns = props.columns.push((0, _immutable.Map)({
|
|
425
409
|
value: 'displayName',
|
|
426
410
|
title: 'DisplayName',
|
|
427
411
|
components: {
|
|
@@ -430,92 +414,87 @@ describe('<Table />', function () {
|
|
|
430
414
|
}));
|
|
431
415
|
props.columnSet = props.columnSet.push('displayName');
|
|
432
416
|
var column = props.columns.last();
|
|
433
|
-
var wrapper = render( /*#__PURE__*/
|
|
417
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeaderCell)(buildProps(props))(column, 0)));
|
|
434
418
|
expect(wrapper.hasClass('custom-cell-th')).toBeTruthy();
|
|
435
419
|
});
|
|
436
420
|
});
|
|
437
421
|
describe('#buildTableBody', function () {
|
|
438
422
|
test('it renders normally', function () {
|
|
439
|
-
var wrapper = render( /*#__PURE__*/
|
|
423
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableBody)(buildProps(props))));
|
|
440
424
|
expect(wrapper.is('tbody')).toBeTruthy();
|
|
441
425
|
expect(wrapper.is('tbody.custom-tbody')).toBeFalsy();
|
|
442
426
|
});
|
|
443
427
|
test('it renders a custom tbody', function () {
|
|
444
428
|
var Header = function Header() {
|
|
445
|
-
return /*#__PURE__*/
|
|
429
|
+
return /*#__PURE__*/_react["default"].createElement("tbody", {
|
|
446
430
|
className: "custom-tbody"
|
|
447
431
|
});
|
|
448
432
|
};
|
|
449
|
-
|
|
450
433
|
props.components.Header = Header;
|
|
451
|
-
var wrapper = render( /*#__PURE__*/
|
|
434
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableHeader)(buildProps(props))));
|
|
452
435
|
expect(wrapper.is('tbody.custom-tbody')).toBeTruthy();
|
|
453
436
|
});
|
|
454
437
|
});
|
|
455
438
|
describe('#buildTableBodyRows', function () {
|
|
456
439
|
test('it renders rows normally', function () {
|
|
457
|
-
var wrapper = render( /*#__PURE__*/
|
|
440
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, (0, _Table.buildTableBodyRows)(buildProps(props))))));
|
|
458
441
|
expect(wrapper.find('tr')).toHaveLength(props.rows.size);
|
|
459
442
|
expect(wrapper.find('tr').first().hasClass('custom-tr')).toBeFalsy();
|
|
460
443
|
});
|
|
461
444
|
test('it renders custom rows', function () {
|
|
462
445
|
var BodyRow = function BodyRow() {
|
|
463
|
-
return /*#__PURE__*/
|
|
446
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
464
447
|
className: "custom-tr"
|
|
465
448
|
});
|
|
466
449
|
};
|
|
467
|
-
|
|
468
450
|
props.components.BodyRow = BodyRow;
|
|
469
|
-
var wrapper = render( /*#__PURE__*/
|
|
451
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, (0, _Table.buildTableBodyRows)(buildProps(props))))));
|
|
470
452
|
expect(wrapper.find('tr')).toHaveLength(props.rows.size);
|
|
471
453
|
expect(wrapper.find('tr').first().hasClass('custom-tr')).toBeTruthy();
|
|
472
454
|
});
|
|
473
455
|
test('it renders default empty row', function () {
|
|
474
|
-
props.rows = List([]);
|
|
475
|
-
var wrapper = render( /*#__PURE__*/
|
|
456
|
+
props.rows = (0, _immutable.List)([]);
|
|
457
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, (0, _Table.buildTableBodyRows)(buildProps(props))))));
|
|
476
458
|
expect(wrapper.find('tr')).toHaveLength(1);
|
|
477
459
|
expect(wrapper.find('tr').first().hasClass('custom-empty-tr')).toBeFalsy();
|
|
478
460
|
});
|
|
479
461
|
test('it renders custom empty row', function () {
|
|
480
462
|
var EmptyBodyRow = function EmptyBodyRow() {
|
|
481
|
-
return /*#__PURE__*/
|
|
463
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
482
464
|
className: "custom-empty-tr"
|
|
483
465
|
});
|
|
484
466
|
};
|
|
485
|
-
|
|
486
|
-
props.rows = List([]);
|
|
467
|
+
props.rows = (0, _immutable.List)([]);
|
|
487
468
|
props.components.EmptyBodyRow = EmptyBodyRow;
|
|
488
|
-
var wrapper = render( /*#__PURE__*/
|
|
469
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, (0, _Table.buildTableBodyRows)(buildProps(props))))));
|
|
489
470
|
expect(wrapper.find('tr')).toHaveLength(1);
|
|
490
471
|
expect(wrapper.find('tr').hasClass('custom-empty-tr')).toBeTruthy();
|
|
491
472
|
});
|
|
492
473
|
});
|
|
493
474
|
describe('#buildTableBodyCells', function () {
|
|
494
475
|
test('it renders cells normally', function () {
|
|
495
|
-
var wrapper = render( /*#__PURE__*/
|
|
476
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, (0, _Table.buildTableBodyCells)(buildProps(props), props.rows.first(), 0))))));
|
|
496
477
|
expect(wrapper.find('tr td')).toHaveLength(1);
|
|
497
478
|
expect(wrapper.find('tr td').first().hasClass('custom-td')).toBeFalsy();
|
|
498
479
|
});
|
|
499
480
|
test('it renders custom cells', function () {
|
|
500
481
|
var BodyCell = function BodyCell() {
|
|
501
|
-
return /*#__PURE__*/
|
|
482
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
502
483
|
className: "custom-td"
|
|
503
484
|
});
|
|
504
485
|
};
|
|
505
|
-
|
|
506
486
|
props.components.BodyCell = BodyCell;
|
|
507
|
-
var wrapper = render( /*#__PURE__*/
|
|
487
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, (0, _Table.buildTableBodyCells)(buildProps(props), props.rows.first(), 0))))));
|
|
508
488
|
expect(wrapper.find('tr td')).toHaveLength(props.columnSet.size);
|
|
509
489
|
expect(wrapper.find('tr td').first().hasClass('custom-td')).toBeTruthy();
|
|
510
490
|
});
|
|
511
491
|
test('it renders custom column cells', function () {
|
|
512
492
|
var BodyCell = function BodyCell() {
|
|
513
|
-
return /*#__PURE__*/
|
|
493
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
514
494
|
className: "custom-td"
|
|
515
495
|
});
|
|
516
496
|
};
|
|
517
|
-
|
|
518
|
-
props.columns = props.columns.push(Map({
|
|
497
|
+
props.columns = props.columns.push((0, _immutable.Map)({
|
|
519
498
|
value: 'displayName',
|
|
520
499
|
title: 'DisplayName',
|
|
521
500
|
components: {
|
|
@@ -523,7 +502,7 @@ describe('<Table />', function () {
|
|
|
523
502
|
}
|
|
524
503
|
}));
|
|
525
504
|
props.columnSet = props.columnSet.push('displayName');
|
|
526
|
-
var wrapper = render( /*#__PURE__*/
|
|
505
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, (0, _Table.buildTableBodyCells)(buildProps(props), props.rows.first(), 0))))));
|
|
527
506
|
expect(wrapper.find('tr td')).toHaveLength(props.columns.size);
|
|
528
507
|
expect(wrapper.find('tr td').first().hasClass('custom-td')).toBeFalsy();
|
|
529
508
|
expect(wrapper.find('tr td').last().hasClass('custom-td')).toBeTruthy();
|
|
@@ -531,71 +510,67 @@ describe('<Table />', function () {
|
|
|
531
510
|
});
|
|
532
511
|
describe('#buildTableFooter', function () {
|
|
533
512
|
test('it does not render normally', function () {
|
|
534
|
-
var wrapper = render( /*#__PURE__*/
|
|
513
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooter)(buildProps(props))));
|
|
535
514
|
expect(wrapper.is('tfoot')).toBeFalsy();
|
|
536
515
|
});
|
|
537
516
|
test('it renders with includeFooter', function () {
|
|
538
517
|
props.includeFooter = true;
|
|
539
|
-
var wrapper = render( /*#__PURE__*/
|
|
518
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooter)(buildProps(props))));
|
|
540
519
|
expect(wrapper.is('tfoot')).toBeTruthy();
|
|
541
520
|
expect(wrapper.is('tfoot.custom-tfoot')).toBeFalsy();
|
|
542
521
|
});
|
|
543
522
|
test('it renders a custom tfoot', function () {
|
|
544
523
|
var Footer = function Footer() {
|
|
545
|
-
return /*#__PURE__*/
|
|
524
|
+
return /*#__PURE__*/_react["default"].createElement("tfoot", {
|
|
546
525
|
className: "custom-tfoot"
|
|
547
526
|
});
|
|
548
527
|
};
|
|
549
|
-
|
|
550
528
|
props.includeFooter = true;
|
|
551
529
|
props.components.Footer = Footer;
|
|
552
|
-
var wrapper = render( /*#__PURE__*/
|
|
530
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooter)(buildProps(props))));
|
|
553
531
|
expect(wrapper.is('tfoot.custom-tfoot')).toBeTruthy();
|
|
554
532
|
});
|
|
555
533
|
});
|
|
556
534
|
describe('#buildTableFooterRow', function () {
|
|
557
535
|
test('it renders normally', function () {
|
|
558
|
-
var wrapper = render( /*#__PURE__*/
|
|
536
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooterRow)(buildProps(props))));
|
|
559
537
|
expect(wrapper.is('tr')).toBeTruthy();
|
|
560
538
|
expect(wrapper.is('tr.custom-tr')).toBeFalsy();
|
|
561
539
|
});
|
|
562
540
|
test('it renders a custom tr', function () {
|
|
563
541
|
var FooterRow = function FooterRow() {
|
|
564
|
-
return /*#__PURE__*/
|
|
542
|
+
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
565
543
|
className: "custom-tr"
|
|
566
544
|
});
|
|
567
545
|
};
|
|
568
|
-
|
|
569
546
|
props.components.FooterRow = FooterRow;
|
|
570
|
-
var wrapper = render( /*#__PURE__*/
|
|
547
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooterRow)(buildProps(props))));
|
|
571
548
|
expect(wrapper.is('tr.custom-tr')).toBeTruthy();
|
|
572
549
|
});
|
|
573
550
|
});
|
|
574
551
|
describe('#buildTableFooterCells', function () {
|
|
575
552
|
test('it renders normally', function () {
|
|
576
|
-
var wrapper = render( /*#__PURE__*/
|
|
553
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooterCells)(buildProps(props))));
|
|
577
554
|
expect(wrapper.first().is('td')).toBeTruthy();
|
|
578
555
|
expect(wrapper.first().is('td.custom-td')).toBeFalsy();
|
|
579
556
|
});
|
|
580
557
|
test('it renders a custom td', function () {
|
|
581
558
|
var FooterCell = function FooterCell() {
|
|
582
|
-
return /*#__PURE__*/
|
|
559
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
583
560
|
className: "custom-td"
|
|
584
561
|
});
|
|
585
562
|
};
|
|
586
|
-
|
|
587
563
|
props.components.FooterCell = FooterCell;
|
|
588
|
-
var wrapper = render( /*#__PURE__*/
|
|
564
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, (0, _Table.buildTableFooterCells)(buildProps(props))));
|
|
589
565
|
expect(wrapper.is('td.custom-td')).toBeTruthy();
|
|
590
566
|
});
|
|
591
567
|
test('it renders a custom td for a specific column', function () {
|
|
592
568
|
var FooterCell = function FooterCell() {
|
|
593
|
-
return /*#__PURE__*/
|
|
569
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
594
570
|
className: "custom-td"
|
|
595
571
|
});
|
|
596
572
|
};
|
|
597
|
-
|
|
598
|
-
props.columns = props.columns.push(Map({
|
|
573
|
+
props.columns = props.columns.push((0, _immutable.Map)({
|
|
599
574
|
value: 'displayName',
|
|
600
575
|
title: 'DisplayName',
|
|
601
576
|
components: {
|
|
@@ -603,7 +578,7 @@ describe('<Table />', function () {
|
|
|
603
578
|
}
|
|
604
579
|
}));
|
|
605
580
|
props.columnSet = props.columnSet.push('displayName');
|
|
606
|
-
var wrapper = render( /*#__PURE__*/
|
|
581
|
+
var wrapper = (0, _enzyme.render)( /*#__PURE__*/_react["default"].createElement(_index.KineticLib, null, /*#__PURE__*/_react["default"].createElement("tfoot", null, /*#__PURE__*/_react["default"].createElement("tr", null, (0, _Table.buildTableFooterCells)(buildProps(props))))));
|
|
607
582
|
expect(wrapper.find('td')).toHaveLength(props.columns.size);
|
|
608
583
|
expect(wrapper.find('td').first().hasClass('custom-td')).toBeFalsy();
|
|
609
584
|
expect(wrapper.find('td').last().hasClass('custom-td')).toBeTruthy();
|
|
@@ -628,13 +603,13 @@ describe('<Table />', function () {
|
|
|
628
603
|
});
|
|
629
604
|
test('combines the column config and additional columns', function () {
|
|
630
605
|
var total = columns.length + addColumns.length;
|
|
631
|
-
expect(generateColumns(columns, addColumns, alterColumns).size).toBe(total);
|
|
606
|
+
expect((0, _Table.generateColumns)(columns, addColumns, alterColumns).size).toBe(total);
|
|
632
607
|
});
|
|
633
608
|
test('alters columns with config', function () {
|
|
634
609
|
alterColumns.a = {
|
|
635
610
|
sortable: true
|
|
636
611
|
};
|
|
637
|
-
var columnConfig = generateColumns(columns, addColumns, alterColumns);
|
|
612
|
+
var columnConfig = (0, _Table.generateColumns)(columns, addColumns, alterColumns);
|
|
638
613
|
var column = columnConfig.find(function (c) {
|
|
639
614
|
return c.get('value') === columns[0].value;
|
|
640
615
|
});
|
|
@@ -644,13 +619,52 @@ describe('<Table />', function () {
|
|
|
644
619
|
alterColumns.a = {
|
|
645
620
|
value: 'c'
|
|
646
621
|
};
|
|
647
|
-
var columnConfig = generateColumns(columns, addColumns, alterColumns);
|
|
622
|
+
var columnConfig = (0, _Table.generateColumns)(columns, addColumns, alterColumns);
|
|
648
623
|
var column = columnConfig.find(function (c) {
|
|
649
624
|
return c.get('value') === 'a';
|
|
650
625
|
});
|
|
651
626
|
expect(column).not.toBeUndefined();
|
|
652
627
|
});
|
|
653
628
|
});
|
|
629
|
+
describe('#sortColumns', function () {
|
|
630
|
+
test('sort columns returns expected sort order', function () {
|
|
631
|
+
var columns = (0, _immutable.List)([(0, _immutable.Map)({
|
|
632
|
+
value: 'a',
|
|
633
|
+
title: 'A'
|
|
634
|
+
}), (0, _immutable.Map)({
|
|
635
|
+
value: 'b',
|
|
636
|
+
title: 'B'
|
|
637
|
+
}), (0, _immutable.Map)({
|
|
638
|
+
value: 'c',
|
|
639
|
+
title: 'C'
|
|
640
|
+
})]);
|
|
641
|
+
var columnSet = (0, _immutable.List)(['b', 'a']);
|
|
642
|
+
expect((0, _Table.sortColumns)(columns, columnSet).toJS().map(function (c) {
|
|
643
|
+
return c.value;
|
|
644
|
+
}).join('')).toBe('bca');
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
describe('#getToggleableColumns', function () {
|
|
648
|
+
test('toggleable columns list is correct', function () {
|
|
649
|
+
var columns = (0, _immutable.List)([(0, _immutable.Map)({
|
|
650
|
+
value: 'a',
|
|
651
|
+
title: 'A',
|
|
652
|
+
toggleable: true
|
|
653
|
+
}), (0, _immutable.Map)({
|
|
654
|
+
value: 'b',
|
|
655
|
+
title: 'B'
|
|
656
|
+
}), (0, _immutable.Map)({
|
|
657
|
+
value: 'c',
|
|
658
|
+
title: 'C'
|
|
659
|
+
}), (0, _immutable.Map)({
|
|
660
|
+
value: 'd'
|
|
661
|
+
})]);
|
|
662
|
+
var columnSet = (0, _immutable.List)(['a', 'b', 'd']);
|
|
663
|
+
expect((0, _Table.getToggleableColumns)(columns, columnSet, 'table-key').toJS().map(function (c) {
|
|
664
|
+
return c.value;
|
|
665
|
+
}).join('')).toBe('ab');
|
|
666
|
+
});
|
|
667
|
+
});
|
|
654
668
|
xdescribe('#extractColumnComponents', function () {
|
|
655
669
|
var columns, addColumns, alterColumns;
|
|
656
670
|
beforeEach(function () {
|
|
@@ -681,7 +695,7 @@ describe('<Table />', function () {
|
|
|
681
695
|
};
|
|
682
696
|
});
|
|
683
697
|
xtest('returns a map of components with overrides', function () {
|
|
684
|
-
var result = extractColumnComponents({
|
|
698
|
+
var result = (0, _Table.extractColumnComponents)({
|
|
685
699
|
columns: columns,
|
|
686
700
|
addColumns: addColumns,
|
|
687
701
|
alterColumns: alterColumns
|