@commercetools-frontend-extensions/export-resources-modal 4.0.5 → 4.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.
- package/README.md +2 -5
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +208 -162
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +208 -162
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +207 -161
- package/dist/declarations/src/@types/export-resources-modal-shape.d.ts +0 -1
- package/dist/declarations/src/export-resources-modal.d.ts +0 -1
- package/package.json +1 -1
|
@@ -9,10 +9,12 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
|
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
10
|
import { defineMessages, FormattedMessage, useIntl, IntlProvider } from 'react-intl';
|
|
11
11
|
import { useApplicationContext } from '@commercetools-frontend/application-shell-connectors';
|
|
12
|
-
import { Text, TextInput, Link, Spacings,
|
|
12
|
+
import { Text, TextInput, Link, Spacings, RadioInput, Grid, designTokens, SelectField, TextField, CheckboxInput, Card, SearchTextInput } from '@commercetools-frontend/ui-kit';
|
|
13
13
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
14
14
|
import _valuesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/values';
|
|
15
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
15
16
|
import { FormDialog } from '@commercetools-frontend/application-components';
|
|
17
|
+
import React, { useContext, createContext, useState, useEffect } from 'react';
|
|
16
18
|
import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
17
19
|
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
18
20
|
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
@@ -20,9 +22,7 @@ import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
|
|
|
20
22
|
import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
|
|
21
23
|
import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
|
|
22
24
|
import _wrapNativeSuper from '@babel/runtime-corejs3/helpers/esm/wrapNativeSuper';
|
|
23
|
-
import React, { useContext, createContext, useState, useEffect } from 'react';
|
|
24
25
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
25
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
26
26
|
import moment from 'moment';
|
|
27
27
|
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
28
28
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
@@ -210,17 +210,37 @@ var messages = defineMessages({
|
|
|
210
210
|
id: 'ExportResourcesModal.searchByEnteringTheExactFieldName',
|
|
211
211
|
description: 'In Export fields selection - Search by entering the exact field name message',
|
|
212
212
|
defaultMessage: 'Try searching by entering the exact field name.'
|
|
213
|
+
},
|
|
214
|
+
exportScope: {
|
|
215
|
+
id: 'ExportResourcesModal.exportScope',
|
|
216
|
+
description: 'Label for Export Scope',
|
|
217
|
+
defaultMessage: 'Scope'
|
|
218
|
+
},
|
|
219
|
+
exportScopeAll: {
|
|
220
|
+
id: 'ExportResourcesModal.exportScopeAll',
|
|
221
|
+
description: 'Label for Export All',
|
|
222
|
+
defaultMessage: 'Export all: {total} categories'
|
|
223
|
+
},
|
|
224
|
+
exportScopeSelected: {
|
|
225
|
+
id: 'ExportResourcesModal.exportScopeSelected',
|
|
226
|
+
description: 'Label for Export Selected',
|
|
227
|
+
defaultMessage: 'Export selected{total, select, 0 {} other {: {total} categories}}'
|
|
228
|
+
},
|
|
229
|
+
exportSettings: {
|
|
230
|
+
id: 'ExportResourcesModal.exportSettings',
|
|
231
|
+
description: 'Label for Export Settings',
|
|
232
|
+
defaultMessage: 'Settings'
|
|
213
233
|
}
|
|
214
234
|
});
|
|
215
235
|
|
|
216
|
-
function ownKeys$
|
|
217
|
-
function _objectSpread$
|
|
236
|
+
function ownKeys$5(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(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(_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
218
238
|
function renderFileNameError(key) {
|
|
219
239
|
switch (key) {
|
|
220
240
|
case 'missing':
|
|
221
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
241
|
+
return jsx(FormattedMessage, _objectSpread$5({}, messages.missingFileNameError));
|
|
222
242
|
case 'invalidInput':
|
|
223
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
243
|
+
return jsx(FormattedMessage, _objectSpread$5({}, messages.invalidFileNameError));
|
|
224
244
|
default:
|
|
225
245
|
return null;
|
|
226
246
|
}
|
|
@@ -228,64 +248,12 @@ function renderFileNameError(key) {
|
|
|
228
248
|
function renderLocaleError(key) {
|
|
229
249
|
switch (key) {
|
|
230
250
|
case 'missing':
|
|
231
|
-
return jsx(FormattedMessage, _objectSpread$
|
|
251
|
+
return jsx(FormattedMessage, _objectSpread$5({}, messages.missingLocaleError));
|
|
232
252
|
default:
|
|
233
253
|
return null;
|
|
234
254
|
}
|
|
235
255
|
}
|
|
236
256
|
|
|
237
|
-
const Z_INDEX_DROPDOWN = 30000;
|
|
238
|
-
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
239
|
-
|
|
240
|
-
const EXPORT_OPERATION_STATES = {
|
|
241
|
-
PROCESSING: 'processing',
|
|
242
|
-
COMPLETED: 'completed',
|
|
243
|
-
FAILED: 'failed'
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const EXPORT_TYPES = {
|
|
247
|
-
ALL: 'all',
|
|
248
|
-
FILTERED: 'filtered',
|
|
249
|
-
SELECTED: 'selected'
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
const EXPORTABLE_RESOURCES = {
|
|
253
|
-
CATEGORY: 'category',
|
|
254
|
-
PRODUCT: 'product',
|
|
255
|
-
DISCOUNT_CODE: 'discountCode'
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const OUTPUT_FORMATS = {
|
|
259
|
-
JSON: 'json',
|
|
260
|
-
CSV: 'csv'
|
|
261
|
-
};
|
|
262
|
-
const OUTPUT_FORMAT_OPTIONS = [{
|
|
263
|
-
value: OUTPUT_FORMATS.CSV,
|
|
264
|
-
label: 'CSV'
|
|
265
|
-
}, {
|
|
266
|
-
value: OUTPUT_FORMATS.JSON,
|
|
267
|
-
label: 'JSON'
|
|
268
|
-
}];
|
|
269
|
-
|
|
270
|
-
const FIELD_DEFINITIONS_URLS = {
|
|
271
|
-
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values'
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
275
|
-
function _isNativeReflectConstruct$4() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$4 = function () { return !!t; })(); }
|
|
276
|
-
let UnexpectedExportTypeError = /*#__PURE__*/function (_Error) {
|
|
277
|
-
_inherits(UnexpectedExportTypeError, _Error);
|
|
278
|
-
var _super = _createSuper$4(UnexpectedExportTypeError);
|
|
279
|
-
function UnexpectedExportTypeError(exportType) {
|
|
280
|
-
var _this;
|
|
281
|
-
_classCallCheck(this, UnexpectedExportTypeError);
|
|
282
|
-
_this = _super.call(this, "Unexpected export type: ".concat(exportType));
|
|
283
|
-
_this.name = 'UnexpectedExportTypeError';
|
|
284
|
-
return _this;
|
|
285
|
-
}
|
|
286
|
-
return _createClass(UnexpectedExportTypeError);
|
|
287
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
288
|
-
|
|
289
257
|
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(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
290
258
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
291
259
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
@@ -398,6 +366,43 @@ function validate(_ref) {
|
|
|
398
366
|
return omitEmpty(errors);
|
|
399
367
|
}
|
|
400
368
|
|
|
369
|
+
const Z_INDEX_DROPDOWN = 30000;
|
|
370
|
+
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
371
|
+
|
|
372
|
+
const EXPORT_OPERATION_STATES = {
|
|
373
|
+
PROCESSING: 'processing',
|
|
374
|
+
COMPLETED: 'completed',
|
|
375
|
+
FAILED: 'failed'
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
const EXPORT_TYPES = {
|
|
379
|
+
ALL: 'all',
|
|
380
|
+
FILTERED: 'filtered',
|
|
381
|
+
SELECTED: 'selected'
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
const EXPORTABLE_RESOURCES = {
|
|
385
|
+
CATEGORY: 'category',
|
|
386
|
+
PRODUCT: 'product',
|
|
387
|
+
DISCOUNT_CODE: 'discountCode'
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const OUTPUT_FORMATS = {
|
|
391
|
+
JSON: 'json',
|
|
392
|
+
CSV: 'csv'
|
|
393
|
+
};
|
|
394
|
+
const OUTPUT_FORMAT_OPTIONS = [{
|
|
395
|
+
value: OUTPUT_FORMATS.CSV,
|
|
396
|
+
label: 'CSV'
|
|
397
|
+
}, {
|
|
398
|
+
value: OUTPUT_FORMATS.JSON,
|
|
399
|
+
label: 'JSON'
|
|
400
|
+
}];
|
|
401
|
+
|
|
402
|
+
const FIELD_DEFINITIONS_URLS = {
|
|
403
|
+
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values'
|
|
404
|
+
};
|
|
405
|
+
|
|
401
406
|
function resourceTypeToDisplayName(_ref) {
|
|
402
407
|
let resourceType = _ref.resourceType,
|
|
403
408
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
@@ -477,8 +482,8 @@ function tmpBuildFilters(selectedResourceIds) {
|
|
|
477
482
|
return ["id in (".concat(formattedIds, ")")];
|
|
478
483
|
}
|
|
479
484
|
|
|
480
|
-
function ownKeys$
|
|
481
|
-
function _objectSpread$
|
|
485
|
+
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
486
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys$4(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys$4(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
482
487
|
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
483
488
|
const updateFields = (fields, parentChecked, fieldName) => {
|
|
484
489
|
return _mapInstanceProperty(fields).call(fields, field => {
|
|
@@ -502,14 +507,14 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
502
507
|
isChecked = false;
|
|
503
508
|
field.fields = updatedFields;
|
|
504
509
|
}
|
|
505
|
-
return _objectSpread$
|
|
510
|
+
return _objectSpread$4(_objectSpread$4({}, field), {}, {
|
|
506
511
|
isChecked
|
|
507
512
|
});
|
|
508
513
|
});
|
|
509
514
|
};
|
|
510
515
|
return _mapInstanceProperty(groups).call(groups, group => {
|
|
511
516
|
const updatedFields = updateFields(group.fields, false, group.groupLabel);
|
|
512
|
-
return _objectSpread$
|
|
517
|
+
return _objectSpread$4(_objectSpread$4({}, group), {}, {
|
|
513
518
|
fields: updatedFields
|
|
514
519
|
});
|
|
515
520
|
});
|
|
@@ -521,13 +526,13 @@ const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
|
521
526
|
if (field.fields) {
|
|
522
527
|
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
523
528
|
}
|
|
524
|
-
return _objectSpread$
|
|
529
|
+
return _objectSpread$4(_objectSpread$4({}, field), {}, {
|
|
525
530
|
additionalFieldExtensions: updatedAdditionalFieldExtensions
|
|
526
531
|
});
|
|
527
532
|
});
|
|
528
533
|
}
|
|
529
534
|
return _mapInstanceProperty(groups).call(groups, group => {
|
|
530
|
-
return _objectSpread$
|
|
535
|
+
return _objectSpread$4(_objectSpread$4({}, group), {}, {
|
|
531
536
|
fields: updateAdditionalFieldExtensions(group.fields, group.additionalFieldExtensions || [])
|
|
532
537
|
});
|
|
533
538
|
});
|
|
@@ -677,46 +682,53 @@ const useStartExportOperation = props => {
|
|
|
677
682
|
};
|
|
678
683
|
};
|
|
679
684
|
|
|
680
|
-
function ownKeys$
|
|
681
|
-
function _objectSpread$
|
|
682
|
-
function
|
|
683
|
-
|
|
685
|
+
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
686
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
687
|
+
function ExportScopeSection() {
|
|
688
|
+
var _originalSelectedReso;
|
|
684
689
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
685
|
-
|
|
690
|
+
exportType = _useExportResourcesCo.exportType,
|
|
686
691
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
692
|
+
originalSelectedResourceIds = _useExportResourcesCo.originalSelectedResourceIds,
|
|
693
|
+
onScopeChange = _useExportResourcesCo.onScopeChange;
|
|
694
|
+
return jsx(Spacings.Stack, {
|
|
695
|
+
scale: "m",
|
|
696
|
+
children: jsxs(RadioInput.Group, {
|
|
697
|
+
value: exportType,
|
|
698
|
+
onChange: e => {
|
|
699
|
+
onScopeChange(e.target.value);
|
|
700
|
+
},
|
|
701
|
+
direction: "stack",
|
|
702
|
+
directionProps: {
|
|
703
|
+
scale: 's'
|
|
704
|
+
},
|
|
705
|
+
children: [jsx(RadioInput.Option, {
|
|
706
|
+
value: EXPORT_TYPES.ALL,
|
|
707
|
+
children: jsx(Text.Body, {
|
|
708
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportScopeAll), {}, {
|
|
709
|
+
values: {
|
|
710
|
+
total: new Intl.NumberFormat().format(totalResourcesCount)
|
|
711
|
+
}
|
|
712
|
+
})
|
|
713
|
+
})
|
|
714
|
+
}), jsx(RadioInput.Option, {
|
|
715
|
+
value: EXPORT_TYPES.SELECTED,
|
|
716
|
+
isDisabled: !(originalSelectedResourceIds !== null && originalSelectedResourceIds !== void 0 && originalSelectedResourceIds.length),
|
|
717
|
+
children: jsx(Text.Body, {
|
|
718
|
+
tone: !(originalSelectedResourceIds !== null && originalSelectedResourceIds !== void 0 && originalSelectedResourceIds.length) ? 'tertiary' : undefined,
|
|
719
|
+
intlMessage: _objectSpread$3(_objectSpread$3({}, messages.exportScopeSelected), {}, {
|
|
720
|
+
values: {
|
|
721
|
+
total: new Intl.NumberFormat().format((_originalSelectedReso = originalSelectedResourceIds === null || originalSelectedResourceIds === void 0 ? void 0 : originalSelectedResourceIds.length) !== null && _originalSelectedReso !== void 0 ? _originalSelectedReso : 0)
|
|
722
|
+
}
|
|
723
|
+
})
|
|
724
|
+
})
|
|
725
|
+
})]
|
|
715
726
|
})
|
|
716
727
|
});
|
|
717
728
|
}
|
|
718
729
|
|
|
719
730
|
const ExportFileSettingsStep = () => {
|
|
731
|
+
var _context;
|
|
720
732
|
const intl = useIntl();
|
|
721
733
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
722
734
|
formik = _useExportResourcesCo.formik,
|
|
@@ -749,57 +761,67 @@ const ExportFileSettingsStep = () => {
|
|
|
749
761
|
size: 16,
|
|
750
762
|
children: jsxs(Spacings.Stack, {
|
|
751
763
|
scale: "xxxl",
|
|
752
|
-
children: [
|
|
764
|
+
children: [jsx(Spacings.Stack, {
|
|
753
765
|
scale: "l",
|
|
754
|
-
children:
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
766
|
+
children: jsxs(Grid, {
|
|
767
|
+
gridRowGap: designTokens.spacingL,
|
|
768
|
+
gridTemplateColumns: _concatInstanceProperty(_context = "calc(".concat(designTokens.constraint3, " + ")).call(_context, designTokens.spacingL, ") auto"),
|
|
769
|
+
children: [jsx(Grid.Item, {
|
|
770
|
+
children: jsx(Text.Body, {
|
|
771
|
+
intlMessage: messages.exportScope
|
|
772
|
+
})
|
|
773
|
+
}), jsx(Grid.Item, {
|
|
774
|
+
children: jsx(ExportScopeSection, {})
|
|
775
|
+
}), jsx(Grid.Item, {
|
|
776
|
+
children: jsx(Text.Body, {
|
|
777
|
+
intlMessage: messages.exportSettings
|
|
778
|
+
})
|
|
779
|
+
}), jsx(Grid.Item, {
|
|
780
|
+
children: jsxs(Spacings.Stack, {
|
|
781
|
+
scale: "m",
|
|
782
|
+
children: [jsx(SelectField, {
|
|
783
|
+
name: "outputFormat",
|
|
784
|
+
onChange: formik.handleChange,
|
|
785
|
+
onBlur: formik.handleBlur,
|
|
786
|
+
value: _valuesInstanceProperty(formik).outputFormat,
|
|
787
|
+
title: intl.formatMessage(messages.outputFormat),
|
|
788
|
+
options: OUTPUT_FORMAT_OPTIONS
|
|
789
|
+
}), jsx(TextField, {
|
|
790
|
+
name: "fileName",
|
|
791
|
+
onChange: formik.handleChange,
|
|
792
|
+
onBlur: formik.handleBlur,
|
|
793
|
+
value: _valuesInstanceProperty(formik).fileName,
|
|
794
|
+
title: intl.formatMessage(messages.fileName),
|
|
795
|
+
touched: formik.touched.fileName,
|
|
796
|
+
errors: formik.errors.fileName,
|
|
797
|
+
renderError: renderFileNameError
|
|
798
|
+
}), jsxs(Spacings.Stack, {
|
|
799
|
+
scale: "xs",
|
|
800
|
+
children: [jsx(SelectField, {
|
|
801
|
+
id: "locales",
|
|
802
|
+
name: "locales",
|
|
803
|
+
value: _valuesInstanceProperty(formik).locales,
|
|
804
|
+
title: intl.formatMessage(messages.locale),
|
|
805
|
+
options: mapLocalesToOptions(locales),
|
|
806
|
+
isMulti: true,
|
|
807
|
+
onChange: formik.handleChange,
|
|
808
|
+
onBlur: formik.handleBlur,
|
|
809
|
+
touched: formik.touched.locales,
|
|
810
|
+
errors: formik.errors.locales,
|
|
811
|
+
renderError: renderLocaleError,
|
|
812
|
+
menuPortalTarget: document.body,
|
|
813
|
+
menuPortalZIndex: Z_INDEX_DROPDOWN
|
|
814
|
+
}), jsx(CheckboxInput, {
|
|
815
|
+
isChecked: areAllLocalesChecked,
|
|
816
|
+
onChange: e => {
|
|
817
|
+
if (e.target.checked) formik.setFieldValue('locales', locales);else formik.setFieldValue('locales', [locale]);
|
|
818
|
+
},
|
|
819
|
+
children: intl.formatMessage(messages.selectAllLocales)
|
|
820
|
+
})]
|
|
821
|
+
})]
|
|
822
|
+
})
|
|
801
823
|
})]
|
|
802
|
-
})
|
|
824
|
+
})
|
|
803
825
|
}), jsx("div", {})]
|
|
804
826
|
})
|
|
805
827
|
});
|
|
@@ -841,8 +863,8 @@ const NoSearchResults = () => {
|
|
|
841
863
|
});
|
|
842
864
|
};
|
|
843
865
|
|
|
844
|
-
function ownKeys$
|
|
845
|
-
function _objectSpread$
|
|
866
|
+
function ownKeys$2(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
867
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context11, _context12; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context11 = ownKeys$2(Object(t), !0)).call(_context11, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context12 = ownKeys$2(Object(t))).call(_context12, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
846
868
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
847
869
|
const StyledGridCard = /*#__PURE__*/_styled(Card, process.env.NODE_ENV === "production" ? {
|
|
848
870
|
target: "e3xiyhb2"
|
|
@@ -965,17 +987,17 @@ const FieldGroupSection = _ref2 => {
|
|
|
965
987
|
function updateAllFields(fields, checked) {
|
|
966
988
|
return _mapInstanceProperty(fields).call(fields, field => {
|
|
967
989
|
if (field.fields) {
|
|
968
|
-
return _objectSpread$
|
|
990
|
+
return _objectSpread$2(_objectSpread$2({}, field), {}, {
|
|
969
991
|
fields: updateAllFields(field.fields, checked)
|
|
970
992
|
});
|
|
971
993
|
}
|
|
972
994
|
if (field.isReadOnly || field.isRequired) return field;
|
|
973
|
-
return _objectSpread$
|
|
995
|
+
return _objectSpread$2(_objectSpread$2({}, field), {}, {
|
|
974
996
|
isChecked: checked
|
|
975
997
|
});
|
|
976
998
|
});
|
|
977
999
|
}
|
|
978
|
-
formik.setFieldValue(parentKey, _objectSpread$
|
|
1000
|
+
formik.setFieldValue(parentKey, _objectSpread$2(_objectSpread$2({}, item), {}, {
|
|
979
1001
|
fields: updateAllFields(item.fields, e.target.checked)
|
|
980
1002
|
}));
|
|
981
1003
|
};
|
|
@@ -1068,11 +1090,11 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1068
1090
|
if (field.fields) {
|
|
1069
1091
|
const updatedFields = updateFields(field.fields, matches);
|
|
1070
1092
|
isHidden = isHidden && _everyInstanceProperty(updatedFields).call(updatedFields, f => f.isHidden);
|
|
1071
|
-
field = _objectSpread$
|
|
1093
|
+
field = _objectSpread$2(_objectSpread$2({}, field), {}, {
|
|
1072
1094
|
fields: updatedFields
|
|
1073
1095
|
});
|
|
1074
1096
|
}
|
|
1075
|
-
return _objectSpread$
|
|
1097
|
+
return _objectSpread$2(_objectSpread$2({}, field), {}, {
|
|
1076
1098
|
isHidden
|
|
1077
1099
|
});
|
|
1078
1100
|
});
|
|
@@ -1081,7 +1103,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1081
1103
|
return _mapInstanceProperty(_context10 = _valuesInstanceProperty(formik).groups).call(_context10, group => {
|
|
1082
1104
|
const updatedFields = updateFields(group.fields, false);
|
|
1083
1105
|
const isHidden = _everyInstanceProperty(updatedFields).call(updatedFields, field => field.isHidden);
|
|
1084
|
-
return _objectSpread$
|
|
1106
|
+
return _objectSpread$2(_objectSpread$2({}, group), {}, {
|
|
1085
1107
|
fields: updatedFields,
|
|
1086
1108
|
isHidden
|
|
1087
1109
|
});
|
|
@@ -1152,14 +1174,24 @@ process.env.NODE_ENV !== "production" ? {
|
|
|
1152
1174
|
|
|
1153
1175
|
const ExportResourcesContext = /*#__PURE__*/createContext();
|
|
1154
1176
|
|
|
1177
|
+
function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1178
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1155
1179
|
const ExportResourcesProvider = props => {
|
|
1180
|
+
var _props$selectedResour;
|
|
1156
1181
|
const initialValues = useInitialValues(props);
|
|
1157
|
-
const _useStartExportOperat = useStartExportOperation(props),
|
|
1158
|
-
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1159
1182
|
const _React$useState = React.useState(1),
|
|
1160
1183
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1161
1184
|
currentStep = _React$useState2[0],
|
|
1162
1185
|
setCurrentStep = _React$useState2[1];
|
|
1186
|
+
const _React$useState3 = React.useState({
|
|
1187
|
+
exportType: (_props$selectedResour = props.selectedResourceIds) !== null && _props$selectedResour !== void 0 && _props$selectedResour.length ? EXPORT_TYPES.SELECTED : EXPORT_TYPES.ALL,
|
|
1188
|
+
selectedResourceIds: props.selectedResourceIds
|
|
1189
|
+
}),
|
|
1190
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
1191
|
+
scope = _React$useState4[0],
|
|
1192
|
+
setScope = _React$useState4[1];
|
|
1193
|
+
const _useStartExportOperat = useStartExportOperation(_objectSpread$1(_objectSpread$1({}, props), scope)),
|
|
1194
|
+
startExportOperation = _useStartExportOperat.startExportOperation;
|
|
1163
1195
|
const onSubmit = async values => {
|
|
1164
1196
|
if (currentStep === 1) {
|
|
1165
1197
|
setCurrentStep(2);
|
|
@@ -1167,6 +1199,19 @@ const ExportResourcesProvider = props => {
|
|
|
1167
1199
|
startExportOperation(values);
|
|
1168
1200
|
}
|
|
1169
1201
|
};
|
|
1202
|
+
const onScopeChange = value => {
|
|
1203
|
+
if (value === EXPORT_TYPES.ALL) {
|
|
1204
|
+
setScope({
|
|
1205
|
+
exportType: value,
|
|
1206
|
+
selectedResourceIds: []
|
|
1207
|
+
});
|
|
1208
|
+
} else {
|
|
1209
|
+
setScope({
|
|
1210
|
+
exportType: value,
|
|
1211
|
+
selectedResourceIds: props.selectedResourceIds
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1170
1215
|
const formik = useFormik({
|
|
1171
1216
|
initialValues,
|
|
1172
1217
|
validate: values => validate({
|
|
@@ -1185,9 +1230,11 @@ const ExportResourcesProvider = props => {
|
|
|
1185
1230
|
setCurrentStep,
|
|
1186
1231
|
onClose: props.onClose,
|
|
1187
1232
|
resourceType: props.resourceType,
|
|
1188
|
-
exportType:
|
|
1233
|
+
exportType: scope.exportType,
|
|
1189
1234
|
totalResourcesCount: props.totalResourcesCount,
|
|
1190
|
-
selectedResourceIds:
|
|
1235
|
+
selectedResourceIds: scope.selectedResourceIds,
|
|
1236
|
+
originalSelectedResourceIds: props.selectedResourceIds,
|
|
1237
|
+
onScopeChange
|
|
1191
1238
|
},
|
|
1192
1239
|
children: props.children
|
|
1193
1240
|
});
|
|
@@ -1292,7 +1339,6 @@ ExportResourcesModal.displayName = 'ExportResourcesModal';
|
|
|
1292
1339
|
ExportResourcesModal.defaultProps = {
|
|
1293
1340
|
isOpen: false,
|
|
1294
1341
|
selectedResourceIds: [],
|
|
1295
|
-
exportType: EXPORT_TYPES.ALL,
|
|
1296
1342
|
outputFormat: OUTPUT_FORMATS.CSV,
|
|
1297
1343
|
fieldGroups: []
|
|
1298
1344
|
};
|
package/package.json
CHANGED