@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,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
10
|
+
var tokenEndpointPattern = /\/app\/(loghub|system-coordinator)\/(refresh|components|api\/v\d)/;
|
|
5
11
|
var RequestInterceptor = /*#__PURE__*/function () {
|
|
6
12
|
function RequestInterceptor(store) {
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
(0, _classCallCheck2["default"])(this, RequestInterceptor);
|
|
9
14
|
this.store = store;
|
|
10
15
|
this.initPromise = new Promise(function (resolve) {
|
|
11
16
|
var unsub = store.subscribe(function () {
|
|
@@ -17,39 +22,31 @@ var RequestInterceptor = /*#__PURE__*/function () {
|
|
|
17
22
|
});
|
|
18
23
|
this.handleFulfilled = this.handleFulfilled.bind(this);
|
|
19
24
|
}
|
|
20
|
-
|
|
21
|
-
_createClass(RequestInterceptor, [{
|
|
25
|
+
(0, _createClass2["default"])(RequestInterceptor, [{
|
|
22
26
|
key: "handleFulfilled",
|
|
23
27
|
value: function handleFulfilled(config) {
|
|
24
28
|
var _this = this;
|
|
25
|
-
|
|
26
29
|
return config.__bypassInitInterceptor ? config : this.initPromise.then(function () {
|
|
27
30
|
var _this$store$getState$ = _this.store.getState().get('session').toObject(),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
csrfToken = _this$store$getState$.csrfToken,
|
|
32
|
+
loggedIn = _this$store$getState$.loggedIn,
|
|
33
|
+
token = _this$store$getState$.token;
|
|
32
34
|
if (!loggedIn) {
|
|
33
35
|
config.__bypassAuthInterceptor = true;
|
|
34
36
|
}
|
|
35
|
-
|
|
36
37
|
if (token && config.url.match(tokenEndpointPattern)) {
|
|
37
38
|
config.headers.Authorization = 'Bearer ' + token;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
40
|
if (csrfToken) {
|
|
41
41
|
// we need to set xsrfCookieName otherwise axios will override the
|
|
42
42
|
// xsrf header that we set manually
|
|
43
43
|
config.xsrfCookieName = 'DONT_USE_COOKIES_FOR_XSRF_TOKEN';
|
|
44
44
|
config.headers['X-XSRF-TOKEN'] = csrfToken;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
46
|
return config;
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
}]);
|
|
51
|
-
|
|
52
50
|
return RequestInterceptor;
|
|
53
51
|
}();
|
|
54
|
-
|
|
55
|
-
export { RequestInterceptor as default };
|
|
52
|
+
exports["default"] = RequestInterceptor;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
"use strict";
|
|
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.CodeInput = void 0;
|
|
9
|
+
var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toArray"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
13
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
|
15
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper"));
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _draftJs = require("draft-js");
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
var _reactPopper = require("react-popper");
|
|
20
|
+
var _draftHelpers = require("./draftHelpers");
|
|
21
|
+
var _languageHelpers = require("./languageHelpers");
|
|
22
|
+
var _Scroller = require("../Scroller");
|
|
23
|
+
var CodeInput = /*#__PURE__*/function (_Component) {
|
|
24
|
+
(0, _inherits2["default"])(CodeInput, _Component);
|
|
25
|
+
var _super = (0, _createSuper2["default"])(CodeInput);
|
|
20
26
|
function CodeInput(props) {
|
|
21
27
|
var _this;
|
|
22
|
-
|
|
23
|
-
_classCallCheck(this, CodeInput);
|
|
24
|
-
|
|
28
|
+
(0, _classCallCheck2["default"])(this, CodeInput);
|
|
25
29
|
_this = _super.call(this, props);
|
|
26
|
-
|
|
27
30
|
_this.onMetaChange = function (editorState) {
|
|
28
31
|
_this.setState({
|
|
29
32
|
editorState: editorState
|
|
30
33
|
});
|
|
31
34
|
};
|
|
32
|
-
|
|
33
35
|
_this.onChange = function (editorState) {
|
|
34
|
-
var nextEditorState = apply(editorState, checkFocus, checkSelectionEntities, checkSelectionPosition, applyFilter(_this.props.bindings));
|
|
35
|
-
var entities = getEntities(nextEditorState);
|
|
36
|
+
var nextEditorState = (0, _draftHelpers.apply)(editorState, _draftHelpers.checkFocus, _draftHelpers.checkSelectionEntities, _draftHelpers.checkSelectionPosition, (0, _draftHelpers.applyFilter)(_this.props.bindings));
|
|
37
|
+
var entities = (0, _draftHelpers.getEntities)(nextEditorState);
|
|
36
38
|
var valueChanged = _this.state.editorState.getCurrentContent().getFirstBlock().getText() !== nextEditorState.getCurrentContent().getFirstBlock().getText();
|
|
37
|
-
|
|
38
39
|
_this.setState({
|
|
39
40
|
editorState: nextEditorState,
|
|
40
41
|
typeaheadOpen: !entities.isEmpty(),
|
|
@@ -45,78 +46,61 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
};
|
|
48
|
-
|
|
49
49
|
_this.handleDroppedFiles = function (selection, _ref) {
|
|
50
|
-
var _ref2 =
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 1),
|
|
51
|
+
file = _ref2[0];
|
|
53
52
|
if (typeof _this.props.onChange === 'function') {
|
|
54
53
|
var fileReader = new FileReader();
|
|
55
|
-
|
|
56
54
|
fileReader.onloadend = function () {
|
|
57
55
|
_this.props.onChange(fileReader.result);
|
|
58
56
|
};
|
|
59
|
-
|
|
60
57
|
fileReader.readAsText(file);
|
|
61
58
|
}
|
|
62
59
|
};
|
|
63
|
-
|
|
64
60
|
_this.handleKeyCommand = function (command, editorState) {
|
|
65
61
|
if (command === 'start-typeahead') {
|
|
66
|
-
_this.onChange(startTypeahead(editorState));
|
|
62
|
+
_this.onChange((0, _draftHelpers.startTypeahead)(editorState));
|
|
67
63
|
}
|
|
68
|
-
|
|
69
64
|
if (command === 'close-typeahead') {
|
|
70
|
-
_this.onChange(closeTypeahead(editorState));
|
|
65
|
+
_this.onChange((0, _draftHelpers.closeTypeahead)(editorState));
|
|
71
66
|
}
|
|
72
|
-
|
|
73
67
|
if (command === 'insert-tab') {
|
|
74
|
-
_this.onChange(insertText({
|
|
68
|
+
_this.onChange((0, _draftHelpers.insertText)({
|
|
75
69
|
text: _this.indentation
|
|
76
70
|
})(_this.state.editorState));
|
|
77
71
|
}
|
|
78
|
-
|
|
79
72
|
if (command === 'insert-newline') {
|
|
80
|
-
var currentIndentation = getCurrentIndentation(_this.newLine, _this.state.editorState);
|
|
81
|
-
|
|
82
|
-
_this.onChange(insertText({
|
|
73
|
+
var currentIndentation = (0, _draftHelpers.getCurrentIndentation)(_this.newLine, _this.state.editorState);
|
|
74
|
+
_this.onChange((0, _draftHelpers.insertText)({
|
|
83
75
|
text: _this.newLine + currentIndentation
|
|
84
76
|
})(_this.state.editorState));
|
|
85
77
|
}
|
|
86
|
-
|
|
87
78
|
if (command === 'select-typeahead-option') {
|
|
88
|
-
var _getEntities$last$dat = getEntities(_this.state.editorState).last().data,
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
var _getEntities$last$dat = (0, _draftHelpers.getEntities)(_this.state.editorState).last().data,
|
|
80
|
+
options = _getEntities$last$dat.options,
|
|
81
|
+
active = _getEntities$last$dat.active;
|
|
91
82
|
var activeOption = options.get(active);
|
|
92
|
-
|
|
93
83
|
if (activeOption) {
|
|
94
84
|
var label = activeOption.label,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
selectTypeaheadItem(
|
|
85
|
+
value = activeOption.value,
|
|
86
|
+
selection = activeOption.selection;
|
|
87
|
+
(0, _draftHelpers.selectTypeaheadItem)((0, _assertThisInitialized2["default"])(_this))(label, value, selection)();
|
|
98
88
|
}
|
|
99
89
|
}
|
|
100
|
-
|
|
101
90
|
if (command === 'next-typeahead-option') {
|
|
102
|
-
_this.onMetaChange(nextTypeaheadItem(editorState));
|
|
91
|
+
_this.onMetaChange((0, _draftHelpers.nextTypeaheadItem)(editorState));
|
|
103
92
|
}
|
|
104
|
-
|
|
105
93
|
if (command === 'previous-typeahead-option') {
|
|
106
|
-
_this.onMetaChange(previousTypeaheadItem(editorState));
|
|
94
|
+
_this.onMetaChange((0, _draftHelpers.previousTypeaheadItem)(editorState));
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
return 'not-handled';
|
|
110
97
|
};
|
|
111
|
-
|
|
112
98
|
_this.handlePastedText = function (text, html, editorState) {
|
|
113
|
-
_this.onChange(insertText({
|
|
99
|
+
_this.onChange((0, _draftHelpers.insertText)({
|
|
114
100
|
text: text
|
|
115
101
|
})(editorState));
|
|
116
|
-
|
|
117
102
|
return true;
|
|
118
103
|
};
|
|
119
|
-
|
|
120
104
|
_this.keyBindingFn = function (event) {
|
|
121
105
|
if (_this.state.typeaheadOpen) {
|
|
122
106
|
if (event.keyCode === 27) {
|
|
@@ -139,10 +123,8 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
139
123
|
return 'insert-newline';
|
|
140
124
|
}
|
|
141
125
|
}
|
|
142
|
-
|
|
143
|
-
return getDefaultKeyBinding(event);
|
|
126
|
+
return (0, _draftJs.getDefaultKeyBinding)(event);
|
|
144
127
|
};
|
|
145
|
-
|
|
146
128
|
_this.onKeyUp = function (event) {
|
|
147
129
|
// since we are not able to stop propagation in keyBindingFn above, we set a
|
|
148
130
|
// boolean there and this onKeyUp handler (that fires afterwards) checks for
|
|
@@ -152,11 +134,9 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
152
134
|
event.stopPropagation();
|
|
153
135
|
}
|
|
154
136
|
};
|
|
155
|
-
|
|
156
137
|
_this.startTypeahead = function () {
|
|
157
|
-
_this.onChange(startTypeahead(_this.state.editorState));
|
|
138
|
+
_this.onChange((0, _draftHelpers.startTypeahead)(_this.state.editorState));
|
|
158
139
|
};
|
|
159
|
-
|
|
160
140
|
_this.copy = function () {
|
|
161
141
|
var el = document.createElement('textarea');
|
|
162
142
|
el.value = _this.state.editorState.getCurrentContent().getFirstBlock().getText();
|
|
@@ -165,92 +145,89 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
165
145
|
document.execCommand('copy');
|
|
166
146
|
document.body.removeChild(el);
|
|
167
147
|
};
|
|
168
|
-
|
|
169
148
|
_this.newLine = '\n';
|
|
170
149
|
_this.indentation = ' ';
|
|
171
150
|
_this.state = {
|
|
172
|
-
editorState: EditorState.createWithContent(convertFromRaw({
|
|
151
|
+
editorState: _draftJs.EditorState.createWithContent((0, _draftJs.convertFromRaw)({
|
|
173
152
|
entityMap: {},
|
|
174
153
|
blocks: [{
|
|
175
154
|
text: props.value
|
|
176
155
|
}]
|
|
177
|
-
}), new CompositeDecorator([{
|
|
178
|
-
strategy: findByEntityType('typeahead-start'),
|
|
156
|
+
}), new _draftJs.CompositeDecorator([{
|
|
157
|
+
strategy: (0, _draftHelpers.findByEntityType)('typeahead-start'),
|
|
179
158
|
component: function component(props) {
|
|
180
|
-
return /*#__PURE__*/
|
|
181
|
-
className:
|
|
159
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
160
|
+
className: (0, _classnames["default"])('code typeahead-start', {
|
|
182
161
|
'typeahead-tentative': _this.state.typeaheadTentative
|
|
183
162
|
})
|
|
184
163
|
}, props.children);
|
|
185
164
|
}
|
|
186
165
|
}, {
|
|
187
|
-
strategy: findByEntityType('typeahead-selection'),
|
|
166
|
+
strategy: (0, _draftHelpers.findByEntityType)('typeahead-selection'),
|
|
188
167
|
component: function component(props) {
|
|
189
|
-
return /*#__PURE__*/
|
|
168
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
190
169
|
className: "code typeahead-selection"
|
|
191
170
|
}, props.children);
|
|
192
171
|
}
|
|
193
172
|
}, {
|
|
194
|
-
strategy: findByEntityType('typeahead-filter'),
|
|
173
|
+
strategy: (0, _draftHelpers.findByEntityType)('typeahead-filter'),
|
|
195
174
|
component: function component(_ref3) {
|
|
196
175
|
var children = _ref3.children,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
176
|
+
entityKey = _ref3.entityKey,
|
|
177
|
+
contentState = _ref3.contentState;
|
|
200
178
|
var _contentState$getEnti = contentState.getEntity(entityKey).getData(),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref4) {
|
|
179
|
+
options = _contentState$getEnti.options,
|
|
180
|
+
active = _contentState$getEnti.active;
|
|
181
|
+
return /*#__PURE__*/_react["default"].createElement(_reactPopper.Manager, null, /*#__PURE__*/_react["default"].createElement(_reactPopper.Reference, null, function (_ref4) {
|
|
205
182
|
var ref = _ref4.ref;
|
|
206
|
-
return /*#__PURE__*/
|
|
183
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
207
184
|
ref: ref,
|
|
208
|
-
className:
|
|
185
|
+
className: (0, _classnames["default"])('code typeahead-filter', {
|
|
209
186
|
'typeahead-tentative': _this.state.typeaheadTentative
|
|
210
187
|
})
|
|
211
188
|
}, children);
|
|
212
|
-
}), /*#__PURE__*/
|
|
189
|
+
}), /*#__PURE__*/_react["default"].createElement(_reactPopper.Popper, {
|
|
213
190
|
placement: "bottom-start"
|
|
214
191
|
}, function (_ref5) {
|
|
215
192
|
var ref = _ref5.ref,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return /*#__PURE__*/
|
|
193
|
+
style = _ref5.style,
|
|
194
|
+
placement = _ref5.placement;
|
|
195
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
219
196
|
ref: ref,
|
|
220
197
|
style: style,
|
|
221
198
|
"data-placement": placement,
|
|
222
199
|
className: "variable-typeahead-menu",
|
|
223
200
|
contentEditable: false
|
|
224
|
-
}, /*#__PURE__*/
|
|
201
|
+
}, /*#__PURE__*/_react["default"].createElement(_Scroller.Scroller, null, function (_ref6) {
|
|
225
202
|
var parentRef = _ref6.parentRef,
|
|
226
|
-
|
|
227
|
-
return /*#__PURE__*/
|
|
203
|
+
childRef = _ref6.childRef;
|
|
204
|
+
return /*#__PURE__*/_react["default"].createElement("ul", {
|
|
228
205
|
ref: parentRef
|
|
229
206
|
}, options.map(function (_ref7, i) {
|
|
230
207
|
var label = _ref7.label,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return /*#__PURE__*/
|
|
236
|
-
className:
|
|
208
|
+
children = _ref7.children,
|
|
209
|
+
value = _ref7.value,
|
|
210
|
+
selection = _ref7.selection,
|
|
211
|
+
tags = _ref7.tags;
|
|
212
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
213
|
+
className: (0, _classnames["default"])({
|
|
237
214
|
active: i === active
|
|
238
215
|
}),
|
|
239
216
|
key: label,
|
|
240
|
-
onClick: selectTypeaheadItem(
|
|
217
|
+
onClick: (0, _draftHelpers.selectTypeaheadItem)((0, _assertThisInitialized2["default"])(_this))(label, value, selection),
|
|
241
218
|
style: {
|
|
242
219
|
userSelect: 'none',
|
|
243
220
|
MozUserSelect: 'none'
|
|
244
221
|
},
|
|
245
222
|
ref: i === active ? childRef : null
|
|
246
|
-
}, /*#__PURE__*/
|
|
223
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, label), /*#__PURE__*/_react["default"].createElement("span", {
|
|
247
224
|
className: "tags"
|
|
248
225
|
}, tags && tags.map(function (tag, i) {
|
|
249
|
-
return /*#__PURE__*/
|
|
226
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
250
227
|
key: i,
|
|
251
228
|
className: "tag"
|
|
252
229
|
}, tag);
|
|
253
|
-
})), children && /*#__PURE__*/
|
|
230
|
+
})), children && /*#__PURE__*/_react["default"].createElement("i", {
|
|
254
231
|
className: "fa fa-chevron-right"
|
|
255
232
|
}));
|
|
256
233
|
}));
|
|
@@ -259,58 +236,51 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
259
236
|
}
|
|
260
237
|
}, {
|
|
261
238
|
strategy: function strategy(contentBlock, callback, contentState) {
|
|
262
|
-
var entities = getEntitiesImpl(contentBlock, contentState);
|
|
239
|
+
var entities = (0, _draftHelpers.getEntitiesImpl)(contentBlock, contentState);
|
|
263
240
|
var typeaheadStart = entities.isEmpty() ? null : entities.first().start;
|
|
264
241
|
var typeaheadEnd = entities.isEmpty() ? null : entities.last().end;
|
|
265
242
|
var text = typeaheadStart !== null ? contentBlock.getText().slice(0, typeaheadStart) + ' '.repeat(typeaheadEnd - typeaheadStart) + contentBlock.getText().slice(typeaheadEnd) : contentBlock.getText();
|
|
266
|
-
var processor = props.language === 'js' ? processJavaScript : props.language === 'js-template' ? processJavaScriptTemplate : props.language === 'ruby' ? processRuby : props.language === 'erb' ? processErbTemplate : null;
|
|
267
|
-
|
|
243
|
+
var processor = props.language === 'js' ? _languageHelpers.processJavaScript : props.language === 'js-template' ? _languageHelpers.processJavaScriptTemplate : props.language === 'ruby' ? _languageHelpers.processRuby : props.language === 'erb' ? _languageHelpers.processErbTemplate : null;
|
|
268
244
|
if (processor) {
|
|
269
245
|
_this.tokenStarts = {};
|
|
270
246
|
_this.tokenEnds = {};
|
|
271
247
|
processor(text).reduce(function (start, _ref8) {
|
|
272
|
-
var _ref9 =
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
248
|
+
var _ref9 = (0, _toArray2["default"])(_ref8),
|
|
249
|
+
content = _ref9[0],
|
|
250
|
+
type = _ref9.slice(1);
|
|
276
251
|
var end = start + content.length;
|
|
277
252
|
_this.tokenStarts[start] = type;
|
|
278
253
|
_this.tokenEnds[end] = type;
|
|
279
|
-
|
|
280
254
|
if (start < typeaheadStart && end > typeaheadStart) {
|
|
281
255
|
callback(start, typeaheadStart);
|
|
282
256
|
}
|
|
283
|
-
|
|
284
257
|
if (start < typeaheadEnd && end > typeaheadEnd) {
|
|
285
258
|
callback(typeaheadEnd, end);
|
|
286
259
|
}
|
|
287
|
-
|
|
288
260
|
if (!(start < typeaheadStart && end > typeaheadStart) && !(start < typeaheadEnd && end > typeaheadEnd)) {
|
|
289
261
|
callback(start, end);
|
|
290
262
|
}
|
|
291
|
-
|
|
292
263
|
return end;
|
|
293
264
|
}, 0);
|
|
294
265
|
}
|
|
295
266
|
},
|
|
296
267
|
component: function component(_ref10) {
|
|
297
268
|
var children = _ref10.children,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return /*#__PURE__*/
|
|
301
|
-
className:
|
|
269
|
+
start = _ref10.start,
|
|
270
|
+
end = _ref10.end;
|
|
271
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
272
|
+
className: (0, _classnames["default"])('code', _this.tokenStarts[start] || _this.tokenEnds[end])
|
|
302
273
|
}, children);
|
|
303
274
|
}
|
|
304
275
|
}]))
|
|
305
276
|
};
|
|
306
277
|
return _this;
|
|
307
278
|
}
|
|
308
|
-
|
|
309
|
-
_createClass(CodeInput, [{
|
|
279
|
+
(0, _createClass2["default"])(CodeInput, [{
|
|
310
280
|
key: "componentDidUpdate",
|
|
311
281
|
value: function componentDidUpdate(prevProps, prevState, snapshot) {
|
|
312
282
|
if (this.props.value !== prevProps.value && this.props.value !== this.state.editorState.getCurrentContent().getFirstBlock().getText()) {
|
|
313
|
-
this.onChange(EditorState.push(this.state.editorState, convertFromRaw({
|
|
283
|
+
this.onChange(_draftJs.EditorState.push(this.state.editorState, (0, _draftJs.convertFromRaw)({
|
|
314
284
|
entityMap: {},
|
|
315
285
|
blocks: [{
|
|
316
286
|
text: this.props.value
|
|
@@ -326,7 +296,7 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
326
296
|
onKeyUp: this.onKeyUp
|
|
327
297
|
},
|
|
328
298
|
copy: this.copy,
|
|
329
|
-
editor: /*#__PURE__*/
|
|
299
|
+
editor: /*#__PURE__*/_react["default"].createElement(_draftJs.Editor, {
|
|
330
300
|
readOnly: this.props.disabled,
|
|
331
301
|
editorState: this.state.editorState,
|
|
332
302
|
onFocus: this.props.onFocus,
|
|
@@ -342,6 +312,6 @@ export var CodeInput = /*#__PURE__*/function (_Component) {
|
|
|
342
312
|
});
|
|
343
313
|
}
|
|
344
314
|
}]);
|
|
345
|
-
|
|
346
315
|
return CodeInput;
|
|
347
|
-
}(Component);
|
|
316
|
+
}(_react.Component);
|
|
317
|
+
exports.CodeInput = CodeInput;
|