@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.
Files changed (305) hide show
  1. package/assets/task/icons/drag-handle.svg +3 -0
  2. package/assets/task/icons/plus_small.svg +2 -4
  3. package/lib/apis/agent/adapters.js +16 -12
  4. package/lib/apis/agent/bridges.js +54 -41
  5. package/lib/apis/agent/handlers.js +51 -38
  6. package/lib/apis/core/activity.js +19 -11
  7. package/lib/apis/core/attributeDefinitions.js +54 -46
  8. package/lib/apis/core/attributeDefinitions.test.js +47 -55
  9. package/lib/apis/core/authentication.js +58 -63
  10. package/lib/apis/core/backgroundJobs.js +38 -30
  11. package/lib/apis/core/bridgeModelAttributeMappings.js +42 -34
  12. package/lib/apis/core/bridgeModelAttributes.js +47 -37
  13. package/lib/apis/core/bridgeModelMappings.js +42 -34
  14. package/lib/apis/core/bridgeModelQualificationMappings.js +42 -34
  15. package/lib/apis/core/bridgeModelQualifications.js +42 -34
  16. package/lib/apis/core/bridgeModels.js +56 -46
  17. package/lib/apis/core/bridgeModels.test.js +64 -80
  18. package/lib/apis/core/bridgedresources.js +64 -72
  19. package/lib/apis/core/bridgedresources.test.js +33 -30
  20. package/lib/apis/core/categories.js +59 -52
  21. package/lib/apis/core/categories.test.js +36 -33
  22. package/lib/apis/core/fileResources.js +41 -33
  23. package/lib/apis/core/filestores.js +42 -34
  24. package/lib/apis/core/formTypes.js +50 -44
  25. package/lib/apis/core/forms.js +53 -49
  26. package/lib/apis/core/forms.test.js +60 -74
  27. package/lib/apis/core/kapps.js +45 -39
  28. package/lib/apis/core/kapps.test.js +45 -52
  29. package/lib/apis/core/logs.js +20 -16
  30. package/lib/apis/core/memberships.js +23 -20
  31. package/lib/apis/core/meta.js +31 -19
  32. package/lib/apis/core/notices.js +17 -9
  33. package/lib/apis/core/oauthClients.js +49 -45
  34. package/lib/apis/core/platformComponents.js +73 -57
  35. package/lib/apis/core/platformItems.js +22 -13
  36. package/lib/apis/core/profile.js +28 -21
  37. package/lib/apis/core/profile.test.js +20 -17
  38. package/lib/apis/core/securityPolicyDefinitions.js +48 -41
  39. package/lib/apis/core/securityPolicyDefinitions.test.js +50 -60
  40. package/lib/apis/core/space.js +23 -16
  41. package/lib/apis/core/space.test.js +31 -38
  42. package/lib/apis/core/submissions.js +213 -186
  43. package/lib/apis/core/submissions.test.js +39 -36
  44. package/lib/apis/core/teams.js +51 -44
  45. package/lib/apis/core/teams.test.js +42 -39
  46. package/lib/apis/core/translations.js +123 -130
  47. package/lib/apis/core/translations.test.js +278 -368
  48. package/lib/apis/core/users.js +56 -49
  49. package/lib/apis/core/users.test.js +42 -39
  50. package/lib/apis/core/version.js +20 -11
  51. package/lib/apis/core/webApis.js +42 -34
  52. package/lib/apis/core/webhooks.js +48 -41
  53. package/lib/apis/core/webhooks.test.js +50 -60
  54. package/lib/apis/core/webhooksJobs.js +30 -26
  55. package/lib/apis/core/workflows.js +52 -44
  56. package/lib/apis/http.js +89 -80
  57. package/lib/apis/http.test.js +37 -38
  58. package/lib/apis/index.js +506 -50
  59. package/lib/apis/system/index.js +228 -211
  60. package/lib/apis/task/index.js +280 -227
  61. package/lib/components/agent/bridge/BridgeForm.js +50 -50
  62. package/lib/components/agent/bridge/BridgeTable.js +12 -8
  63. package/lib/components/agent/filestore/FilestoreForm.js +49 -48
  64. package/lib/components/agent/filestore/FilestoreTable.js +12 -8
  65. package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
  66. package/lib/components/agent/handler/AgentHandlerTable.js +12 -8
  67. package/lib/components/common/AttributeSelect.js +15 -9
  68. package/lib/components/common/BridgeSelect.js +48 -43
  69. package/lib/components/common/ComponentConfigContext.js +9 -2
  70. package/lib/components/common/ContentEditable.js +36 -60
  71. package/lib/components/common/FormSelect.js +70 -58
  72. package/lib/components/common/NodeSelect.js +23 -19
  73. package/lib/components/common/Scroller.js +24 -23
  74. package/lib/components/common/StaticSelect.js +57 -50
  75. package/lib/components/common/TableInput.js +54 -57
  76. package/lib/components/common/TeamSelect.js +42 -39
  77. package/lib/components/common/Typeahead.js +121 -138
  78. package/lib/components/common/UserSelect.js +42 -41
  79. package/lib/components/common/authentication/AuthInterceptor.js +15 -19
  80. package/lib/components/common/authentication/AuthInterceptor.test.js +46 -64
  81. package/lib/components/common/authentication/AuthenticationContainer.js +350 -454
  82. package/lib/components/common/authentication/RequestInterceptor.js +16 -19
  83. package/lib/components/common/code_input/CodeInput.js +92 -122
  84. package/lib/components/common/code_input/draftHelpers.js +96 -90
  85. package/lib/components/common/code_input/languageHelpers.js +49 -47
  86. package/lib/components/common/code_input/languageHelpers.test.js +21 -16
  87. package/lib/components/core/CoreFormModal.js +26 -24
  88. package/lib/components/core/CoreModal.js +37 -31
  89. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +24 -23
  90. package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +18 -15
  91. package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
  92. package/lib/components/core/bridge_model/BridgeModelTable.js +12 -8
  93. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +17 -16
  94. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +25 -21
  95. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +20 -20
  96. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +27 -22
  97. package/lib/components/core/category/CategoryForm.js +22 -22
  98. package/lib/components/core/category/CategoryTable.js +15 -10
  99. package/lib/components/core/core_form/CoreForm.js +209 -285
  100. package/lib/components/core/core_form/CoreForm.test.js +12 -10
  101. package/lib/components/core/core_form/defaults/index.js +52 -44
  102. package/lib/components/core/core_form/globals.js +14 -5
  103. package/lib/components/core/field_definition/FieldDefinitionForm.js +23 -21
  104. package/lib/components/core/field_definition/FieldDefinitionTable.js +15 -10
  105. package/lib/components/core/file_resource/FileResourceForm.js +38 -37
  106. package/lib/components/core/file_resource/FileResourceTable.js +16 -12
  107. package/lib/components/core/form/FormForm.js +56 -61
  108. package/lib/components/core/form/FormTable.js +25 -22
  109. package/lib/components/core/form_type/FormTypeForm.js +14 -13
  110. package/lib/components/core/form_type/FormTypeTable.js +12 -8
  111. package/lib/components/core/i18n/I18n.js +54 -61
  112. package/lib/components/core/i18n/I18nContext.js +9 -2
  113. package/lib/components/core/i18n/I18nProvider.js +40 -43
  114. package/lib/components/core/i18n/Moment.js +40 -50
  115. package/lib/components/core/index_definition/IndexDefinitionForm.js +23 -24
  116. package/lib/components/core/index_definition/IndexDefinitionTable.js +19 -11
  117. package/lib/components/core/index_job/IndexJobTable.js +20 -15
  118. package/lib/components/core/kapp/KappForm.js +57 -58
  119. package/lib/components/core/kapp/KappTable.js +17 -12
  120. package/lib/components/core/log/LogTable.js +35 -33
  121. package/lib/components/core/oauth_client/OAuthClientForm.js +17 -17
  122. package/lib/components/core/oauth_client/OAuthClientTable.js +12 -8
  123. package/lib/components/core/platform_component/AgentComponentForm.js +15 -15
  124. package/lib/components/core/platform_component/AgentComponentTable.js +10 -5
  125. package/lib/components/core/platform_component/TaskComponentForm.js +14 -14
  126. package/lib/components/core/profile/ProfileForm.js +40 -39
  127. package/lib/components/core/security_definition/SecurityDefinitionForm.js +28 -25
  128. package/lib/components/core/security_definition/SecurityDefinitionTable.js +18 -13
  129. package/lib/components/core/space/SpaceForm.js +79 -90
  130. package/lib/components/core/submission/DatastoreSubmissionFilters.js +39 -40
  131. package/lib/components/core/submission/DatastoreSubmissionTable.js +37 -34
  132. package/lib/components/core/submission/FormSubmissionFilters.js +79 -75
  133. package/lib/components/core/submission/FormSubmissionTable.js +27 -20
  134. package/lib/components/core/submission/KappSubmissionTable.js +30 -29
  135. package/lib/components/core/submission/SubmissionForm.js +126 -55
  136. package/lib/components/core/submission/SubmissionTable.js +24 -20
  137. package/lib/components/core/submission/helpers.js +37 -33
  138. package/lib/components/core/submission/helpers.test.js +69 -20
  139. package/lib/components/core/team/TeamForm.js +24 -21
  140. package/lib/components/core/team/TeamTable.js +16 -11
  141. package/lib/components/core/translation/ContextForm.js +13 -10
  142. package/lib/components/core/translation/ContextTable.js +13 -10
  143. package/lib/components/core/translation/EntryForm.js +27 -24
  144. package/lib/components/core/translation/EntryTable.js +19 -16
  145. package/lib/components/core/translation/LocaleForm.js +16 -13
  146. package/lib/components/core/translation/LocaleTable.js +12 -8
  147. package/lib/components/core/user/UserForm.js +38 -37
  148. package/lib/components/core/user/UserTable.js +19 -15
  149. package/lib/components/core/webapi/WebApiForm.js +49 -61
  150. package/lib/components/core/webapi/WebApiTable.js +14 -10
  151. package/lib/components/core/webhook/WebhookForm.js +33 -32
  152. package/lib/components/core/webhook/WebhookTable.js +22 -20
  153. package/lib/components/core/webhook_job/WebhookJobTable.js +19 -16
  154. package/lib/components/form/Form.helpers.js +102 -90
  155. package/lib/components/form/Form.js +467 -524
  156. package/lib/components/form/Form.models.js +38 -24
  157. package/lib/components/form/FormState.js +8 -5
  158. package/lib/components/form/KitchenSinkForm.js +135 -4
  159. package/lib/components/form/defaults/AttributesField.js +48 -59
  160. package/lib/components/form/defaults/CheckboxField.js +14 -6
  161. package/lib/components/form/defaults/CodeField.js +15 -7
  162. package/lib/components/form/defaults/FormButtons.js +12 -4
  163. package/lib/components/form/defaults/FormError.js +12 -4
  164. package/lib/components/form/defaults/FormField.js +15 -7
  165. package/lib/components/form/defaults/FormLayout.js +12 -4
  166. package/lib/components/form/defaults/FormMultiField.js +15 -7
  167. package/lib/components/form/defaults/PasswordField.js +14 -6
  168. package/lib/components/form/defaults/RadioField.js +15 -7
  169. package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +17 -9
  170. package/lib/components/form/defaults/SelectField.js +16 -8
  171. package/lib/components/form/defaults/SelectMultiField.js +15 -7
  172. package/lib/components/form/defaults/TableField.js +14 -6
  173. package/lib/components/form/defaults/TeamField.js +15 -7
  174. package/lib/components/form/defaults/TeamMultiField.js +15 -7
  175. package/lib/components/form/defaults/TextField.js +14 -6
  176. package/lib/components/form/defaults/TextMultiField.js +26 -28
  177. package/lib/components/form/defaults/UserField.js +15 -7
  178. package/lib/components/form/defaults/UserMultiField.js +15 -7
  179. package/lib/components/form/defaults/index.js +48 -41
  180. package/lib/components/form/tests/Form.test.js +568 -864
  181. package/lib/components/form/tests/components.js +15 -25
  182. package/lib/components/form/tests/helpers.test.js +35 -33
  183. package/lib/components/index.js +981 -135
  184. package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
  185. package/lib/components/system/SystemFilestoreForm.js +28 -25
  186. package/lib/components/system/SystemForm.js +19 -16
  187. package/lib/components/system/SystemIngressForm.js +10 -9
  188. package/lib/components/system/SystemSecurityForm.js +17 -14
  189. package/lib/components/system/SystemSmtpForm.js +13 -13
  190. package/lib/components/system/SystemTaskAdapterForm.js +21 -17
  191. package/lib/components/system/SystemUserForm.js +15 -14
  192. package/lib/components/system/helpers.js +62 -60
  193. package/lib/components/system/helpers.test.js +16 -12
  194. package/lib/components/system/spaces/SystemSpaceForm.js +25 -24
  195. package/lib/components/system/spaces/SystemTenantForm.js +43 -40
  196. package/lib/components/system/spaces/SystemTenantTable.js +12 -8
  197. package/lib/components/table/Table.js +211 -224
  198. package/lib/components/table/Table.redux.js +292 -329
  199. package/lib/components/table/Table.redux.test.js +49 -47
  200. package/lib/components/table/Table.test.js +107 -132
  201. package/lib/components/table/defaults/BodyCell.js +12 -6
  202. package/lib/components/table/defaults/BodyRow.js +10 -4
  203. package/lib/components/table/defaults/BooleanFilter.js +17 -11
  204. package/lib/components/table/defaults/EmptyBodyRow.js +12 -6
  205. package/lib/components/table/defaults/FilterLayout.js +17 -11
  206. package/lib/components/table/defaults/Footer.js +11 -5
  207. package/lib/components/table/defaults/FooterCell.js +10 -4
  208. package/lib/components/table/defaults/FooterRow.js +10 -4
  209. package/lib/components/table/defaults/Header.js +10 -4
  210. package/lib/components/table/defaults/HeaderCell.js +16 -10
  211. package/lib/components/table/defaults/HeaderRow.js +10 -4
  212. package/lib/components/table/defaults/PaginationControl.js +18 -9
  213. package/lib/components/table/defaults/TableBody.js +10 -4
  214. package/lib/components/table/defaults/TableLayout.js +12 -6
  215. package/lib/components/table/defaults/TextFilter.js +16 -10
  216. package/lib/components/table/defaults/index.js +41 -33
  217. package/lib/components/task/builder/Connector.js +100 -111
  218. package/lib/components/task/builder/ConnectorForm.js +17 -11
  219. package/lib/components/task/builder/Node.js +101 -83
  220. package/lib/components/task/builder/NodeForm.js +30 -27
  221. package/lib/components/task/builder/NodeParametersForm.js +27 -24
  222. package/lib/components/task/builder/SvgCanvas.js +67 -96
  223. package/lib/components/task/builder/SvgText.js +19 -134
  224. package/lib/components/task/builder/TaskDefinitionConfigForm.js +27 -22
  225. package/lib/components/task/builder/TreeBuilder.js +140 -115
  226. package/lib/components/task/builder/builder.redux.js +311 -326
  227. package/lib/components/task/builder/constants.js +94 -45
  228. package/lib/components/task/builder/helpers.js +184 -173
  229. package/lib/components/task/builder/helpers.test.js +20 -18
  230. package/lib/components/task/builder/models.js +121 -98
  231. package/lib/components/task/category/TaskCategoryForm.js +31 -29
  232. package/lib/components/task/category/TaskCategoryTable.js +12 -8
  233. package/lib/components/task/common/UsageTable.js +16 -12
  234. package/lib/components/task/engine/EngineSettingsForm.js +13 -11
  235. package/lib/components/task/errors/RunErrorTable.js +17 -13
  236. package/lib/components/task/errors/SystemErrorsTable.js +13 -9
  237. package/lib/components/task/handlers/HandlerForm.js +55 -55
  238. package/lib/components/task/handlers/HandlerTable.js +12 -8
  239. package/lib/components/task/handlers/MissingHandlerTable.js +12 -8
  240. package/lib/components/task/policy_rule/PolicyRuleForm.js +33 -32
  241. package/lib/components/task/policy_rule/PolicyRuleTable.js +12 -8
  242. package/lib/components/task/runs/CreateManualTriggerForm.js +17 -15
  243. package/lib/components/task/runs/RunTable.js +23 -20
  244. package/lib/components/task/runs/RunTaskTable.js +10 -6
  245. package/lib/components/task/sources/SourceForm.js +47 -47
  246. package/lib/components/task/sources/SourceTable.js +14 -11
  247. package/lib/components/task/triggers/TriggerTable.js +21 -18
  248. package/lib/components/task/workflows/LinkedWorkflowForm.js +48 -54
  249. package/lib/components/task/workflows/LinkedWorkflowTable.js +14 -10
  250. package/lib/components/task/workflows/MissingRoutineTable.js +12 -8
  251. package/lib/components/task/workflows/WorkflowForm.js +49 -44
  252. package/lib/components/task/workflows/WorkflowTable.js +17 -14
  253. package/lib/helpers/SearchBuilder.js +73 -127
  254. package/lib/helpers/SearchBuilder.test.js +184 -175
  255. package/lib/helpers/index.js +116 -74
  256. package/lib/index.js +86 -38
  257. package/lib/reducer.js +11 -3
  258. package/lib/saga.js +42 -38
  259. package/lib/store.js +59 -35
  260. package/package.json +3 -28
  261. package/proxyhelper.js +105 -46
  262. package/assets/discussions/images/avi_128.png +0 -0
  263. package/assets/discussions/images/excel_128.png +0 -0
  264. package/assets/discussions/images/html_128.png +0 -0
  265. package/assets/discussions/images/illustrator_128.png +0 -0
  266. package/assets/discussions/images/indesign_128.png +0 -0
  267. package/assets/discussions/images/movie_128.png +0 -0
  268. package/assets/discussions/images/mpeg_128.png +0 -0
  269. package/assets/discussions/images/pdf_128.png +0 -0
  270. package/assets/discussions/images/photoshop_128.png +0 -0
  271. package/assets/discussions/images/powerpoint_128.png +0 -0
  272. package/assets/discussions/images/txt_128.png +0 -0
  273. package/assets/discussions/images/unknown_128.png +0 -0
  274. package/assets/discussions/images/word_128.png +0 -0
  275. package/assets/discussions/styles/_discussion.scss +0 -506
  276. package/lib/apis/discussions/index.js +0 -395
  277. package/lib/apis/socket/index.js +0 -77
  278. package/lib/apis/socket/socket.js +0 -350
  279. package/lib/apis/socket/socket.test.js +0 -90
  280. package/lib/apis/socket/timer.js +0 -45
  281. package/lib/apis/socket/timer.test.js +0 -51
  282. package/lib/apis/socket/topic.js +0 -185
  283. package/lib/apis/topics/index.js +0 -19
  284. package/lib/components/discussions/ChatInputForm.js +0 -424
  285. package/lib/components/discussions/DateBanner.js +0 -10
  286. package/lib/components/discussions/Discussion.js +0 -202
  287. package/lib/components/discussions/DiscussionForm.js +0 -227
  288. package/lib/components/discussions/InvitationForm.js +0 -107
  289. package/lib/components/discussions/MessageHistory.js +0 -110
  290. package/lib/components/discussions/MessagesByDate.js +0 -40
  291. package/lib/components/discussions/MessagesList.js +0 -30
  292. package/lib/components/discussions/MoreMessagesBanner.js +0 -26
  293. package/lib/components/discussions/ScrollHelper.js +0 -84
  294. package/lib/components/discussions/SystemMessage.js +0 -88
  295. package/lib/components/discussions/SystemMessageGroup.js +0 -15
  296. package/lib/components/discussions/UserMessage.js +0 -163
  297. package/lib/components/discussions/UserMessageGroup.js +0 -34
  298. package/lib/components/discussions/redux.js +0 -178
  299. package/lib/components/discussions/sagas.js +0 -500
  300. package/lib/helpers/discussions/canManage.js +0 -30
  301. package/lib/helpers/discussions/canManage.test.js +0 -69
  302. package/lib/helpers/discussions/generateSystemMessageContent.js +0 -131
  303. package/lib/helpers/discussions/generateSystemMessageContent.test.js +0 -450
  304. package/lib/models/discussions.js +0 -76
  305. package/lib/models/index.js +0 -1
