@commercetools-frontend-extensions/export-resources-modal 3.4.1 → 3.4.3-next.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.
|
@@ -12,12 +12,13 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
|
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
14
|
var React = require('react');
|
|
15
|
+
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
16
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
17
|
+
require('@commercetools-uikit/design-system');
|
|
15
18
|
var reactIntl = require('react-intl');
|
|
19
|
+
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
16
20
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
17
|
-
var
|
|
18
|
-
var _flatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat');
|
|
19
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
20
|
-
var gqlQueryBuilder = require('gql-query-builder');
|
|
21
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
21
22
|
var _Reflect$construct = require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
22
23
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
23
24
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
@@ -26,22 +27,21 @@ var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibl
|
|
|
26
27
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
27
28
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
28
29
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
30
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
31
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
32
|
+
var moment = require('moment');
|
|
33
|
+
var _flatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat');
|
|
34
|
+
var gqlQueryBuilder = require('gql-query-builder');
|
|
29
35
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
30
36
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
31
37
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
32
38
|
var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
|
|
33
39
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
34
|
-
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
35
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
36
|
-
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
37
40
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
38
41
|
var omitEmpty = require('omit-empty-es');
|
|
39
42
|
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find-index');
|
|
40
43
|
var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/splice');
|
|
41
44
|
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
42
|
-
require('@commercetools-uikit/design-system');
|
|
43
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
44
|
-
var moment = require('moment');
|
|
45
45
|
var sdk = require('@commercetools-frontend/sdk');
|
|
46
46
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
47
47
|
var constants = require('@commercetools-frontend/constants');
|
|
@@ -63,27 +63,199 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
|
|
|
63
63
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
64
64
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
65
65
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
66
|
+
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
67
|
+
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
66
68
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
67
|
-
var _flatInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatInstanceProperty);
|
|
68
69
|
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
69
|
-
var
|
|
70
|
+
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
71
|
+
var _flatInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatInstanceProperty);
|
|
70
72
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
71
73
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
72
74
|
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
73
75
|
var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
|
|
74
76
|
var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
75
|
-
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
76
77
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
77
78
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
78
79
|
var _findIndexInstanceProperty__default = /*#__PURE__*/_interopDefault(_findIndexInstanceProperty);
|
|
79
80
|
var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
|
|
80
81
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
81
|
-
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
82
82
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
83
83
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
84
84
|
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
85
85
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
86
86
|
|
|
87
|
+
function getBold(msg) {
|
|
88
|
+
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
89
|
+
as: "span",
|
|
90
|
+
isBold: true,
|
|
91
|
+
children: msg
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getNewLine() {
|
|
96
|
+
return jsxRuntime.jsx("br", {});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var messages = reactIntl.defineMessages({
|
|
100
|
+
modalTitle: {
|
|
101
|
+
id: 'ExportResourcesModal.modalTitle',
|
|
102
|
+
description: 'Label for the modal title',
|
|
103
|
+
defaultMessage: 'Export {resourceType}'
|
|
104
|
+
},
|
|
105
|
+
outputFormat: {
|
|
106
|
+
id: 'ExportResourcesModal.outputFormat',
|
|
107
|
+
description: 'File format like (csv, xls, ...etc)',
|
|
108
|
+
defaultMessage: 'File format'
|
|
109
|
+
},
|
|
110
|
+
fileName: {
|
|
111
|
+
id: 'ExportResourcesModal.fileName',
|
|
112
|
+
description: 'exported file name',
|
|
113
|
+
defaultMessage: 'File name'
|
|
114
|
+
},
|
|
115
|
+
locale: {
|
|
116
|
+
id: 'ExportResourcesModal.locale',
|
|
117
|
+
description: 'Locale',
|
|
118
|
+
defaultMessage: 'Locale'
|
|
119
|
+
},
|
|
120
|
+
exportSelection: {
|
|
121
|
+
id: 'ExportResourcesModal.exportSelection',
|
|
122
|
+
description: 'Export selection',
|
|
123
|
+
defaultMessage: 'Export selection'
|
|
124
|
+
},
|
|
125
|
+
exportAllResources: {
|
|
126
|
+
id: 'ExportResourcesModal.exportAllResources',
|
|
127
|
+
description: 'Export All selection',
|
|
128
|
+
defaultMessage: 'Export all {resourceType} ({count})'
|
|
129
|
+
},
|
|
130
|
+
exportOnlySelectedResources: {
|
|
131
|
+
id: 'ExportResourcesModal.exportOnlySelectedResources',
|
|
132
|
+
description: 'Export only selected resources',
|
|
133
|
+
defaultMessage: 'Export selected {resourceType} ({count})'
|
|
134
|
+
},
|
|
135
|
+
exportAllMessage: {
|
|
136
|
+
id: 'ExportResourcesModal.exportAllMessage',
|
|
137
|
+
description: 'All resources will be exported',
|
|
138
|
+
defaultMessage: 'All <b>{count}</b> {resourceType} will be exported.'
|
|
139
|
+
},
|
|
140
|
+
exportMatchingMessage: {
|
|
141
|
+
id: 'ExportResourcesModal.exportMatchingMessage',
|
|
142
|
+
description: 'resources will be exported',
|
|
143
|
+
defaultMessage: '<b>{count}</b> {resourceType} will be exported.'
|
|
144
|
+
},
|
|
145
|
+
exportSelectedMessage: {
|
|
146
|
+
id: 'ExportResourcesModal.exportSelectedMessage',
|
|
147
|
+
description: 'resources are selected and will be exported',
|
|
148
|
+
defaultMessage: '<b>{count}</b> {resourceType} are selected and will be exported.'
|
|
149
|
+
},
|
|
150
|
+
exportBasedOnMyViewsMessage: {
|
|
151
|
+
id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
|
|
152
|
+
description: 'Select Export setttings based on my views',
|
|
153
|
+
defaultMessage: 'Select export settings based on:'
|
|
154
|
+
},
|
|
155
|
+
propertiesPanelLabel: {
|
|
156
|
+
id: 'ExportResourcesModal.propertiesPanelLabel',
|
|
157
|
+
description: 'properties panel label',
|
|
158
|
+
defaultMessage: 'Properties'
|
|
159
|
+
},
|
|
160
|
+
exportOperationSuccessMessage: {
|
|
161
|
+
id: 'ExportResourcesModal.exportOperationSuccessMessage',
|
|
162
|
+
description: 'Success message',
|
|
163
|
+
defaultMessage: '<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file.'
|
|
164
|
+
},
|
|
165
|
+
nothingApplied: {
|
|
166
|
+
id: 'ExportResourcesModal.nothingApplied',
|
|
167
|
+
description: 'Shown when there is no filter applied',
|
|
168
|
+
defaultMessage: 'nothing applied'
|
|
169
|
+
},
|
|
170
|
+
selectAllLocales: {
|
|
171
|
+
id: 'ExportResourcesModal.selectAllLocales',
|
|
172
|
+
description: 'label for "Select all locales" checkbox',
|
|
173
|
+
defaultMessage: 'Select all locales'
|
|
174
|
+
},
|
|
175
|
+
missingFileNameError: {
|
|
176
|
+
id: 'ExportResourcesModal.missingFileNameError',
|
|
177
|
+
description: 'Error when file name field is missing',
|
|
178
|
+
defaultMessage: 'Please enter a file name'
|
|
179
|
+
},
|
|
180
|
+
invalidFileNameError: {
|
|
181
|
+
id: 'ExportResourcesModal.invalidFileNameError',
|
|
182
|
+
description: 'Error when file name field is not valid',
|
|
183
|
+
defaultMessage: 'File name may only contain alphanumeric characters, hyphens and underscores'
|
|
184
|
+
},
|
|
185
|
+
missingLocaleError: {
|
|
186
|
+
id: 'ExportResourcesModal.missingLocaleError',
|
|
187
|
+
description: 'Error when no locale is selected',
|
|
188
|
+
defaultMessage: 'Please select at least one locale'
|
|
189
|
+
},
|
|
190
|
+
myViews: {
|
|
191
|
+
id: 'ExportResourcesModal.myViews',
|
|
192
|
+
description: 'Label for "My Views" Select Field',
|
|
193
|
+
defaultMessage: 'My Views'
|
|
194
|
+
},
|
|
195
|
+
selectFieldsToExport: {
|
|
196
|
+
id: 'ExportResourcesModal.selectFieldsToExport',
|
|
197
|
+
defaultMessage: 'Select fields to export'
|
|
198
|
+
},
|
|
199
|
+
back: {
|
|
200
|
+
id: 'ExportResourcesModal.back',
|
|
201
|
+
description: 'Label for "Back" button',
|
|
202
|
+
defaultMessage: 'Back'
|
|
203
|
+
},
|
|
204
|
+
startExport: {
|
|
205
|
+
id: 'ExportResourcesModal.startExport',
|
|
206
|
+
description: 'Label for "Start export" button',
|
|
207
|
+
defaultMessage: 'Start export'
|
|
208
|
+
},
|
|
209
|
+
continue: {
|
|
210
|
+
id: 'ExportResourcesModal.continue',
|
|
211
|
+
description: 'Label for "Continue" button',
|
|
212
|
+
defaultMessage: 'Continue'
|
|
213
|
+
},
|
|
214
|
+
fieldDefinitions: {
|
|
215
|
+
id: 'ExportResourcesModal.fieldDefinitions',
|
|
216
|
+
description: 'Label for "Field definitions" link',
|
|
217
|
+
defaultMessage: 'Field definitions'
|
|
218
|
+
},
|
|
219
|
+
allGeneralFields: {
|
|
220
|
+
id: 'ExportResourcesModal.allGeneralFields',
|
|
221
|
+
description: 'Label for "All general fields" checkbox',
|
|
222
|
+
defaultMessage: 'All general fields'
|
|
223
|
+
},
|
|
224
|
+
allCustomFields: {
|
|
225
|
+
id: 'ExportResourcesModal.allCustomFields',
|
|
226
|
+
description: 'Label for "All custom fields" checkbox',
|
|
227
|
+
defaultMessage: 'All custom fields'
|
|
228
|
+
},
|
|
229
|
+
customTypeKeyAndTypeId: {
|
|
230
|
+
id: 'ExportResourcesModal.customTypeKeyAndTypeId',
|
|
231
|
+
description: 'Label for "Custom type key and typeId" checkbox',
|
|
232
|
+
defaultMessage: 'Custom type key and typeId'
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
237
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
238
|
+
function renderFileNameError(key) {
|
|
239
|
+
switch (key) {
|
|
240
|
+
case 'missing':
|
|
241
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$5({}, messages.missingFileNameError));
|
|
242
|
+
case 'invalidInput':
|
|
243
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$5({}, messages.invalidFileNameError));
|
|
244
|
+
default:
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function renderLocaleError(key) {
|
|
249
|
+
switch (key) {
|
|
250
|
+
case 'missing':
|
|
251
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$5({}, messages.missingLocaleError));
|
|
252
|
+
default:
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const Z_INDEX_DROPDOWN = 30000;
|
|
258
|
+
|
|
87
259
|
const EXPORT_OPERATION_STATES = {
|
|
88
260
|
PROCESSING: 'processing',
|
|
89
261
|
COMPLETED: 'completed',
|
|
@@ -115,7 +287,7 @@ const OUTPUT_FORMAT_OPTIONS = [{
|
|
|
115
287
|
}];
|
|
116
288
|
|
|
117
289
|
const FIELD_DEFINITIONS_URLS = {
|
|
118
|
-
category: 'https://docs
|
|
290
|
+
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values'
|
|
119
291
|
};
|
|
120
292
|
|
|
121
293
|
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -178,9 +350,17 @@ let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
|
178
350
|
return _createClass(UnexpectedResourceTypeError);
|
|
179
351
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
180
352
|
|
|
353
|
+
function useExportResourcesContext() {
|
|
354
|
+
const context = React.useContext(ExportResourcesContext);
|
|
355
|
+
if (!context) {
|
|
356
|
+
throw new MissingExportResourceProviderError();
|
|
357
|
+
}
|
|
358
|
+
return context;
|
|
359
|
+
}
|
|
360
|
+
|
|
181
361
|
const _excluded$1 = ["name"];
|
|
182
|
-
function ownKeys$
|
|
183
|
-
function _objectSpread$
|
|
362
|
+
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
363
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys$4(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys$4(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
184
364
|
function resourceTypeToDisplayName(_ref) {
|
|
185
365
|
let resourceType = _ref.resourceType,
|
|
186
366
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
@@ -239,7 +419,7 @@ function flattenNestedFields(fields) {
|
|
|
239
419
|
var _context2;
|
|
240
420
|
return _mapInstanceProperty__default["default"](_context2 = flattenNestedFields(field.fields)).call(_context2, nestedField => {
|
|
241
421
|
var _context3;
|
|
242
|
-
return _objectSpread$
|
|
422
|
+
return _objectSpread$4(_objectSpread$4({}, nestedField), {}, {
|
|
243
423
|
name: _concatInstanceProperty__default["default"](_context3 = "".concat(field.name, ".")).call(_context3, nestedField.name)
|
|
244
424
|
});
|
|
245
425
|
});
|
|
@@ -279,7 +459,7 @@ function getSelectedGeneralFields(fields) {
|
|
|
279
459
|
function getSelectedCustomFields(customFields) {
|
|
280
460
|
return _mapInstanceProperty__default["default"](customFields).call(customFields, customType => {
|
|
281
461
|
var _context4;
|
|
282
|
-
return _objectSpread$
|
|
462
|
+
return _objectSpread$4(_objectSpread$4({}, customType), {}, {
|
|
283
463
|
fields: _filterInstanceProperty__default["default"](_context4 = customType.fields).call(_context4, field => field.isChecked)
|
|
284
464
|
});
|
|
285
465
|
});
|
|
@@ -288,7 +468,7 @@ function flattenCustomFields(customFields) {
|
|
|
288
468
|
return _flatMapInstanceProperty__default["default"](customFields).call(customFields, customType => customType.fields);
|
|
289
469
|
}
|
|
290
470
|
function checkRequiredFields(fields) {
|
|
291
|
-
return _mapInstanceProperty__default["default"](fields).call(fields, field => field.isRequired ? _objectSpread$
|
|
471
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => field.isRequired ? _objectSpread$4(_objectSpread$4({}, field), {}, {
|
|
292
472
|
isChecked: true
|
|
293
473
|
}) : field);
|
|
294
474
|
}
|
|
@@ -301,8 +481,8 @@ function getExportLogsLink(projectKey, msg) {
|
|
|
301
481
|
function setInitialCheckedStateForCustomFields(customFields) {
|
|
302
482
|
return _mapInstanceProperty__default["default"](customFields).call(customFields, customType => {
|
|
303
483
|
var _context5;
|
|
304
|
-
return _objectSpread$
|
|
305
|
-
fields: _mapInstanceProperty__default["default"](_context5 = customType.fields).call(_context5, field => _objectSpread$
|
|
484
|
+
return _objectSpread$4(_objectSpread$4({}, customType), {}, {
|
|
485
|
+
fields: _mapInstanceProperty__default["default"](_context5 = customType.fields).call(_context5, field => _objectSpread$4(_objectSpread$4({}, field), {}, {
|
|
306
486
|
isChecked: false
|
|
307
487
|
}))
|
|
308
488
|
});
|
|
@@ -479,184 +659,6 @@ const extendColumns = _ref => {
|
|
|
479
659
|
return extensionFunction(columns);
|
|
480
660
|
};
|
|
481
661
|
|
|
482
|
-
var messages = reactIntl.defineMessages({
|
|
483
|
-
modalTitle: {
|
|
484
|
-
id: 'ExportResourcesModal.modalTitle',
|
|
485
|
-
description: 'Label for the modal title',
|
|
486
|
-
defaultMessage: 'Export {resourceType}'
|
|
487
|
-
},
|
|
488
|
-
outputFormat: {
|
|
489
|
-
id: 'ExportResourcesModal.outputFormat',
|
|
490
|
-
description: 'File format like (csv, xls, ...etc)',
|
|
491
|
-
defaultMessage: 'File format'
|
|
492
|
-
},
|
|
493
|
-
fileName: {
|
|
494
|
-
id: 'ExportResourcesModal.fileName',
|
|
495
|
-
description: 'exported file name',
|
|
496
|
-
defaultMessage: 'File name'
|
|
497
|
-
},
|
|
498
|
-
locale: {
|
|
499
|
-
id: 'ExportResourcesModal.locale',
|
|
500
|
-
description: 'Locale',
|
|
501
|
-
defaultMessage: 'Locale'
|
|
502
|
-
},
|
|
503
|
-
exportSelection: {
|
|
504
|
-
id: 'ExportResourcesModal.exportSelection',
|
|
505
|
-
description: 'Export selection',
|
|
506
|
-
defaultMessage: 'Export selection'
|
|
507
|
-
},
|
|
508
|
-
exportAllResources: {
|
|
509
|
-
id: 'ExportResourcesModal.exportAllResources',
|
|
510
|
-
description: 'Export All selection',
|
|
511
|
-
defaultMessage: 'Export all {resourceType} ({count})'
|
|
512
|
-
},
|
|
513
|
-
exportOnlySelectedResources: {
|
|
514
|
-
id: 'ExportResourcesModal.exportOnlySelectedResources',
|
|
515
|
-
description: 'Export only selected resources',
|
|
516
|
-
defaultMessage: 'Export selected {resourceType} ({count})'
|
|
517
|
-
},
|
|
518
|
-
exportAllMessage: {
|
|
519
|
-
id: 'ExportResourcesModal.exportAllMessage',
|
|
520
|
-
description: 'All resources will be exported',
|
|
521
|
-
defaultMessage: 'All <b>{count}</b> {resourceType} will be exported.'
|
|
522
|
-
},
|
|
523
|
-
exportMatchingMessage: {
|
|
524
|
-
id: 'ExportResourcesModal.exportMatchingMessage',
|
|
525
|
-
description: 'resources will be exported',
|
|
526
|
-
defaultMessage: '<b>{count}</b> {resourceType} will be exported.'
|
|
527
|
-
},
|
|
528
|
-
exportSelectedMessage: {
|
|
529
|
-
id: 'ExportResourcesModal.exportSelectedMessage',
|
|
530
|
-
description: 'resources are selected and will be exported',
|
|
531
|
-
defaultMessage: '<b>{count}</b> {resourceType} are selected and will be exported.'
|
|
532
|
-
},
|
|
533
|
-
exportBasedOnMyViewsMessage: {
|
|
534
|
-
id: 'ExportResourcesModal.exportBasedOnMyViewsMessage',
|
|
535
|
-
description: 'Select Export setttings based on my views',
|
|
536
|
-
defaultMessage: 'Select export settings based on:'
|
|
537
|
-
},
|
|
538
|
-
propertiesPanelLabel: {
|
|
539
|
-
id: 'ExportResourcesModal.propertiesPanelLabel',
|
|
540
|
-
description: 'properties panel label',
|
|
541
|
-
defaultMessage: 'Properties'
|
|
542
|
-
},
|
|
543
|
-
exportOperationSuccessMessage: {
|
|
544
|
-
id: 'ExportResourcesModal.exportOperationSuccessMessage',
|
|
545
|
-
description: 'Success message',
|
|
546
|
-
defaultMessage: '<b>Your export has started.</b> <newline></newline><logsLink>Go to Export logs</logsLink> to view the progress and download the file.'
|
|
547
|
-
},
|
|
548
|
-
nothingApplied: {
|
|
549
|
-
id: 'ExportResourcesModal.nothingApplied',
|
|
550
|
-
description: 'Shown when there is no filter applied',
|
|
551
|
-
defaultMessage: 'nothing applied'
|
|
552
|
-
},
|
|
553
|
-
selectAllLocales: {
|
|
554
|
-
id: 'ExportResourcesModal.selectAllLocales',
|
|
555
|
-
description: 'label for "Select all locales" checkbox',
|
|
556
|
-
defaultMessage: 'Select all locales'
|
|
557
|
-
},
|
|
558
|
-
missingFileNameError: {
|
|
559
|
-
id: 'ExportResourcesModal.missingFileNameError',
|
|
560
|
-
description: 'Error when file name field is missing',
|
|
561
|
-
defaultMessage: 'Please enter a file name'
|
|
562
|
-
},
|
|
563
|
-
invalidFileNameError: {
|
|
564
|
-
id: 'ExportResourcesModal.invalidFileNameError',
|
|
565
|
-
description: 'Error when file name field is not valid',
|
|
566
|
-
defaultMessage: 'File name may only contain alphanumeric characters, hyphens and underscores'
|
|
567
|
-
},
|
|
568
|
-
missingLocaleError: {
|
|
569
|
-
id: 'ExportResourcesModal.missingLocaleError',
|
|
570
|
-
description: 'Error when no locale is selected',
|
|
571
|
-
defaultMessage: 'Please select at least one locale'
|
|
572
|
-
},
|
|
573
|
-
myViews: {
|
|
574
|
-
id: 'ExportResourcesModal.myViews',
|
|
575
|
-
description: 'Label for "My Views" Select Field',
|
|
576
|
-
defaultMessage: 'My Views'
|
|
577
|
-
},
|
|
578
|
-
selectFieldsToExport: {
|
|
579
|
-
id: 'ExportResourcesModal.selectFieldsToExport',
|
|
580
|
-
defaultMessage: 'Select fields to export'
|
|
581
|
-
},
|
|
582
|
-
back: {
|
|
583
|
-
id: 'ExportResourcesModal.back',
|
|
584
|
-
description: 'Label for "Back" button',
|
|
585
|
-
defaultMessage: 'Back'
|
|
586
|
-
},
|
|
587
|
-
startExport: {
|
|
588
|
-
id: 'ExportResourcesModal.startExport',
|
|
589
|
-
description: 'Label for "Start export" button',
|
|
590
|
-
defaultMessage: 'Start export'
|
|
591
|
-
},
|
|
592
|
-
continue: {
|
|
593
|
-
id: 'ExportResourcesModal.continue',
|
|
594
|
-
description: 'Label for "Continue" button',
|
|
595
|
-
defaultMessage: 'Continue'
|
|
596
|
-
},
|
|
597
|
-
fieldDefinitions: {
|
|
598
|
-
id: 'ExportResourcesModal.fieldDefinitions',
|
|
599
|
-
description: 'Label for "Field definitions" link',
|
|
600
|
-
defaultMessage: 'Field definitions'
|
|
601
|
-
},
|
|
602
|
-
allGeneralFields: {
|
|
603
|
-
id: 'ExportResourcesModal.allGeneralFields',
|
|
604
|
-
description: 'Label for "All general fields" checkbox',
|
|
605
|
-
defaultMessage: 'All general fields'
|
|
606
|
-
},
|
|
607
|
-
allCustomFields: {
|
|
608
|
-
id: 'ExportResourcesModal.allCustomFields',
|
|
609
|
-
description: 'Label for "All custom fields" checkbox',
|
|
610
|
-
defaultMessage: 'All custom fields'
|
|
611
|
-
},
|
|
612
|
-
customTypeKeyAndTypeId: {
|
|
613
|
-
id: 'ExportResourcesModal.customTypeKeyAndTypeId',
|
|
614
|
-
description: 'Label for "Custom type key and typeId" checkbox',
|
|
615
|
-
defaultMessage: 'Custom type key and typeId'
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
|
|
619
|
-
function getBold(msg) {
|
|
620
|
-
return jsxRuntime.jsx(uiKit.Text.Body, {
|
|
621
|
-
as: "span",
|
|
622
|
-
isBold: true,
|
|
623
|
-
children: msg
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
function getNewLine() {
|
|
628
|
-
return jsxRuntime.jsx("br", {});
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
function ownKeys$4(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
632
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
633
|
-
function renderFileNameError(key) {
|
|
634
|
-
switch (key) {
|
|
635
|
-
case 'missing':
|
|
636
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.missingFileNameError));
|
|
637
|
-
case 'invalidInput':
|
|
638
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.invalidFileNameError));
|
|
639
|
-
default:
|
|
640
|
-
return null;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
function renderLocaleError(key) {
|
|
644
|
-
switch (key) {
|
|
645
|
-
case 'missing':
|
|
646
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$4({}, messages.missingLocaleError));
|
|
647
|
-
default:
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
function useExportResourcesContext() {
|
|
653
|
-
const context = React.useContext(ExportResourcesContext);
|
|
654
|
-
if (!context) {
|
|
655
|
-
throw new MissingExportResourceProviderError();
|
|
656
|
-
}
|
|
657
|
-
return context;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
662
|
const _excluded = ["isSelectedByDefault"];
|
|
661
663
|
function ownKeys$3(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
662
664
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$3(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$3(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
@@ -830,7 +832,13 @@ function ExportTextMessage() {
|
|
|
830
832
|
const ExportFileSettingsStep = () => {
|
|
831
833
|
const intl = reactIntl.useIntl();
|
|
832
834
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
833
|
-
formik = _useExportResourcesCo.formik
|
|
835
|
+
formik = _useExportResourcesCo.formik,
|
|
836
|
+
resourceType = _useExportResourcesCo.resourceType,
|
|
837
|
+
onClose = _useExportResourcesCo.onClose;
|
|
838
|
+
const resourceTypePlural = resourceTypeToDisplayName({
|
|
839
|
+
resourceType: resourceType,
|
|
840
|
+
isPlural: true
|
|
841
|
+
});
|
|
834
842
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
835
843
|
var _applicationContext$p;
|
|
836
844
|
return {
|
|
@@ -841,88 +849,88 @@ const ExportFileSettingsStep = () => {
|
|
|
841
849
|
locales = _useApplicationContex.locales,
|
|
842
850
|
locale = _useApplicationContex.locale;
|
|
843
851
|
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
844
|
-
return jsxRuntime.
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
name: "fileName",
|
|
865
|
-
onChange: formik.handleChange,
|
|
866
|
-
onBlur: formik.handleBlur,
|
|
867
|
-
value: _valuesInstanceProperty__default["default"](formik).fileName,
|
|
868
|
-
title: intl.formatMessage(messages.fileName),
|
|
869
|
-
touched: formik.touched.fileName,
|
|
870
|
-
errors: formik.errors.fileName,
|
|
871
|
-
renderError: renderFileNameError
|
|
852
|
+
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
853
|
+
isOpen: true,
|
|
854
|
+
title: intl.formatMessage(messages.modalTitle, {
|
|
855
|
+
resourceType: resourceTypePlural
|
|
856
|
+
}),
|
|
857
|
+
labelPrimary: intl.formatMessage(messages.continue),
|
|
858
|
+
onPrimaryButtonClick: formik.submitForm,
|
|
859
|
+
isPrimaryButtonDisabled: !formik.isValid,
|
|
860
|
+
onClose: onClose,
|
|
861
|
+
size: 16,
|
|
862
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
863
|
+
scale: "xxxl",
|
|
864
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
865
|
+
scale: "l",
|
|
866
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
867
|
+
alignItems: "center",
|
|
868
|
+
children: [jsxRuntime.jsx(uiKit.ExportIcon, {
|
|
869
|
+
size: "medium",
|
|
870
|
+
color: "neutral60"
|
|
871
|
+
}), jsxRuntime.jsx(ExportTextMessage, {})]
|
|
872
872
|
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
873
|
-
scale: "
|
|
873
|
+
scale: "m",
|
|
874
874
|
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
875
|
-
|
|
876
|
-
name: "locales",
|
|
877
|
-
value: _valuesInstanceProperty__default["default"](formik).locales,
|
|
878
|
-
title: intl.formatMessage(messages.locale),
|
|
879
|
-
options: mapLocalesToOptions(locales),
|
|
880
|
-
isMulti: true,
|
|
875
|
+
name: "outputFormat",
|
|
881
876
|
onChange: formik.handleChange,
|
|
882
877
|
onBlur: formik.handleBlur,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
}), jsxRuntime.jsx(uiKit.
|
|
887
|
-
|
|
888
|
-
onChange:
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
878
|
+
value: _valuesInstanceProperty__default["default"](formik).outputFormat,
|
|
879
|
+
title: intl.formatMessage(messages.outputFormat),
|
|
880
|
+
options: OUTPUT_FORMAT_OPTIONS
|
|
881
|
+
}), jsxRuntime.jsx(uiKit.TextField, {
|
|
882
|
+
name: "fileName",
|
|
883
|
+
onChange: formik.handleChange,
|
|
884
|
+
onBlur: formik.handleBlur,
|
|
885
|
+
value: _valuesInstanceProperty__default["default"](formik).fileName,
|
|
886
|
+
title: intl.formatMessage(messages.fileName),
|
|
887
|
+
touched: formik.touched.fileName,
|
|
888
|
+
errors: formik.errors.fileName,
|
|
889
|
+
renderError: renderFileNameError
|
|
890
|
+
}), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
891
|
+
scale: "xs",
|
|
892
|
+
children: [jsxRuntime.jsx(uiKit.SelectField, {
|
|
893
|
+
id: "locales",
|
|
894
|
+
name: "locales",
|
|
895
|
+
value: _valuesInstanceProperty__default["default"](formik).locales,
|
|
896
|
+
title: intl.formatMessage(messages.locale),
|
|
897
|
+
options: mapLocalesToOptions(locales),
|
|
898
|
+
isMulti: true,
|
|
899
|
+
onChange: formik.handleChange,
|
|
900
|
+
onBlur: formik.handleBlur,
|
|
901
|
+
touched: formik.touched.locales,
|
|
902
|
+
errors: formik.errors.locales,
|
|
903
|
+
renderError: renderLocaleError,
|
|
904
|
+
menuPortalTarget: document.body,
|
|
905
|
+
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
906
|
+
}), jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
907
|
+
isChecked: areAllLocalesChecked,
|
|
908
|
+
onChange: e => {
|
|
909
|
+
if (e.target.checked) formik.setFieldValue('locales', locales);else formik.setFieldValue('locales', [locale]);
|
|
910
|
+
},
|
|
911
|
+
children: intl.formatMessage(messages.selectAllLocales)
|
|
912
|
+
})]
|
|
892
913
|
})]
|
|
893
914
|
})]
|
|
894
|
-
})]
|
|
895
|
-
})
|
|
896
|
-
justifyContent: "flex-end",
|
|
897
|
-
children: jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
898
|
-
label: intl.formatMessage(messages.continue),
|
|
899
|
-
onClick: formik.submitForm,
|
|
900
|
-
isDisabled: !formik.isValid
|
|
901
|
-
})
|
|
902
|
-
})]
|
|
915
|
+
}), jsxRuntime.jsx("div", {})]
|
|
916
|
+
})
|
|
903
917
|
});
|
|
904
918
|
};
|
|
905
919
|
|
|
906
920
|
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
907
921
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context12, _context13; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context12 = ownKeys$1(Object(t), !0)).call(_context12, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context13 = ownKeys$1(Object(t))).call(_context13, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
908
|
-
const
|
|
909
|
-
target: "e1ocu3bb2"
|
|
910
|
-
} )({
|
|
911
|
-
name: "yqmzw4",
|
|
912
|
-
styles: "&>div{height:490px;overflow-y:auto;}"
|
|
913
|
-
} );
|
|
914
|
-
const StyledCardLeft = /*#__PURE__*/_styled__default["default"](StyledCard, {
|
|
922
|
+
const StyledCardLeft = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
915
923
|
target: "e1ocu3bb1"
|
|
916
|
-
} )("background-color:#f9f9fb;border-top:", _ref => {
|
|
924
|
+
} )("height:100%;background-color:#f9f9fb;border-top:", _ref => {
|
|
917
925
|
let isTopRow = _ref.isTopRow;
|
|
918
926
|
return isTopRow ? uiKit.designTokens.borderForCardWhenRaised : 'none';
|
|
919
927
|
}, ";border-radius:", _ref2 => {
|
|
920
928
|
let isTopRow = _ref2.isTopRow;
|
|
921
929
|
return isTopRow ? '4px 0px 0px 0px' : '0px 0px 0px 4px';
|
|
922
930
|
}, ";" + ("" ));
|
|
923
|
-
const StyledCardRight = /*#__PURE__*/_styled__default["default"](
|
|
931
|
+
const StyledCardRight = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
924
932
|
target: "e1ocu3bb0"
|
|
925
|
-
} )("border-left:0;border-top:", _ref3 => {
|
|
933
|
+
} )("height:100%;border-left:0;border-top:", _ref3 => {
|
|
926
934
|
let isTopRow = _ref3.isTopRow;
|
|
927
935
|
return isTopRow ? uiKit.designTokens.borderForCardWhenRaised : 'none';
|
|
928
936
|
}, ";border-radius:", _ref4 => {
|
|
@@ -930,120 +938,140 @@ const StyledCardRight = /*#__PURE__*/_styled__default["default"](StyledCard, {
|
|
|
930
938
|
return isTopRow ? '0px 4px 0px 0px' : '0px 0px 4px 0px';
|
|
931
939
|
}, ";" + ("" ));
|
|
932
940
|
const ExportFieldsSelectionStep = () => {
|
|
933
|
-
var
|
|
941
|
+
var _formik$values$custom;
|
|
934
942
|
const intl = reactIntl.useIntl();
|
|
935
943
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
936
944
|
formik = _useExportResourcesCo.formik,
|
|
937
945
|
setCurrentStep = _useExportResourcesCo.setCurrentStep,
|
|
938
|
-
resourceType = _useExportResourcesCo.resourceType
|
|
939
|
-
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
children: jsxRuntime.jsx(
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
}), ((_formik$values$custom = _valuesInstanceProperty__default["default"](formik).customFields) === null || _formik$values$custom === void 0 ? void 0 : _formik$values$custom.length) > 0 && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
946
|
+
resourceType = _useExportResourcesCo.resourceType,
|
|
947
|
+
onClose = _useExportResourcesCo.onClose;
|
|
948
|
+
const resourceTypePlural = resourceTypeToDisplayName({
|
|
949
|
+
resourceType: resourceType,
|
|
950
|
+
isPlural: true
|
|
951
|
+
});
|
|
952
|
+
const areAllGeneralFieldsChecked = React__default["default"].useMemo(() => {
|
|
953
|
+
var _context;
|
|
954
|
+
return _everyInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).fields).call(_context, field => field.isChecked);
|
|
955
|
+
}, [_valuesInstanceProperty__default["default"](formik).fields]);
|
|
956
|
+
const isAtLeastOneGeneralFieldChecked = React__default["default"].useMemo(() => {
|
|
957
|
+
var _context2;
|
|
958
|
+
return _someInstanceProperty__default["default"](_context2 = _valuesInstanceProperty__default["default"](formik).fields).call(_context2, field => field.isChecked);
|
|
959
|
+
}, [_valuesInstanceProperty__default["default"](formik).fields]);
|
|
960
|
+
const allCustomFields = React__default["default"].useMemo(() => {
|
|
961
|
+
var _context3;
|
|
962
|
+
return _flatMapInstanceProperty__default["default"](_context3 = _valuesInstanceProperty__default["default"](formik).customFields).call(_context3, customType => customType.fields);
|
|
963
|
+
}, [_valuesInstanceProperty__default["default"](formik).customFields]);
|
|
964
|
+
const areAllCustomFieldsChecked = React__default["default"].useMemo(() => {
|
|
965
|
+
return _everyInstanceProperty__default["default"](allCustomFields).call(allCustomFields, field => field.isChecked);
|
|
966
|
+
}, [allCustomFields]);
|
|
967
|
+
const isAtLeastOneCustomFieldChecked = React__default["default"].useMemo(() => {
|
|
968
|
+
return _someInstanceProperty__default["default"](allCustomFields).call(allCustomFields, field => field.isChecked);
|
|
969
|
+
}, [allCustomFields]);
|
|
970
|
+
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
971
|
+
isOpen: true,
|
|
972
|
+
title: intl.formatMessage(messages.modalTitle, {
|
|
973
|
+
resourceType: resourceTypePlural
|
|
974
|
+
}),
|
|
975
|
+
labelPrimary: intl.formatMessage(messages.startExport),
|
|
976
|
+
onPrimaryButtonClick: formik.submitForm,
|
|
977
|
+
isPrimaryButtonDisabled: !formik.isValid,
|
|
978
|
+
labelSecondary: intl.formatMessage(messages.back),
|
|
979
|
+
onSecondaryButtonClick: () => setCurrentStep(1),
|
|
980
|
+
onClose: onClose,
|
|
981
|
+
size: 16,
|
|
982
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
983
|
+
scale: "xl",
|
|
984
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
985
|
+
scale: "m",
|
|
986
|
+
children: [jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
987
|
+
justifyContent: "space-between",
|
|
988
|
+
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
989
|
+
intlMessage: messages.selectFieldsToExport
|
|
990
|
+
}), jsxRuntime.jsx(uiKit.Link, {
|
|
991
|
+
isExternal: true,
|
|
992
|
+
tone: "secondary",
|
|
993
|
+
intlMessage: messages.fieldDefinitions,
|
|
994
|
+
to: FIELD_DEFINITIONS_URLS[resourceType]
|
|
995
|
+
})]
|
|
996
|
+
}), jsxRuntime.jsxs(uiKit.Grid, {
|
|
997
|
+
gridAutoFlow: "row",
|
|
998
|
+
gridTemplateColumns: "".concat(uiKit.designTokens.constraint5, " auto"),
|
|
992
999
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
993
1000
|
children: jsxRuntime.jsx(StyledCardLeft, {
|
|
1001
|
+
isTopRow: true,
|
|
994
1002
|
insetScale: "l",
|
|
995
1003
|
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
996
|
-
isIndeterminate: !
|
|
997
|
-
isChecked:
|
|
1004
|
+
isIndeterminate: !areAllGeneralFieldsChecked && isAtLeastOneGeneralFieldChecked,
|
|
1005
|
+
isChecked: areAllGeneralFieldsChecked,
|
|
998
1006
|
onChange: e => {
|
|
999
|
-
var
|
|
1000
|
-
formik.setFieldValue('
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
fields: _mapInstanceProperty__default["default"](_context6 = customType.fields).call(_context6, field => _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1004
|
-
isChecked: e.target.checked
|
|
1005
|
-
}))
|
|
1006
|
-
});
|
|
1007
|
-
}));
|
|
1007
|
+
var _context4;
|
|
1008
|
+
formik.setFieldValue('fields', _mapInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](formik).fields).call(_context4, field => _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1009
|
+
isChecked: field.isRequired ? true : e.target.checked
|
|
1010
|
+
})));
|
|
1008
1011
|
},
|
|
1009
1012
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1010
|
-
intlMessage: messages.
|
|
1013
|
+
intlMessage: messages.allGeneralFields
|
|
1011
1014
|
})
|
|
1012
1015
|
})
|
|
1013
1016
|
})
|
|
1014
1017
|
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1015
1018
|
children: jsxRuntime.jsx(StyledCardRight, {
|
|
1019
|
+
isTopRow: true,
|
|
1016
1020
|
insetScale: "l",
|
|
1017
|
-
children: jsxRuntime.
|
|
1021
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1018
1022
|
scale: "s",
|
|
1019
|
-
children:
|
|
1020
|
-
|
|
1021
|
-
onChange: () => {},
|
|
1022
|
-
isChecked: isAtLeastOneCustomFieldChecked,
|
|
1023
|
-
children: jsxRuntime.jsxs(uiKit.Text.Body, {
|
|
1024
|
-
children: [intl.formatMessage(messages.customTypeKeyAndTypeId), " *"]
|
|
1025
|
-
})
|
|
1026
|
-
}), jsxRuntime.jsx(CustomFieldsSelection, {
|
|
1027
|
-
customFields: _valuesInstanceProperty__default["default"](formik).customFields,
|
|
1023
|
+
children: jsxRuntime.jsx(GeneralFieldsSelection, {
|
|
1024
|
+
fields: _valuesInstanceProperty__default["default"](formik).fields,
|
|
1028
1025
|
setFieldValue: formik.setFieldValue
|
|
1029
|
-
})
|
|
1026
|
+
})
|
|
1030
1027
|
})
|
|
1031
1028
|
})
|
|
1029
|
+
}), ((_formik$values$custom = _valuesInstanceProperty__default["default"](formik).customFields) === null || _formik$values$custom === void 0 ? void 0 : _formik$values$custom.length) > 0 && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1030
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1031
|
+
children: jsxRuntime.jsx(StyledCardLeft, {
|
|
1032
|
+
insetScale: "l",
|
|
1033
|
+
children: jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1034
|
+
isIndeterminate: !areAllCustomFieldsChecked && isAtLeastOneCustomFieldChecked,
|
|
1035
|
+
isChecked: areAllCustomFieldsChecked,
|
|
1036
|
+
onChange: e => {
|
|
1037
|
+
var _context5;
|
|
1038
|
+
formik.setFieldValue('customFields', _mapInstanceProperty__default["default"](_context5 = _valuesInstanceProperty__default["default"](formik).customFields).call(_context5, customType => {
|
|
1039
|
+
var _context6;
|
|
1040
|
+
return _objectSpread$1(_objectSpread$1({}, customType), {}, {
|
|
1041
|
+
fields: _mapInstanceProperty__default["default"](_context6 = customType.fields).call(_context6, field => _objectSpread$1(_objectSpread$1({}, field), {}, {
|
|
1042
|
+
isChecked: e.target.checked
|
|
1043
|
+
}))
|
|
1044
|
+
});
|
|
1045
|
+
}));
|
|
1046
|
+
},
|
|
1047
|
+
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1048
|
+
intlMessage: messages.allCustomFields
|
|
1049
|
+
})
|
|
1050
|
+
})
|
|
1051
|
+
})
|
|
1052
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1053
|
+
children: jsxRuntime.jsx(StyledCardRight, {
|
|
1054
|
+
insetScale: "l",
|
|
1055
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1056
|
+
scale: "s",
|
|
1057
|
+
children: [jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1058
|
+
isReadOnly: true,
|
|
1059
|
+
onChange: () => {},
|
|
1060
|
+
isChecked: isAtLeastOneCustomFieldChecked,
|
|
1061
|
+
children: jsxRuntime.jsxs(uiKit.Text.Body, {
|
|
1062
|
+
children: [intl.formatMessage(messages.customTypeKeyAndTypeId), ' ', "*"]
|
|
1063
|
+
})
|
|
1064
|
+
}), jsxRuntime.jsx(CustomFieldsSelection, {
|
|
1065
|
+
customFields: _valuesInstanceProperty__default["default"](formik).customFields,
|
|
1066
|
+
setFieldValue: formik.setFieldValue
|
|
1067
|
+
})]
|
|
1068
|
+
})
|
|
1069
|
+
})
|
|
1070
|
+
})]
|
|
1032
1071
|
})]
|
|
1033
1072
|
})]
|
|
1034
|
-
})
|
|
1035
|
-
})
|
|
1036
|
-
scale: "m",
|
|
1037
|
-
justifyContent: "flex-end",
|
|
1038
|
-
children: [jsxRuntime.jsx(uiKit.SecondaryButton, {
|
|
1039
|
-
label: intl.formatMessage(messages.back),
|
|
1040
|
-
onClick: () => setCurrentStep(1)
|
|
1041
|
-
}), jsxRuntime.jsx(uiKit.PrimaryButton, {
|
|
1042
|
-
label: intl.formatMessage(messages.startExport),
|
|
1043
|
-
onClick: formik.submitForm,
|
|
1044
|
-
isDisabled: !formik.isValid
|
|
1045
|
-
})]
|
|
1046
|
-
})]
|
|
1073
|
+
})
|
|
1074
|
+
})
|
|
1047
1075
|
});
|
|
1048
1076
|
};
|
|
1049
1077
|
const GeneralFieldsSelection = _ref5 => {
|
|
@@ -1176,17 +1204,12 @@ const ExportResourcesProvider = props => {
|
|
|
1176
1204
|
React__default["default"].useEffect(() => {
|
|
1177
1205
|
formik$1.validateForm();
|
|
1178
1206
|
}, [currentStep]);
|
|
1179
|
-
React__default["default"].useEffect(() => {
|
|
1180
|
-
if (props.isOpen) {
|
|
1181
|
-
formik$1.resetForm();
|
|
1182
|
-
setCurrentStep(1);
|
|
1183
|
-
}
|
|
1184
|
-
}, [props.isOpen]);
|
|
1185
1207
|
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
1186
1208
|
value: {
|
|
1209
|
+
formik: formik$1,
|
|
1187
1210
|
currentStep,
|
|
1188
1211
|
setCurrentStep,
|
|
1189
|
-
|
|
1212
|
+
onClose: props.onClose,
|
|
1190
1213
|
resourceType: props.resourceType,
|
|
1191
1214
|
exportType: props.exportType,
|
|
1192
1215
|
totalResourcesCount: props.totalResourcesCount,
|
|
@@ -1211,21 +1234,9 @@ const CurrentStep = () => {
|
|
|
1211
1234
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1212
1235
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1213
1236
|
const ExportResourcesModal = props => {
|
|
1214
|
-
|
|
1215
|
-
const resourceTypePlural = resourceTypeToDisplayName({
|
|
1216
|
-
resourceType: props.resourceType,
|
|
1217
|
-
isPlural: true
|
|
1218
|
-
});
|
|
1237
|
+
if (!props.isOpen) return null;
|
|
1219
1238
|
return jsxRuntime.jsx(ExportResourcesProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
1220
|
-
children: jsxRuntime.jsx(
|
|
1221
|
-
isOpen: props.isOpen,
|
|
1222
|
-
title: intl.formatMessage(messages.modalTitle, {
|
|
1223
|
-
resourceType: resourceTypePlural
|
|
1224
|
-
}),
|
|
1225
|
-
onClose: props.onClose,
|
|
1226
|
-
size: 16,
|
|
1227
|
-
children: jsxRuntime.jsx(CurrentStep, {})
|
|
1228
|
-
})
|
|
1239
|
+
children: jsxRuntime.jsx(CurrentStep, {})
|
|
1229
1240
|
}));
|
|
1230
1241
|
};
|
|
1231
1242
|
ExportResourcesModal.displayName = 'ExportResourcesModal';
|