@kineticdata/react 5.0.16 → 5.1.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 (88) hide show
  1. package/lib/apis/core/attributeDefinitions.js +3 -2
  2. package/lib/apis/core/authentication.js +13 -5
  3. package/lib/apis/core/backgroundJobs.js +22 -39
  4. package/lib/apis/core/fileResources.js +36 -0
  5. package/lib/apis/core/filestores.js +40 -0
  6. package/lib/apis/core/forms.js +21 -36
  7. package/lib/apis/core/forms.test.js +51 -278
  8. package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
  9. package/lib/apis/core/submissions.js +46 -30
  10. package/lib/apis/core/webhooks.js +1 -2
  11. package/lib/apis/discussions/index.js +2 -1
  12. package/lib/apis/http.js +28 -13
  13. package/lib/apis/http.test.js +13 -15
  14. package/lib/apis/index.js +2 -0
  15. package/lib/apis/system/index.js +86 -1
  16. package/lib/apis/task/index.js +22 -14
  17. package/lib/components/agent/filestore/FilestoreForm.js +132 -0
  18. package/lib/components/agent/filestore/FilestoreTable.js +53 -0
  19. package/lib/components/common/BridgeSelect.js +2 -1
  20. package/lib/components/common/FormSelect.js +2 -1
  21. package/lib/components/common/Scroller.js +6 -6
  22. package/lib/components/common/TableInput.js +74 -29
  23. package/lib/components/common/TeamSelect.js +2 -1
  24. package/lib/components/common/Typeahead.js +7 -4
  25. package/lib/components/common/UserSelect.js +2 -1
  26. package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
  27. package/lib/components/common/code_input/languageHelpers.test.js +1 -1
  28. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -1
  29. package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -1
  30. package/lib/components/core/core_form/CoreForm.js +10 -10
  31. package/lib/components/core/field_definition/FieldDefinitionForm.js +130 -0
  32. package/lib/components/core/field_definition/FieldDefinitionTable.js +86 -0
  33. package/lib/components/core/file_resource/FileResourceForm.js +180 -0
  34. package/lib/components/core/file_resource/FileResourceTable.js +71 -0
  35. package/lib/components/core/form/FormForm.js +12 -17
  36. package/lib/components/core/form/FormTable.js +3 -8
  37. package/lib/components/core/i18n/I18n.js +15 -15
  38. package/lib/components/core/index_definition/IndexDefinitionForm.js +32 -19
  39. package/lib/components/core/index_definition/IndexDefinitionTable.js +15 -24
  40. package/lib/components/core/index_job/IndexJobTable.js +12 -9
  41. package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
  42. package/lib/components/core/space/SpaceForm.js +59 -10
  43. package/lib/components/core/submission/DatastoreSubmissionTable.js +31 -1
  44. package/lib/components/core/submission/FormSubmissionFilters.js +378 -0
  45. package/lib/components/core/submission/FormSubmissionTable.js +116 -0
  46. package/lib/components/core/submission/KappSubmissionTable.js +250 -0
  47. package/lib/components/core/submission/SubmissionForm.js +124 -0
  48. package/lib/components/core/submission/SubmissionTable.js +35 -249
  49. package/lib/components/core/submission/helpers.js +95 -0
  50. package/lib/components/core/submission/helpers.test.js +96 -0
  51. package/lib/components/core/translation/ContextTable.js +1 -1
  52. package/lib/components/core/user/UserForm.js +2 -2
  53. package/lib/components/core/webapi/WebApiForm.js +111 -126
  54. package/lib/components/core/webhook/WebhookForm.js +1 -1
  55. package/lib/components/form/Form.helpers.js +1 -1
  56. package/lib/components/form/Form.js +200 -144
  57. package/lib/components/index.js +16 -6
  58. package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
  59. package/lib/components/system/SystemSecurityForm.js +69 -0
  60. package/lib/components/system/helpers.js +20 -6
  61. package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
  62. package/lib/components/system/spaces/SystemTenantForm.js +15 -9
  63. package/lib/components/system/spaces/SystemTenantTable.js +21 -16
  64. package/lib/components/table/Table.js +37 -10
  65. package/lib/components/table/Table.redux.js +228 -57
  66. package/lib/components/table/Table.redux.test.js +73 -2
  67. package/lib/components/task/builder/Connector.js +21 -10
  68. package/lib/components/task/builder/ConnectorForm.js +1 -1
  69. package/lib/components/task/builder/Node.js +10 -3
  70. package/lib/components/task/builder/NodeForm.js +54 -22
  71. package/lib/components/task/builder/NodeParametersForm.js +5 -2
  72. package/lib/components/task/builder/SvgCanvas.js +13 -4
  73. package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
  74. package/lib/components/task/builder/TreeBuilder.js +27 -9
  75. package/lib/components/task/builder/builder.redux.js +159 -52
  76. package/lib/components/task/builder/helpers.js +5 -3
  77. package/lib/components/task/builder/models.js +84 -12
  78. package/lib/components/task/errors/RunErrorTable.js +1 -1
  79. package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
  80. package/lib/components/task/runs/RunTable.js +5 -3
  81. package/lib/components/task/triggers/TriggerTable.js +3 -2
  82. package/lib/components/task/workflows/WorkflowForm.js +67 -85
  83. package/lib/helpers/index.js +19 -2
  84. package/lib/index.js +1 -0
  85. package/lib/models/discussions.js +18 -2
  86. package/lib/models/index.js +1 -1
  87. package/package.json +3 -3
  88. package/proxyhelper.js +19 -6