@@ -1,13 +1,21 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
- import React, { createRef, Fragment } from 'react';
8
- import Autosuggest from 'react-autosuggest';
9
- import { fromJS, is, List } from 'immutable';
10
- import { debounce } from 'lodash-es';
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.Typeahead = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
11
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
12
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized"));
13
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
14
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper"));
15
+ var _react = _interopRequireWildcard(require("react"));
16
+ var _reactAutosuggest = _interopRequireDefault(require("react-autosuggest"));
17
+ var _immutable = require("immutable");
18
+ var _lodashEs = require("lodash-es");
11
19
  var initialState = {
12
20
  editing: false,
13
21
  searchField: null,
@@ -15,23 +23,17 @@ var initialState = {
15
23
  refocus: false,
16
24
  result: null
17
25
  };
18
- export var Typeahead = /*#__PURE__*/function (_React$Component) {
19
- _inherits(Typeahead, _React$Component);
20
-
21
- var _super = _createSuper(Typeahead);
22
-
26
+ var Typeahead = /*#__PURE__*/function (_React$Component) {
27
+ (0, _inherits2["default"])(Typeahead, _React$Component);
28
+ var _super = (0, _createSuper2["default"])(Typeahead);
23
29
  function Typeahead(props) {
24
30
  var _this;
25
-
26
- _classCallCheck(this, Typeahead);
27
-
31
+ (0, _classCallCheck2["default"])(this, Typeahead);
28
32
  _this = _super.call(this, props);
29
-
30
33
  _this.edit = function (event) {
31
34
  if (event.type === 'click' || event.type === 'keydown' && (event.keyCode === 13 || event.keyCode === 32)) {
32
35
  event.preventDefault();
33
36
  event.stopPropagation();
34
-
35
37
  if (!_this.props.disabled) {
36
38
  _this.setState({
37
39
  editing: true
@@ -39,34 +41,28 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
39
41
  }
40
42
  }
41
43
  };
42
-
43
44
  _this.remove = function (i) {
44
45
  return function (event) {
45
46
  if (event) {
46
47
  event.preventDefault();
47
48
  event.stopPropagation();
48
49
  }
49
-
50
50
  if (!_this.props.disabled) {
51
51
  _this.props.onChange(_this.props.multiple ? _this.props.value["delete"](i) : null);
52
52
  }
53
53
  };
54
54
  };
55
-
56
55
  _this.onHighlight = function (_ref) {
57
56
  var suggestion = _ref.suggestion;
58
-
59
57
  if (typeof _this.props.onHighlight === 'function') {
60
58
  _this.props.onHighlight(suggestion);
61
59
  }
62
60
  };
63
-
64
61
  _this.onSuggestionsResponse = function (searchedValue) {
65
62
  return function (_ref2) {
66
63
  var suggestions = _ref2.suggestions,
67
- error = _ref2.error,
68
- nextPageToken = _ref2.nextPageToken;
69
-
64
+ error = _ref2.error,
65
+ nextPageToken = _ref2.nextPageToken;
70
66
  if (searchedValue === _this.state.searchValue) {
71
67
  // when multiple mode is enabled we don't want to allow the same
72
68
  // suggestion to be selected twice, we compare existing selections to
@@ -74,34 +70,31 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
74
70
  // this is necessary because one of the objects may have additional fields
75
71
  // but should be treated as equal to an object without those fields.
76
72
  var mappedValues = _this.props.multiple && _this.props.value.map(_this.props.getSuggestionValue);
77
-
78
73
  var filtered = suggestions.map(function (suggestion) {
79
- return fromJS(suggestion);
74
+ return (0, _immutable.fromJS)(suggestion);
80
75
  }).filter(function (suggestion) {
81
76
  return !_this.props.multiple || !mappedValues.includes(_this.props.getSuggestionValue(suggestion));
82
77
  });
83
- var customSuggestion = _this.props.custom && // if the current searchValue matches an existing suggestion we do not
78
+ var customSuggestion = _this.props.custom &&
79
+ // if the current searchValue matches an existing suggestion we do not
84
80
  // include it as a custom option
85
81
  filtered.filter(function (suggestion) {
86
82
  return _this.props.getSuggestionValue(suggestion) === _this.state.searchValue;
87
- }).length === 0 && fromJS(_this.props.custom(_this.state.searchValue));
88
-
83
+ }).length === 0 && (0, _immutable.fromJS)(_this.props.custom(_this.state.searchValue));
89
84
  _this.setState({
90
85
  result: {
91
86
  error: error,
92
87
  nextPageToken: nextPageToken,
93
- suggestions: customSuggestion ? [].concat(_toConsumableArray(filtered), [customSuggestion]) : filtered,
88
+ suggestions: customSuggestion ? [].concat((0, _toConsumableArray2["default"])(filtered), [customSuggestion]) : filtered,
94
89
  customSuggestion: customSuggestion
95
90
  }
96
91
  });
97
92
  }
98
93
  };
99
94
  };
100
-
101
95
  _this.onSuggestionsFetchRequested = function (_ref3) {
102
96
  var searchValue = _ref3.value,
103
- reason = _ref3.reason;
104
-
97
+ reason = _ref3.reason;
105
98
  if (reason === 'escape-pressed' && _this.state.searchValue === '') {
106
99
  _this.setState(initialState);
107
100
  } else if (reason !== 'suggestion-selected') {
@@ -115,11 +108,9 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
115
108
  });
116
109
  }
117
110
  };
118
-
119
111
  _this.onSuggestionsClearRequested = function () {
120
112
  _this.setState(initialState);
121
113
  };
122
-
123
114
  _this.setSearchField = function (searchField) {
124
115
  return function () {
125
116
  _this.setState({
@@ -127,48 +118,40 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
127
118
  });
128
119
  };
129
120
  };
130
-
131
121
  _this.onSuggestionSelected = function (event, _ref4) {
132
122
  var method = _ref4.method,
133
- suggestion = _ref4.suggestion;
134
-
123
+ suggestion = _ref4.suggestion;
135
124
  // Prevent form submission if enter key is used to select suggestion.
136
125
  if (method === 'enter') {
137
126
  event.preventDefault();
138
- } // Update state if single search or query is multiple and should be cleared
139
-
140
-
127
+ }
128
+ // Update state if single search or query is multiple and should be cleared
141
129
  if (!_this.props.multiple || !event.ctrlKey && !event.metaKey && !event.shiftKey) {
142
130
  _this.setState(_this.props.multiple ? {
143
131
  searchValue: ''
144
132
  } : initialState);
145
133
  }
146
-
147
134
  _this.props.onChange(_this.props.multiple ? _this.props.value.push(suggestion) : suggestion);
148
135
  };
149
-
150
136
  _this.state = initialState;
151
- _this.autosuggest = createRef();
152
- _this.focusRef = createRef();
153
- _this.search = debounce(function () {
137
+ _this.autosuggest = /*#__PURE__*/(0, _react.createRef)();
138
+ _this.focusRef = /*#__PURE__*/(0, _react.createRef)();
139
+ _this.search = (0, _lodashEs.debounce)(function () {
154
140
  var _this$props;
155
-
156
141
  (_this$props = _this.props).search.apply(_this$props, arguments);
157
142
  }, 150);
158
- _this.renderInputComponent = renderInputComponent.bind(_assertThisInitialized(_this));
159
- _this.renderSuggestion = renderSuggestion.bind(_assertThisInitialized(_this));
160
- _this.renderSuggestionsContainer = renderSuggestionsContainer.bind(_assertThisInitialized(_this));
161
- _this.renderSelections = renderSelections.bind(_assertThisInitialized(_this));
143
+ _this.renderInputComponent = renderInputComponent.bind((0, _assertThisInitialized2["default"])(_this));
144
+ _this.renderSuggestion = renderSuggestion.bind((0, _assertThisInitialized2["default"])(_this));
145
+ _this.renderSuggestionsContainer = renderSuggestionsContainer.bind((0, _assertThisInitialized2["default"])(_this));
146
+ _this.renderSelections = renderSelections.bind((0, _assertThisInitialized2["default"])(_this));
162
147
  return _this;
163
148
  }
164
-
165
- _createClass(Typeahead, [{
149
+ (0, _createClass2["default"])(Typeahead, [{
166
150
  key: "componentDidUpdate",
167
151
  value: function componentDidUpdate(prevProps, prevState, snapshot) {
168
152
  var searchLongEnough = !this.props.minSearchLength || this.state.searchValue.length >= this.props.minSearchLength;
169
153
  var searchChanged = this.state.searchField !== prevState.searchField || this.state.searchValue !== prevState.searchValue;
170
- var valueChanged = !is(this.props.value, prevProps.value);
171
-
154
+ var valueChanged = !(0, _immutable.is)(this.props.value, prevProps.value);
172
155
  if (this.state.editing) {
173
156
  if (searchChanged || valueChanged || !prevState.editing) {
174
157
  // Always clear the result even if the search value is not long enough,
@@ -176,24 +159,20 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
176
159
  this.setState({
177
160
  result: null
178
161
  });
179
-
180
162
  if (searchLongEnough) {
181
163
  this.search(this.state.searchField, this.state.searchValue, this.onSuggestionsResponse(this.state.searchValue));
182
164
  }
183
- } // If the previous state was not editing then we make sure the Autosuggest
165
+ }
166
+ // If the previous state was not editing then we make sure the Autosuggest
184
167
  // input element is focused because it may not be visible before this.
185
-
186
-
187
168
  if (!prevState.editing) {
188
169
  this.autosuggest.current.input.focus();
189
170
  }
190
171
  }
191
-
192
172
  if (this.state.refocus && !prevState.refocus) {
193
173
  if (this.focusRef.current) {
194
174
  this.focusRef.current.focus();
195
175
  }
196
-
197
176
  this.setState({
198
177
  refocus: false
199
178
  });
@@ -203,13 +182,13 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
203
182
  key: "render",
204
183
  value: function render() {
205
184
  var _this$props$component = this.props.components.SelectionsContainer,
206
- SelectionsContainer = _this$props$component === void 0 ? SelectionsContainerDefault : _this$props$component;
207
- return /*#__PURE__*/React.createElement(SelectionsContainer, {
185
+ SelectionsContainer = _this$props$component === void 0 ? SelectionsContainerDefault : _this$props$component;
186
+ return /*#__PURE__*/_react["default"].createElement(SelectionsContainer, {
208
187
  disabled: this.props.disabled,
209
188
  multiple: this.props.multiple,
210
189
  value: this.props.value,
211
190
  selections: this.props.multiple || !this.state.editing ? this.renderSelections() : null,
212
- input: (this.props.multiple || this.state.editing) && /*#__PURE__*/React.createElement(Autosuggest, {
191
+ input: (this.props.multiple || this.state.editing) && /*#__PURE__*/_react["default"].createElement(_reactAutosuggest["default"], {
213
192
  alwaysRenderSuggestions: true,
214
193
  getSuggestionValue: this.props.getSuggestionValue,
215
194
  highlightFirstSuggestion: !this.props.noAutoHighlight,
@@ -218,7 +197,10 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
218
197
  onBlur: this.props.onBlur,
219
198
  onChange: onChangeNOOP,
220
199
  onFocus: this.props.onFocus,
221
- selection: this.props.value
200
+ selection: this.props.value,
201
+ placeholder: this.props.placeholder,
202
+ id: this.props.id,
203
+ form: this.props.form
222
204
  },
223
205
  onSuggestionHighlighted: this.onHighlight,
224
206
  onSuggestionSelected: this.onSuggestionSelected,
@@ -233,33 +215,32 @@ export var Typeahead = /*#__PURE__*/function (_React$Component) {
233
215
  });
234
216
  }
235
217
  }]);
236
-
237
218
  return Typeahead;
238
- }(React.Component); // RENDER HELPERS below need to bind to the Typeahead instance because they use
219
+ }(_react["default"].Component); // RENDER HELPERS below need to bind to the Typeahead instance because they use
239
220
  // methods / props / state. They could be defined in the class instead but since
240
221
  // they do not alter state at all they were moved here to make that class
241
222
  // hopefully easier to comprehend. They are intended to be passed to the
242
223
  // corresponding (by name) props of the Autosuggest component.
243
224
  // https://github.com/moroshko/react-autosuggest#render-suggestions-container-prop
244
-
225
+ exports.Typeahead = Typeahead;
245
226
  function renderSuggestionsContainer(_ref5) {
246
227
  var containerProps = _ref5.containerProps,
247
- children = _ref5.children;
228
+ children = _ref5.children;
248
229
  var _this$props2 = this.props,
249
- _this$props2$componen = _this$props2.components,
250
- _this$props2$componen2 = _this$props2$componen.Status,
251
- Status = _this$props2$componen2 === void 0 ? StatusDefault : _this$props2$componen2,
252
- _this$props2$componen3 = _this$props2$componen.SuggestionsContainer,
253
- SuggestionsContainer = _this$props2$componen3 === void 0 ? SuggestionsContainerDefault : _this$props2$componen3,
254
- custom = _this$props2.custom,
255
- getStatusProps = _this$props2.getStatusProps,
256
- minSearchLength = _this$props2.minSearchLength,
257
- setSearchField = this.setSearchField,
258
- state = this.state;
259
- return /*#__PURE__*/React.createElement(SuggestionsContainer, {
230
+ _this$props2$componen = _this$props2.components,
231
+ _this$props2$componen2 = _this$props2$componen.Status,
232
+ Status = _this$props2$componen2 === void 0 ? StatusDefault : _this$props2$componen2,
233
+ _this$props2$componen3 = _this$props2$componen.SuggestionsContainer,
234
+ SuggestionsContainer = _this$props2$componen3 === void 0 ? SuggestionsContainerDefault : _this$props2$componen3,
235
+ custom = _this$props2.custom,
236
+ getStatusProps = _this$props2.getStatusProps,
237
+ minSearchLength = _this$props2.minSearchLength,
238
+ setSearchField = this.setSearchField,
239
+ state = this.state;
240
+ return /*#__PURE__*/_react["default"].createElement(SuggestionsContainer, {
260
241
  containerProps: containerProps,
261
242
  open: state.editing
262
- }, /*#__PURE__*/React.createElement(Status, getStatusProps({
243
+ }, /*#__PURE__*/_react["default"].createElement(Status, getStatusProps({
263
244
  searchField: state.searchField,
264
245
  setSearchField: setSearchField,
265
246
  error: state.result && state.result.error,
@@ -270,124 +251,126 @@ function renderSuggestionsContainer(_ref5) {
270
251
  pending: !state.result,
271
252
  custom: !!custom
272
253
  })), children);
273
- } // https://github.com/moroshko/react-autosuggest#render-suggestion-prop
274
-
254
+ }
275
255
 
256
+ // https://github.com/moroshko/react-autosuggest#render-suggestion-prop
276
257
  function renderSuggestion(suggestion, _ref6) {
277
258
  var isHighlighted = _ref6.isHighlighted;
278
259
  var _this$props3 = this.props,
279
- _this$props3$componen = _this$props3.components.Suggestion,
280
- Suggestion = _this$props3$componen === void 0 ? SuggestionDefault : _this$props3$componen,
281
- getSuggestionValue = _this$props3.getSuggestionValue;
260
+ _this$props3$componen = _this$props3.components.Suggestion,
261
+ Suggestion = _this$props3$componen === void 0 ? SuggestionDefault : _this$props3$componen,
262
+ getSuggestionValue = _this$props3.getSuggestionValue;
282
263
  var custom = this.state.result && this.state.result.customSuggestion === suggestion;
283
- return /*#__PURE__*/React.createElement(Suggestion, {
264
+ return /*#__PURE__*/_react["default"].createElement(Suggestion, {
284
265
  active: isHighlighted,
285
266
  custom: custom,
286
267
  suggestion: suggestion,
287
268
  suggestionValue: getSuggestionValue(suggestion)
288
269
  });
289
- } // https://github.com/moroshko/react-autosuggest#renderinputcomponent-optional
290
-
270
+ }
291
271
 
272
+ // https://github.com/moroshko/react-autosuggest#renderinputcomponent-optional
292
273
  function renderInputComponent(inputProps) {
293
274
  var _this$props$component2 = this.props.components.Input,
294
- Input = _this$props$component2 === void 0 ? TypeaheadInputDefault : _this$props$component2;
295
- return /*#__PURE__*/React.createElement(Input, {
275
+ Input = _this$props$component2 === void 0 ? TypeaheadInputDefault : _this$props$component2;
276
+ return /*#__PURE__*/_react["default"].createElement(Input, {
296
277
  inputProps: inputProps
297
278
  });
298
- } // Another render helper like the ones above but not actually for Autosuggest,
299
- // just meant to cleanup the render function of Typeahead.
300
-
279
+ }
301
280
 
281
+ // Another render helper like the ones above but not actually for Autosuggest,
282
+ // just meant to cleanup the render function of Typeahead.
302
283
  function renderSelections() {
303
284
  var edit = this.edit,
304
- focusRef = this.focusRef,
305
- _this$props4 = this.props,
306
- _this$props4$componen = _this$props4.components.Selection,
307
- Selection = _this$props4$componen === void 0 ? SelectionDefault : _this$props4$componen,
308
- disabled = _this$props4.disabled,
309
- getSuggestionValue = _this$props4.getSuggestionValue,
310
- multiple = _this$props4.multiple,
311
- value = _this$props4.value,
312
- remove = this.remove;
313
- return (multiple ? value : List.of(value)).map(function (selection, i) {
285
+ focusRef = this.focusRef,
286
+ _this$props4 = this.props,
287
+ _this$props4$componen = _this$props4.components.Selection,
288
+ Selection = _this$props4$componen === void 0 ? SelectionDefault : _this$props4$componen,
289
+ disabled = _this$props4.disabled,
290
+ getSuggestionValue = _this$props4.getSuggestionValue,
291
+ multiple = _this$props4.multiple,
292
+ value = _this$props4.value,
293
+ placeholder = _this$props4.placeholder,
294
+ id = _this$props4.id,
295
+ form = _this$props4.form,
296
+ remove = this.remove;
297
+ return (multiple ? value : _immutable.List.of(value)).map(function (selection, i) {
314
298
  var suggestionValue = getSuggestionValue(selection);
315
- return /*#__PURE__*/React.createElement(Selection, {
299
+ return /*#__PURE__*/_react["default"].createElement(Selection, {
316
300
  key: suggestionValue,
317
301
  disabled: disabled,
318
302
  edit: !multiple ? edit : null,
319
303
  focusRef: !multiple ? focusRef : null,
320
304
  remove: multiple ? remove(i) : remove(),
321
305
  selection: selection,
322
- suggestionValue: suggestionValue
306
+ suggestionValue: suggestionValue,
307
+ placeholder: !multiple ? placeholder : null,
308
+ id: !multiple ? id : null,
309
+ form: form
323
310
  });
324
311
  });
325
- } // DEFAULT COMPONENTS below render minimally useful content. They can and should
312
+ }
313
+
314
+ // DEFAULT COMPONENTS below render minimally useful content. They can and should
326
315
  // be overridden by the components prop passed to Typeahead. If they need props
327
316
  // or state from the Typeahead instance there will be a render* helper above
328
317
  // that will bind to it.
329
318
 
330
-
331
319
  var StatusDefault = function StatusDefault(props) {
332
- return /*#__PURE__*/React.createElement("div", null, props.info && /*#__PURE__*/React.createElement("div", null, props.info, /*#__PURE__*/React.createElement("button", {
320
+ return /*#__PURE__*/_react["default"].createElement("div", null, props.info && /*#__PURE__*/_react["default"].createElement("div", null, props.info, /*#__PURE__*/_react["default"].createElement("button", {
333
321
  onClick: props.clearFilterField
334
- }, "\xD7")), props.warning && /*#__PURE__*/React.createElement("div", null, props.warning), props.filterFieldOptions && props.filterFieldOptions.map(function (_ref7, i) {
322
+ }, "\xD7")), props.warning && /*#__PURE__*/_react["default"].createElement("div", null, props.warning), props.filterFieldOptions && props.filterFieldOptions.map(function (_ref7, i) {
335
323
  var label = _ref7.label,
336
- onClick = _ref7.onClick;
337
- return /*#__PURE__*/React.createElement("button", {
324
+ onClick = _ref7.onClick;
325
+ return /*#__PURE__*/_react["default"].createElement("button", {
338
326
  onClick: onClick,
339
327
  key: i
340
328
  }, label);
341
329
  }));
342
330
  };
343
-
344
331
  var SuggestionsContainerDefault = function SuggestionsContainerDefault(_ref8) {
345
332
  var children = _ref8.children,
346
- containerProps = _ref8.containerProps,
347
- open = _ref8.open;
348
- return /*#__PURE__*/React.createElement("div", Object.assign({}, containerProps, {
333
+ containerProps = _ref8.containerProps,
334
+ open = _ref8.open;
335
+ return /*#__PURE__*/_react["default"].createElement("div", Object.assign({}, containerProps, {
349
336
  style: open ? {} : {
350
337
  display: 'none'
351
338
  }
352
339
  }), children);
353
340
  };
354
-
355
341
  var SelectionsContainerDefault = function SelectionsContainerDefault(_ref9) {
356
342
  var selections = _ref9.selections,
357
- input = _ref9.input;
358
- return /*#__PURE__*/React.createElement(Fragment, null, selections, input);
343
+ input = _ref9.input;
344
+ return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, selections, input);
359
345
  };
360
-
361
346
  var SelectionDefault = function SelectionDefault(_ref10) {
362
347
  var selection = _ref10.selection,
363
- remove = _ref10.remove,
364
- edit = _ref10.edit,
365
- suggestionValue = _ref10.suggestionValue;
366
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, suggestionValue || /*#__PURE__*/React.createElement("em", null, "None")), edit && /*#__PURE__*/React.createElement("button", {
348
+ remove = _ref10.remove,
349
+ edit = _ref10.edit,
350
+ suggestionValue = _ref10.suggestionValue;
351
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", null, suggestionValue || /*#__PURE__*/_react["default"].createElement("em", null, "None")), edit && /*#__PURE__*/_react["default"].createElement("button", {
367
352
  type: "button",
368
353
  onClick: edit
369
- }, suggestionValue ? 'edit' : 'add'), selection && /*#__PURE__*/React.createElement("button", {
354
+ }, suggestionValue ? 'edit' : 'add'), selection && /*#__PURE__*/_react["default"].createElement("button", {
370
355
  type: "button",
371
356
  onClick: remove
372
357
  }, "remove"));
373
358
  };
374
-
375
359
  var SuggestionDefault = function SuggestionDefault(_ref11) {
376
360
  var active = _ref11.active,
377
- suggestionValue = _ref11.suggestionValue;
378
- return /*#__PURE__*/React.createElement("div", null, active ? /*#__PURE__*/React.createElement("strong", null, suggestionValue) : suggestionValue);
361
+ suggestionValue = _ref11.suggestionValue;
362
+ return /*#__PURE__*/_react["default"].createElement("div", null, active ? /*#__PURE__*/_react["default"].createElement("strong", null, suggestionValue) : suggestionValue);
379
363
  };
380
-
381
364
  var TypeaheadInputDefault = function TypeaheadInputDefault(_ref12) {
382
365
  var inputProps = _ref12.inputProps;
383
- return /*#__PURE__*/React.createElement("input", inputProps);
384
- }; // This is passed to the Autosuggest input but we do not want to update that
366
+ return /*#__PURE__*/_react["default"].createElement("input", inputProps);
367
+ };
368
+
369
+ // This is passed to the Autosuggest input but we do not want to update that
385
370
  // value when pressing up/down and we do not want to set that input when a
386
371
  // suggestion is clicked so we are making this a noop. Instead we update the
387
372
  // searchValue state when `onSuggestionsFetchRequested` is called.
388
-
389
-
390
373
  var onChangeNOOP = function onChangeNOOP(event, _ref13) {
391
374
  var newValue = _ref13.newValue,
392
- method = _ref13.method;
375
+ method = _ref13.method;
393
376
  };
@@ -1,25 +1,29 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React from 'react';
3
- import { Typeahead } from './Typeahead';
4
- import { fetchUsers } from '../../apis';
5
- import { Map } from 'immutable';
6
- var emailPattern = /^.+@.+\..+$/;
1
+ "use strict";
7
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.UserSelect = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _Typeahead = require("./Typeahead");
11
+ var _apis = require("../../apis");
12
+ var _immutable = require("immutable");
13
+ var emailPattern = /^.+@.+\..+$/;
8
14
  var validateCustomOption = function validateCustomOption(value) {
9
15
  return value.match(emailPattern);
10
16
  };
11
-
12
17
  var fields = {
13
18
  username: 'Username',
14
19
  displayName: 'Display Name',
15
20
  email: 'Email'
16
21
  };
17
-
18
22
  var searchUsers = function searchUsers(_ref) {
19
23
  var _ref$search = _ref.search,
20
- search = _ref$search === void 0 ? Map() : _ref$search;
24
+ search = _ref$search === void 0 ? (0, _immutable.Map)() : _ref$search;
21
25
  return function (searchField, value, callback) {
22
- return fetchUsers({
26
+ return (0, _apis.fetchUsers)({
23
27
  q: Object.keys(fields).filter(function (field) {
24
28
  return !searchField || field === searchField;
25
29
  }).map(function (field) {
@@ -30,8 +34,8 @@ var searchUsers = function searchUsers(_ref) {
30
34
  "public": !!search.get('public')
31
35
  }).then(function (_ref2) {
32
36
  var users = _ref2.users,
33
- error = _ref2.error,
34
- nextPageToken = _ref2.nextPageToken;
37
+ error = _ref2.error,
38
+ nextPageToken = _ref2.nextPageToken;
35
39
  return {
36
40
  suggestions: users || [],
37
41
  error: error,
@@ -40,13 +44,12 @@ var searchUsers = function searchUsers(_ref) {
40
44
  }).then(callback);
41
45
  };
42
46
  };
43
-
44
47
  var userToValue = function userToValue(user) {
45
48
  return user && (user.get('username') || user.get('email') || '') || '';
46
- }; // Converts a typed in value to an option object. Used when adding custom values
47
- // when allowNew is true.
48
-
49
+ };
49
50
 
51
+ // Converts a typed in value to an option object. Used when adding custom values
52
+ // when allowNew is true.
50
53
  var valueToCustomUser = function valueToCustomUser(_ref3) {
51
54
  var allowNew = _ref3.allowNew;
52
55
  return function (value) {
@@ -55,26 +58,23 @@ var valueToCustomUser = function valueToCustomUser(_ref3) {
55
58
  } : null : null;
56
59
  };
57
60
  };
58
-
59
61
  var getStatusProps = function getStatusProps(_ref4) {
60
62
  var _ref4$search = _ref4.search,
61
- search = _ref4$search === void 0 ? Map() : _ref4$search,
62
- _ref4$messages = _ref4.messages;
63
+ search = _ref4$search === void 0 ? (0, _immutable.Map)() : _ref4$search,
64
+ _ref4$messages = _ref4.messages;
63
65
  _ref4$messages = _ref4$messages === void 0 ? {} : _ref4$messages;
64
-
65
66
  var _ref4$messages$short = _ref4$messages["short"],
66
- _short = _ref4$messages$short === void 0 ? 'Type to find a user.' : _ref4$messages$short,
67
- _ref4$messages$empty = _ref4$messages.empty,
68
- empty = _ref4$messages$empty === void 0 ? 'No matching users.' : _ref4$messages$empty,
69
- _ref4$messages$custom = _ref4$messages.custom,
70
- custom = _ref4$messages$custom === void 0 ? 'No matching users. You may also enter a valid email.' : _ref4$messages$custom,
71
- _ref4$messages$pendin = _ref4$messages.pending,
72
- pending = _ref4$messages$pendin === void 0 ? 'Searching...' : _ref4$messages$pendin,
73
- _ref4$messages$more = _ref4$messages.more,
74
- more = _ref4$messages$more === void 0 ? "Too many users, first ".concat(search.get('limit') || '', " shown. Please refine your search.") : _ref4$messages$more,
75
- _ref4$messages$error = _ref4$messages.error,
76
- error = _ref4$messages$error === void 0 ? 'There was an error fetching users.' : _ref4$messages$error;
77
-
67
+ _short = _ref4$messages$short === void 0 ? 'Type to find a user.' : _ref4$messages$short,
68
+ _ref4$messages$empty = _ref4$messages.empty,
69
+ empty = _ref4$messages$empty === void 0 ? 'No matching users.' : _ref4$messages$empty,
70
+ _ref4$messages$custom = _ref4$messages.custom,
71
+ custom = _ref4$messages$custom === void 0 ? 'No matching users. You may also enter a valid email.' : _ref4$messages$custom,
72
+ _ref4$messages$pendin = _ref4$messages.pending,
73
+ pending = _ref4$messages$pendin === void 0 ? 'Searching...' : _ref4$messages$pendin,
74
+ _ref4$messages$more = _ref4$messages.more,
75
+ more = _ref4$messages$more === void 0 ? "Too many users, first ".concat(search.get('limit') || '', " shown. Please refine your search.") : _ref4$messages$more,
76
+ _ref4$messages$error = _ref4$messages.error,
77
+ error = _ref4$messages$error === void 0 ? 'There was an error fetching users.' : _ref4$messages$error;
78
78
  return function (props) {
79
79
  return {
80
80
  meta: props.searchField ? "Find Users by ".concat(fields[props.searchField]) : null,
@@ -82,10 +82,9 @@ var getStatusProps = function getStatusProps(_ref4) {
82
82
  warning: props.error || props.more || props.empty ? props.error && props.error.key === 'too_many_matches' ? 'Too many users to display. Please refine your search below.' : props.more ? more : props.empty && !props.custom ? empty : props.empty && props.custom ? custom : error : null,
83
83
  clearFilterField: props.searchField ? props.setSearchField(null) : null,
84
84
  filterFieldOptions: props.error && props.error.key === 'too_many_matches' ? Object.entries(props.error.errorData.matches).map(function (_ref5) {
85
- var _ref6 = _slicedToArray(_ref5, 2),
86
- field = _ref6[0],
87
- count = _ref6[1];
88
-
85
+ var _ref6 = (0, _slicedToArray2["default"])(_ref5, 2),
86
+ field = _ref6[0],
87
+ count = _ref6[1];
89
88
  return {
90
89
  field: field,
91
90
  count: count,
@@ -97,9 +96,8 @@ var getStatusProps = function getStatusProps(_ref4) {
97
96
  };
98
97
  };
99
98
  };
100
-
101
- export var UserSelect = function UserSelect(props) {
102
- return /*#__PURE__*/React.createElement(Typeahead, {
99
+ var UserSelect = function UserSelect(props) {
100
+ return /*#__PURE__*/_react["default"].createElement(_Typeahead.Typeahead, {
103
101
  components: props.components || {},
104
102
  disabled: props.disabled,
105
103
  multiple: props.multiple,
@@ -112,6 +110,9 @@ export var UserSelect = function UserSelect(props) {
112
110
  onChange: props.onChange,
113
111
  onFocus: props.onFocus,
114
112
  onBlur: props.onBlur,
115
- placeholder: props.placeholder
113
+ placeholder: props.placeholder,
114
+ id: props.id,
115
+ form: props.form
116
116
  });
117
- };
117
+ };
118
+ exports.UserSelect = UserSelect;