@@ -0,0 +1,250 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import { getIn, List, Map, Set } from 'immutable';
3
+ import { generateTable } from '../../table/Table';
4
+ import { fetchForm, fetchKapp, searchSubmissions, SubmissionSearch, VALID_KAPP_CORE_STATES } from '../../../apis';
5
+
6
+ var applyMeta = function applyMeta(query, op, rvalue) {
7
+ return rvalue ? query[op](rvalue) : query;
8
+ };
9
+
10
+ var applyOp = function applyOp(query, op, lvalue, rvalue) {
11
+ return rvalue ? query[op](lvalue, rvalue) : query;
12
+ };
13
+
14
+ var submissionSearch = function submissionSearch(_ref, include) {
15
+ var filters = _ref.filters,
16
+ pageSize = _ref.pageSize,
17
+ sortColumn = _ref.sortColumn,
18
+ sortDirection = _ref.sortDirection;
19
+ var query = new SubmissionSearch().includes(Set([].concat(_toConsumableArray(typeof include === 'string' ? include.split(',') : Array.isArray(include) ? include : []), ['details', 'form'])).toJS()).sortBy(sortColumn || 'createdAt').sortDirection(sortDirection.toLocaleUpperCase()).limit(pageSize);
20
+ applyMeta(query, 'coreState', filters.get('coreState'));
21
+ applyMeta(query, 'startDate', filters.get('startDate') && new Date("".concat(filters.get('startDate'), "T00:00:00")));
22
+ applyMeta(query, 'endDate', filters.get('endDate') && new Date("".concat(filters.get('endDate'), "T00:00:00")));
23
+ applyOp(query, 'eq', 'handle', filters.get('handle'));
24
+ applyOp(query, 'eq', 'submittedBy', filters.getIn(['submittedBy', 'username']));
25
+ filters.get('values', Map()).forEach(function (value, field) {
26
+ return applyOp(query, 'eq', "values[".concat(field, "]"), value);
27
+ });
28
+ return query.build();
29
+ };
30
+
31
+ var dataSource = function dataSource(_ref2) {
32
+ var formSlug = _ref2.formSlug,
33
+ kappSlug = _ref2.kappSlug,
34
+ include = _ref2.include;
35
+ return {
36
+ fn: searchSubmissions,
37
+ params: function params(paramData) {
38
+ return [{
39
+ kapp: kappSlug,
40
+ form: paramData.filters.getIn(['form', 'slug'], formSlug),
41
+ pageToken: paramData.nextPageToken,
42
+ search: submissionSearch(paramData, include)
43
+ }];
44
+ },
45
+ transform: function transform(result) {
46
+ return {
47
+ data: result.submissions,
48
+ nextPageToken: result.nextPageToken
49
+ };
50
+ }
51
+ };
52
+ };
53
+
54
+ var onValidateFilters = function onValidateFilters(filters) {
55
+ return filters.getIn(['values', 'value'], List()).reduce(function (valid, value) {
56
+ return valid && value.get('field') !== '' ? value.get('value') !== '' : valid;
57
+ }, true);
58
+ };
59
+
60
+ var filterDataSources = function filterDataSources(_ref3) {
61
+ var kappSlug = _ref3.kappSlug,
62
+ formSlug = _ref3.formSlug;
63
+ return {
64
+ kapp: {
65
+ fn: fetchKapp,
66
+ params: [{
67
+ kappSlug: kappSlug,
68
+ include: 'fields'
69
+ }],
70
+ transform: function transform(result) {
71
+ return result.kapp;
72
+ }
73
+ },
74
+ form: {
75
+ fn: function fn(formSlug) {
76
+ return formSlug ? fetchForm({
77
+ kappSlug: kappSlug,
78
+ formSlug: formSlug,
79
+ include: 'fields'
80
+ }) : null;
81
+ },
82
+ params: function params(_ref4) {
83
+ var values = _ref4.values;
84
+ return [getIn(values, ['form', 'slug'], formSlug)];
85
+ },
86
+ transform: function transform(result) {
87
+ return result && result.form;
88
+ }
89
+ },
90
+ fieldOptions: {
91
+ fn: function fn(form, kapp) {
92
+ return form ? form.get('fields').toArray() : kapp.get('fields').toArray();
93
+ },
94
+ params: function params(_ref5) {
95
+ var form = _ref5.form,
96
+ kapp = _ref5.kapp;
97
+ return kapp && [form, kapp];
98
+ },
99
+ transform: function transform(result) {
100
+ return result.map(function (field) {
101
+ return {
102
+ label: field.get('name'),
103
+ value: field.get('name')
104
+ };
105
+ });
106
+ }
107
+ },
108
+ coreStateOptions: {
109
+ fn: function fn() {
110
+ return VALID_KAPP_CORE_STATES;
111
+ },
112
+ params: [],
113
+ transform: function transform(coreStates) {
114
+ return coreStates.map(function (coreState) {
115
+ return {
116
+ label: coreState,
117
+ value: coreState
118
+ };
119
+ });
120
+ }
121
+ }
122
+ };
123
+ };
124
+
125
+ var filters = function filters(_ref6) {
126
+ var kappSlug = _ref6.kappSlug,
127
+ formSlug = _ref6.formSlug;
128
+ return function (_ref7) {
129
+ var coreStateOptions = _ref7.coreStateOptions;
130
+ return coreStateOptions && [{
131
+ label: 'Start Date',
132
+ name: 'startDate',
133
+ type: 'date'
134
+ }, {
135
+ label: 'End Date',
136
+ name: 'endDate',
137
+ type: 'date'
138
+ }, {
139
+ label: 'Handle',
140
+ name: 'handle',
141
+ pattern: /[A-F0-9]{6}/,
142
+ patternMessage: 'Handles only contain characters A-F and 0-9, and are exactly 6 characters long',
143
+ type: 'text'
144
+ }, !formSlug && {
145
+ label: 'Form',
146
+ name: 'form',
147
+ type: 'form',
148
+ search: {
149
+ kappSlug: kappSlug
150
+ }
151
+ }, {
152
+ label: 'Submitted By',
153
+ name: 'submittedBy',
154
+ type: 'user'
155
+ }, {
156
+ label: 'State',
157
+ name: 'coreState',
158
+ type: 'select',
159
+ options: coreStateOptions
160
+ }, {
161
+ label: 'Values',
162
+ name: 'values',
163
+ type: 'map',
164
+ options: function options(_ref8) {
165
+ var fieldOptions = _ref8.fieldOptions;
166
+ return fieldOptions;
167
+ }
168
+ }];
169
+ };
170
+ };
171
+
172
+ var columns = [{
173
+ value: 'closedAt',
174
+ title: 'Closed At',
175
+ sortable: true
176
+ }, {
177
+ value: 'closedBy',
178
+ title: 'closedBy',
179
+ sortable: false
180
+ }, {
181
+ value: 'coreState',
182
+ title: 'Core State',
183
+ sortable: false
184
+ }, {
185
+ value: 'createdAt',
186
+ title: 'Created',
187
+ sortable: true
188
+ }, {
189
+ value: 'createdBy',
190
+ title: 'Created By',
191
+ sortable: false
192
+ }, {
193
+ value: 'currentPage',
194
+ title: 'Current Page',
195
+ sortable: false
196
+ }, {
197
+ value: 'handle',
198
+ title: 'Handle',
199
+ sortable: false
200
+ }, {
201
+ value: 'id',
202
+ title: 'Id',
203
+ sortable: false
204
+ }, {
205
+ value: 'label',
206
+ title: 'Label',
207
+ sortable: false
208
+ }, {
209
+ value: 'origin',
210
+ title: 'Origin',
211
+ sortable: false
212
+ }, {
213
+ value: 'parent',
214
+ title: 'Parent',
215
+ sortable: false
216
+ }, {
217
+ value: 'sessionToken',
218
+ title: 'Session Token',
219
+ sortable: false
220
+ }, {
221
+ value: 'submittedAt',
222
+ title: 'Submitted At',
223
+ sortable: true
224
+ }, {
225
+ value: 'submittedBy',
226
+ title: 'Submitted By',
227
+ sortable: false
228
+ }, {
229
+ value: 'type',
230
+ title: 'Type',
231
+ sortable: false
232
+ }, {
233
+ value: 'updatedAt',
234
+ title: 'Updated',
235
+ sortable: true
236
+ }, {
237
+ value: 'updatedBy',
238
+ title: 'Updated By',
239
+ sortable: false
240
+ }];
241
+ export var KappSubmissionTable = generateTable({
242
+ tableOptions: ['kappSlug', 'formSlug', 'datastore', 'include'],
243
+ columns: columns,
244
+ dataSource: dataSource,
245
+ filterDataSources: filterDataSources,
246
+ filters: filters,
247
+ onValidateFilters: onValidateFilters
248
+ });
249
+ KappSubmissionTable.displayName = 'KappSubmissionTable';
250
+ export default KappSubmissionTable;
@@ -0,0 +1,124 @@
1
+ import { List, getIn } from 'immutable';
2
+ import { fetchSubmission, updateSubmission } from '../../../apis';
3
+ import { generateForm } from '../../form/Form';
4
+ import moment from 'moment';
5
+
6
+ var dataSources = function dataSources(_ref) {
7
+ var submissionId = _ref.submissionId;
8
+ return {
9
+ submission: {
10
+ fn: fetchSubmission,
11
+ params: [{
12
+ id: submissionId,
13
+ include: 'details,values,form,form.fields,form.fields.details,form.pages'
14
+ }],
15
+ transform: function transform(result) {
16
+ return result.submission;
17
+ }
18
+ }
19
+ };
20
+ };
21
+
22
+ var handleSubmit = function handleSubmit(_ref2) {
23
+ var id = _ref2.submissionId;
24
+ return function (values) {
25
+ return updateSubmission({
26
+ id: id,
27
+ values: values.toJS()
28
+ }).then(function (_ref3) {
29
+ var submission = _ref3.submission,
30
+ error = _ref3.error;
31
+
32
+ if (error) {
33
+ throw error.statusCode === 400 && error.message || 'There was an error saving the submission';
34
+ }
35
+
36
+ return submission;
37
+ });
38
+ };
39
+ };
40
+
41
+ var traverseElement = function traverseElement(traverse, iteratee, acc) {
42
+ var element = traverse.get(0);
43
+ var elements = traverse.shift();
44
+ var childElements = element.get('elements', List());
45
+ var result = iteratee(element, acc); // If the current element has child elements make a recursive call.
46
+
47
+ if (childElements.size > 0) {
48
+ result = traverseElement(childElements, iteratee, result);
49
+ }
50
+
51
+ if (elements.size > 0) {
52
+ return traverseElement(elements, iteratee, result);
53
+ }
54
+
55
+ return result;
56
+ };
57
+
58
+ var convertRenderType = function convertRenderType(element) {
59
+ if (element.get('renderType') === 'dropdown') {
60
+ return element.get('choicesResourceName') ? 'text' : 'select';
61
+ } else if (element.get('renderType') === 'checkbox') {
62
+ return 'text-multi';
63
+ } else if (element.get('renderType') === 'attachment') {
64
+ return 'text';
65
+ }
66
+
67
+ return element.get('renderType');
68
+ };
69
+
70
+ var getInitialValue = function getInitialValue(submission, element, type) {
71
+ var name = element.get('name');
72
+ var isAttachment = element.get('renderType') === 'attachment';
73
+ var value = getIn(submission, ['values', name], element.get('renderType') === 'checkbox' ? List() : '') || '';
74
+ return isAttachment ? JSON.stringify(List.isList(value) ? value.toJS() : value) : type === 'datetime' ? moment(value).format('yyyy-MM-DDThh:mm') : type === 'date' ? moment(value).format('yyyy-MM-DD') : value;
75
+ };
76
+
77
+ var serializer = function serializer(element, type) {
78
+ return function (_ref4) {
79
+ var values = _ref4.values;
80
+ var name = element.get('name');
81
+ return type === 'datetime' ? moment(values.get(name)).format() : values.get(name);
82
+ };
83
+ }; // If the element uses bridged options then the `choices` value represents the
84
+ // label/value mapping from and not actual choices.
85
+
86
+
87
+ var getChoices = function getChoices(element) {
88
+ return !!element.get('choicesResourceName') ? List() : element.get('choices');
89
+ };
90
+
91
+ var fields = function fields() {
92
+ return function (_ref5) {
93
+ var submission = _ref5.submission;
94
+
95
+ if (submission) {
96
+ var pages = submission.getIn(['form', 'pages'], List());
97
+ var values = traverseElement(pages, function (element, values) {
98
+ var name = element.get('name');
99
+ var type = convertRenderType(element);
100
+ var initialValue = getInitialValue(submission, element, type);
101
+ var isAttachment = element.get('renderType') === 'attachment';
102
+ return element.get('type') === 'field' ? values.push({
103
+ name: name,
104
+ label: name,
105
+ type: type,
106
+ options: getChoices(element, initialValue),
107
+ initialValue: initialValue,
108
+ enabled: !isAttachment,
109
+ "transient": isAttachment,
110
+ serialize: serializer(element, type)
111
+ }) : values;
112
+ }, List());
113
+ return values.toJS();
114
+ }
115
+ };
116
+ };
117
+
118
+ export var SubmissionForm = generateForm({
119
+ formOptions: ['submissionId'],
120
+ dataSources: dataSources,
121
+ fields: fields,
122
+ handleSubmit: handleSubmit
123
+ });
124
+ SubmissionForm.displayName = 'SubmissionForm';
@@ -1,252 +1,38 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import { getIn, List, Map, Set } from 'immutable';
3
- import { generateTable } from '../../table/Table';
4
- import { fetchForm, fetchKapp, searchSubmissions, SubmissionSearch, VALID_KAPP_CORE_STATES } from '../../../apis';
5
-
6
- var applyMeta = function applyMeta(query, op, rvalue) {
7
- return rvalue ? query[op](rvalue) : query;
8
- };
9
-
10
- var applyOp = function applyOp(query, op, lvalue, rvalue) {
11
- return rvalue ? query[op](lvalue, rvalue) : query;
12
- };
13
-
14
- var submissionSearch = function submissionSearch(_ref, include) {
15
- var filters = _ref.filters,
16
- pageSize = _ref.pageSize,
17
- sortColumn = _ref.sortColumn,
18
- sortDirection = _ref.sortDirection;
19
- var query = new SubmissionSearch().includes(Set([].concat(_toConsumableArray(typeof include === 'string' ? include.split(',') : Array.isArray(include) ? include : []), ['details', 'form'])).toJS()).sortBy(sortColumn || 'createdAt').sortDirection(sortDirection.toLocaleUpperCase()).limit(pageSize);
20
- applyMeta(query, 'coreState', filters.get('coreState'));
21
- applyMeta(query, 'startDate', filters.get('startDate') && new Date("".concat(filters.get('startDate'), "T00:00:00")));
22
- applyMeta(query, 'endDate', filters.get('endDate') && new Date("".concat(filters.get('endDate'), "T00:00:00")));
23
- applyOp(query, 'eq', 'handle', filters.get('handle'));
24
- applyOp(query, 'eq', 'submittedBy', filters.getIn(['submittedBy', 'username']));
25
- filters.get('values', Map()).forEach(function (value, field) {
26
- return applyOp(query, 'eq', "values[".concat(field, "]"), value);
27
- });
28
- return query.build();
29
- };
30
-
31
- var dataSource = function dataSource(_ref2) {
32
- var formSlug = _ref2.formSlug,
33
- kappSlug = _ref2.kappSlug,
34
- include = _ref2.include;
35
- return {
36
- fn: searchSubmissions,
37
- params: function params(paramData) {
38
- return [{
39
- kapp: kappSlug,
40
- form: paramData.filters.getIn(['form', 'slug'], formSlug),
41
- pageToken: paramData.nextPageToken,
42
- search: submissionSearch(paramData, include)
43
- }];
44
- },
45
- transform: function transform(result) {
46
- return {
47
- data: result.submissions,
48
- nextPageToken: result.nextPageToken
49
- };
50
- }
51
- };
52
- };
53
-
54
- var onValidateFilters = function onValidateFilters(filters) {
55
- return filters.getIn(['values', 'value'], List()).reduce(function (valid, value) {
56
- return valid && value.get('field') !== '' ? value.get('value') !== '' : valid;
57
- }, true);
58
- };
59
-
60
- var filterDataSources = function filterDataSources(_ref3) {
61
- var kappSlug = _ref3.kappSlug,
62
- formSlug = _ref3.formSlug;
63
- return {
64
- kapp: {
65
- fn: fetchKapp,
66
- params: [{
67
- kappSlug: kappSlug,
68
- include: 'fields'
69
- }],
70
- transform: function transform(result) {
71
- return result.kapp;
72
- }
73
- },
74
- form: {
75
- fn: function fn(formSlug) {
76
- return formSlug ? fetchForm({
77
- kappSlug: kappSlug,
78
- formSlug: formSlug,
79
- include: 'fields'
80
- }) : null;
81
- },
82
- params: function params(_ref4) {
83
- var values = _ref4.values;
84
- return [getIn(values, ['form', 'slug'], formSlug)];
85
- },
86
- transform: function transform(result) {
87
- return result && result.form;
88
- }
89
- },
90
- fieldOptions: {
91
- fn: function fn(form, kapp) {
92
- return form ? form.get('fields').toArray() : kapp.get('fields').toArray();
93
- },
94
- params: function params(_ref5) {
95
- var form = _ref5.form,
96
- kapp = _ref5.kapp;
97
- return kapp && [form, kapp];
98
- },
99
- transform: function transform(result) {
100
- return result.map(function (field) {
101
- return {
102
- label: field.get('name'),
103
- value: field.get('name')
104
- };
105
- });
106
- }
107
- },
108
- coreStateOptions: {
109
- fn: function fn() {
110
- return VALID_KAPP_CORE_STATES;
111
- },
112
- params: [],
113
- transform: function transform(coreStates) {
114
- return coreStates.map(function (coreState) {
115
- return {
116
- label: coreState,
117
- value: coreState
118
- };
119
- });
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Component } from 'react';
6
+ import FormSubmissionTable from './FormSubmissionTable';
7
+ import DatastoreSubmissionTable from './DatastoreSubmissionTable';
8
+ import KappSubmissionTable from './KappSubmissionTable';
9
+ export var SubmissionTable = /*#__PURE__*/function (_Component) {
10
+ _inherits(SubmissionTable, _Component);
11
+
12
+ var _super = _createSuper(SubmissionTable);
13
+
14
+ function SubmissionTable() {
15
+ _classCallCheck(this, SubmissionTable);
16
+
17
+ return _super.apply(this, arguments);
18
+ }
19
+
20
+ _createClass(SubmissionTable, [{
21
+ key: "componentDidMount",
22
+ value: function componentDidMount() {
23
+ if (this.props.mode === 'space') {
24
+ console.warn('Datastore Submissions are deprecated in Core 5.1, please upgrade to "form" mode.');
25
+ } else if (this.props.mode === 'kapp' || !this.props.mode) {
26
+ console.warn('Kapp Submissions are deprecated in Core 5.1, please upgrade to "form" mode.');
120
27
  }
121
28
  }
122
- };
123
- };
124
-
125
- var filters = function filters(_ref6) {
126
- var kappSlug = _ref6.kappSlug,
127
- formSlug = _ref6.formSlug;
128
- return function (_ref7) {
129
- var coreStateOptions = _ref7.coreStateOptions,
130
- form = _ref7.form,
131
- forms = _ref7.forms;
132
- return coreStateOptions && [{
133
- label: 'Start Date',
134
- name: 'startDate',
135
- type: 'date'
136
- }, {
137
- label: 'End Date',
138
- name: 'endDate',
139
- type: 'date'
140
- }, {
141
- label: 'Handle',
142
- name: 'handle',
143
- pattern: /[A-F0-9]{6}/,
144
- patternMessage: 'Handles only contain characters A-F and 0-9, and are exactly 6 characters long',
145
- type: 'text'
146
- }, !formSlug && {
147
- label: 'Form',
148
- name: 'form',
149
- type: 'form',
150
- search: {
151
- kappSlug: kappSlug
152
- }
153
- }, {
154
- label: 'Submitted By',
155
- name: 'submittedBy',
156
- type: 'user'
157
- }, {
158
- label: 'State',
159
- name: 'coreState',
160
- type: 'select',
161
- options: coreStateOptions
162
- }, {
163
- label: 'Values',
164
- name: 'values',
165
- type: 'map',
166
- options: function options(_ref8) {
167
- var fieldOptions = _ref8.fieldOptions;
168
- return fieldOptions;
169
- }
170
- }];
171
- };
172
- };
29
+ }, {
30
+ key: "render",
31
+ value: function render() {
32
+ var TableComponent = this.props.mode === 'form' ? FormSubmissionTable : this.props.mode === 'space' ? DatastoreSubmissionTable : this.props.mode === 'kapp' ? KappSubmissionTable : KappSubmissionTable;
33
+ return /*#__PURE__*/React.createElement(TableComponent, this.props, this.props.children);
34
+ }
35
+ }]);
173
36
 
174
- var columns = [{
175
- value: 'closedAt',
176
- title: 'Closed At',
177
- sortable: true
178
- }, {
179
- value: 'closedBy',
180
- title: 'closedBy',
181
- sortable: false
182
- }, {
183
- value: 'coreState',
184
- title: 'Core State',
185
- sortable: false
186
- }, {
187
- value: 'createdAt',
188
- title: 'Created',
189
- sortable: true
190
- }, {
191
- value: 'createdBy',
192
- title: 'Created By',
193
- sortable: false
194
- }, {
195
- value: 'currentPage',
196
- title: 'Current Page',
197
- sortable: false
198
- }, {
199
- value: 'handle',
200
- title: 'Handle',
201
- sortable: false
202
- }, {
203
- value: 'id',
204
- title: 'Id',
205
- sortable: false
206
- }, {
207
- value: 'label',
208
- title: 'Label',
209
- sortable: false
210
- }, {
211
- value: 'origin',
212
- title: 'Origin',
213
- sortable: false
214
- }, {
215
- value: 'parent',
216
- title: 'Parent',
217
- sortable: false
218
- }, {
219
- value: 'sessionToken',
220
- title: 'Session Token',
221
- sortable: false
222
- }, {
223
- value: 'submittedAt',
224
- title: 'Submitted At',
225
- sortable: true
226
- }, {
227
- value: 'submittedBy',
228
- title: 'Submitted By',
229
- sortable: false
230
- }, {
231
- value: 'type',
232
- title: 'Type',
233
- sortable: false
234
- }, {
235
- value: 'updatedAt',
236
- title: 'Updated',
237
- sortable: true
238
- }, {
239
- value: 'updatedBy',
240
- title: 'Updated By',
241
- sortable: false
242
- }];
243
- export var SubmissionTable = generateTable({
244
- tableOptions: ['kappSlug', 'formSlug', 'datastore', 'include'],
245
- columns: columns,
246
- dataSource: dataSource,
247
- filterDataSources: filterDataSources,
248
- filters: filters,
249
- onValidateFilters: onValidateFilters
250
- });
251
- SubmissionTable.displayName = 'SubmissionTable';
252
- export default SubmissionTable;
37
+ return SubmissionTable;
38
+ }(Component);