@commercetools-frontend-extensions/export-resources-modal 4.3.0 → 4.3.2
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.
|
@@ -16,18 +16,19 @@ var applicationShellConnectors = require('@commercetools-frontend/application-sh
|
|
|
16
16
|
var uiKit = require('@commercetools-frontend/ui-kit');
|
|
17
17
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
18
18
|
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/values');
|
|
19
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
19
20
|
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
20
21
|
var React = require('react');
|
|
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');
|
|
25
|
+
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
24
26
|
var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
25
27
|
var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
26
|
-
var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
|
|
27
28
|
var _wrapNativeSuper = require('@babel/runtime-corejs3/helpers/wrapNativeSuper');
|
|
28
29
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
29
30
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
30
|
-
var
|
|
31
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
31
32
|
var omitEmpty = require('omit-empty-es');
|
|
32
33
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
33
34
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -35,7 +36,6 @@ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
|
35
36
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
36
37
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
37
38
|
var moment = require('moment');
|
|
38
|
-
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
39
39
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
40
40
|
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
41
41
|
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
@@ -44,6 +44,7 @@ var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
|
44
44
|
var constants = require('@commercetools-frontend/constants');
|
|
45
45
|
var _styled = require('@emotion/styled/base');
|
|
46
46
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
+
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
47
48
|
var throttle = require('lodash/throttle');
|
|
48
49
|
var react = require('@emotion/react');
|
|
49
50
|
var get = require('lodash/get');
|
|
@@ -63,10 +64,11 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
|
|
|
63
64
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
64
65
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
65
66
|
var _valuesInstanceProperty__default = /*#__PURE__*/_interopDefault(_valuesInstanceProperty);
|
|
67
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
66
68
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
67
69
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
68
70
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
69
|
-
var
|
|
71
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
70
72
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
71
73
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
72
74
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -74,11 +76,11 @@ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
|
74
76
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
75
77
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
76
78
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
77
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
78
79
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
79
80
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
80
81
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
81
82
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
83
|
+
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
82
84
|
var throttle__default = /*#__PURE__*/_interopDefault(throttle);
|
|
83
85
|
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
84
86
|
|
|
@@ -297,59 +299,63 @@ function renderLocaleError(key) {
|
|
|
297
299
|
}
|
|
298
300
|
}
|
|
299
301
|
|
|
300
|
-
function
|
|
302
|
+
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); }; }
|
|
301
303
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function () { return !!t; })(); }
|
|
302
304
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
305
|
+
_inherits(MissingExportResourceProviderError, _Error);
|
|
306
|
+
var _super = _createSuper$3(MissingExportResourceProviderError);
|
|
303
307
|
function MissingExportResourceProviderError() {
|
|
304
308
|
var _this;
|
|
305
309
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
306
|
-
_this =
|
|
310
|
+
_this = _super.call(this, 'useExportResourcesContext must be used within ExportResourcesProvider');
|
|
307
311
|
_this.name = 'MissingExportResourceProviderError';
|
|
308
312
|
return _this;
|
|
309
313
|
}
|
|
310
|
-
_inherits(MissingExportResourceProviderError, _Error);
|
|
311
314
|
return _createClass(MissingExportResourceProviderError);
|
|
312
315
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
313
316
|
|
|
314
|
-
function
|
|
317
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); 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); }; }
|
|
315
318
|
function _isNativeReflectConstruct$2() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$2 = function () { return !!t; })(); }
|
|
316
319
|
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
320
|
+
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
321
|
+
var _super = _createSuper$2(UnexpectedExportOperationStateError);
|
|
317
322
|
function UnexpectedExportOperationStateError(state) {
|
|
318
323
|
var _this;
|
|
319
324
|
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
320
|
-
_this =
|
|
325
|
+
_this = _super.call(this, "Unexpected export operation state \"".concat(state, "\""));
|
|
321
326
|
_this.name = 'UnexpectedExportOperationStateError';
|
|
322
327
|
return _this;
|
|
323
328
|
}
|
|
324
|
-
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
325
329
|
return _createClass(UnexpectedExportOperationStateError);
|
|
326
330
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
327
331
|
|
|
328
|
-
function
|
|
332
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); 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); }; }
|
|
329
333
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function () { return !!t; })(); }
|
|
330
334
|
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
335
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
336
|
+
var _super = _createSuper$1(UnexpectedResourceTypeError);
|
|
331
337
|
function UnexpectedResourceTypeError(resourceType) {
|
|
332
338
|
var _this;
|
|
333
339
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
334
|
-
_this =
|
|
340
|
+
_this = _super.call(this, "Unexpected resource type \"".concat(resourceType, "\""));
|
|
335
341
|
_this.name = 'UnexpectedResourceTypeError';
|
|
336
342
|
return _this;
|
|
337
343
|
}
|
|
338
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
339
344
|
return _createClass(UnexpectedResourceTypeError);
|
|
340
345
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
341
346
|
|
|
342
|
-
function
|
|
347
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); 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); }; }
|
|
343
348
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
344
349
|
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
350
|
+
_inherits(InvalidResponseError, _Error);
|
|
351
|
+
var _super = _createSuper(InvalidResponseError);
|
|
345
352
|
function InvalidResponseError(message) {
|
|
346
353
|
var _this;
|
|
347
354
|
_classCallCheck(this, InvalidResponseError);
|
|
348
|
-
_this =
|
|
355
|
+
_this = _super.call(this, message);
|
|
349
356
|
_this.name = 'InvalidResponseError';
|
|
350
357
|
return _this;
|
|
351
358
|
}
|
|
352
|
-
_inherits(InvalidResponseError, _Error);
|
|
353
359
|
return _createClass(InvalidResponseError);
|
|
354
360
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
355
361
|
|
|
@@ -362,7 +368,7 @@ function useExportResourcesContext() {
|
|
|
362
368
|
}
|
|
363
369
|
|
|
364
370
|
function checkAtLeastOneFieldChecked(fields) {
|
|
365
|
-
return fields
|
|
371
|
+
return fields === null || fields === void 0 ? void 0 : _someInstanceProperty__default["default"](fields).call(fields, field => {
|
|
366
372
|
if (field.fields) {
|
|
367
373
|
return field.isChecked || checkAtLeastOneFieldChecked(field.fields);
|
|
368
374
|
}
|
|
@@ -441,12 +447,6 @@ const OUTPUT_FORMAT_OPTIONS = [{
|
|
|
441
447
|
label: 'JSON'
|
|
442
448
|
}];
|
|
443
449
|
|
|
444
|
-
const FIELD_DEFINITIONS_URLS = {
|
|
445
|
-
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
446
|
-
product: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
|
|
447
|
-
'inventory-entry': 'https://docs.commercetools.com/merchant-center/import-inventory#supported-headers-and-values'
|
|
448
|
-
};
|
|
449
|
-
|
|
450
450
|
const resourceTypeMessages = {
|
|
451
451
|
category: {
|
|
452
452
|
exportScopeAll: messages.exportScopeAllCategories,
|
|
@@ -463,6 +463,7 @@ const resourceTypeMessages = {
|
|
|
463
463
|
};
|
|
464
464
|
|
|
465
465
|
function resourceTypeToFileName(_ref) {
|
|
466
|
+
var _context;
|
|
466
467
|
let resourceType = _ref.resourceType,
|
|
467
468
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
468
469
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -478,7 +479,7 @@ function resourceTypeToFileName(_ref) {
|
|
|
478
479
|
displayName = isPlural ? 'Products' : 'Product';
|
|
479
480
|
break;
|
|
480
481
|
case EXPORTABLE_RESOURCES.DISCOUNT_CODE:
|
|
481
|
-
displayName = isPlural ? 'Discount
|
|
482
|
+
displayName = isPlural ? 'Discount Codes' : 'Discount Code';
|
|
482
483
|
break;
|
|
483
484
|
case EXPORTABLE_RESOURCES.INVENTORY_ENTRY:
|
|
484
485
|
displayName = isPlural ? 'Inventories' : 'Inventory';
|
|
@@ -487,7 +488,7 @@ function resourceTypeToFileName(_ref) {
|
|
|
487
488
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
488
489
|
}
|
|
489
490
|
const result = isUpperCase ? displayName : displayName.toLowerCase();
|
|
490
|
-
return
|
|
491
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(result, "_Export_")).call(_context, todayFormatted);
|
|
491
492
|
}
|
|
492
493
|
function mapLocalesToOptions(locales) {
|
|
493
494
|
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
@@ -499,13 +500,14 @@ function isFilledArray(maybeArray) {
|
|
|
499
500
|
return _Array$isArray__default["default"](maybeArray) && maybeArray.length;
|
|
500
501
|
}
|
|
501
502
|
function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
503
|
+
var _context2;
|
|
502
504
|
const extensionRegex = /\.(csv|json)$/i;
|
|
503
|
-
if (!extensionRegex.test(fileName)) return
|
|
505
|
+
if (!extensionRegex.test(fileName)) return _concatInstanceProperty__default["default"](_context2 = "".concat(fileName, ".")).call(_context2, fileFormat);
|
|
504
506
|
return fileName;
|
|
505
507
|
}
|
|
506
508
|
function getExportLogsLink(projectKey, msg) {
|
|
507
509
|
return jsxRuntime.jsx(uiKit.Link, {
|
|
508
|
-
to:
|
|
510
|
+
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
509
511
|
children: msg
|
|
510
512
|
});
|
|
511
513
|
}
|
|
@@ -540,13 +542,13 @@ function sortFieldsByFieldOrder(_ref2) {
|
|
|
540
542
|
// Later, filters will be passed directly from parent views (category, product...) instead of being built within the Export resources modal
|
|
541
543
|
// The `selectedResourceIds` prop will also be removed
|
|
542
544
|
function tmpBuildFilters(selectedResourceIds) {
|
|
543
|
-
if (!selectedResourceIds || selectedResourceIds
|
|
544
|
-
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id =>
|
|
545
|
-
return [
|
|
545
|
+
if (!selectedResourceIds || (selectedResourceIds === null || selectedResourceIds === void 0 ? void 0 : selectedResourceIds.length) === 0) return undefined;
|
|
546
|
+
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
547
|
+
return ["id in (".concat(formattedIds, ")")];
|
|
546
548
|
}
|
|
547
549
|
|
|
548
550
|
function ownKeys$6(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; }
|
|
549
|
-
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
551
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$6(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$6(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
550
552
|
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
551
553
|
const updateFields = (fields, parentChecked, fieldName) => {
|
|
552
554
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
@@ -554,8 +556,10 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
554
556
|
if (field.isRequired) {
|
|
555
557
|
isChecked = true;
|
|
556
558
|
} else {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
+
var _context;
|
|
560
|
+
if (cachedSelectedGroups[_concatInstanceProperty__default["default"](_context = "".concat(fieldName, ".")).call(_context, field.name)] !== undefined) {
|
|
561
|
+
var _context2;
|
|
562
|
+
isChecked = cachedSelectedGroups[_concatInstanceProperty__default["default"](_context2 = "".concat(fieldName, ".")).call(_context2, field.name)];
|
|
559
563
|
} else if (!field.isReadOnly && field.isSelectedByDefault) {
|
|
560
564
|
isChecked = true;
|
|
561
565
|
} else if (parentChecked) {
|
|
@@ -563,7 +567,8 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
563
567
|
}
|
|
564
568
|
}
|
|
565
569
|
if (field.fields) {
|
|
566
|
-
|
|
570
|
+
var _context3;
|
|
571
|
+
const updatedFields = updateFields(field.fields, isChecked, _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, ".")).call(_context3, field.name));
|
|
567
572
|
isChecked = false;
|
|
568
573
|
field.fields = updatedFields;
|
|
569
574
|
}
|
|
@@ -614,7 +619,8 @@ const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
|
614
619
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
615
620
|
let isExpanded = null;
|
|
616
621
|
if (field.isExpandable) {
|
|
617
|
-
|
|
622
|
+
var _ref, _cachedExpandedGroups, _context4;
|
|
623
|
+
isExpanded = (_ref = (_cachedExpandedGroups = cachedExpandedGroups[_concatInstanceProperty__default["default"](_context4 = "".concat(groupName, ".")).call(_context4, field.name)]) !== null && _cachedExpandedGroups !== void 0 ? _cachedExpandedGroups : field.isExpanded) !== null && _ref !== void 0 ? _ref : false;
|
|
618
624
|
}
|
|
619
625
|
if (field.fields) {
|
|
620
626
|
field.fields = updateFields(field.fields, groupName);
|
|
@@ -628,9 +634,10 @@ const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
|
628
634
|
});
|
|
629
635
|
}
|
|
630
636
|
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
637
|
+
var _ref2, _cachedExpandedGroups2;
|
|
631
638
|
const updatedFields = updateFields(group.fields, group.groupName);
|
|
632
639
|
return _objectSpread$6(_objectSpread$6({}, group), {}, {
|
|
633
|
-
isExpanded: cachedExpandedGroups[group.groupName]
|
|
640
|
+
isExpanded: (_ref2 = (_cachedExpandedGroups2 = cachedExpandedGroups[group.groupName]) !== null && _cachedExpandedGroups2 !== void 0 ? _cachedExpandedGroups2 : group.isExpanded) !== null && _ref2 !== void 0 ? _ref2 : false,
|
|
634
641
|
fields: updatedFields
|
|
635
642
|
});
|
|
636
643
|
});
|
|
@@ -640,7 +647,7 @@ const isRequiredGroupChecked = function () {
|
|
|
640
647
|
let dependentGroupNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
641
648
|
let formik = arguments.length > 1 ? arguments[1] : undefined;
|
|
642
649
|
let result = false;
|
|
643
|
-
if (dependentGroupNames
|
|
650
|
+
if (dependentGroupNames !== null && dependentGroupNames !== void 0 && dependentGroupNames.length) {
|
|
644
651
|
_someInstanceProperty__default["default"](dependentGroupNames).call(dependentGroupNames, dependentGroupName => {
|
|
645
652
|
var _context;
|
|
646
653
|
const dependentGroup = _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).groups).call(_context, group => group.groupName === dependentGroupName);
|
|
@@ -662,20 +669,23 @@ const checkAllFieldsSelected = fields => {
|
|
|
662
669
|
};
|
|
663
670
|
|
|
664
671
|
const useInitialValues = props => {
|
|
665
|
-
var _context;
|
|
672
|
+
var _context, _context2, _context3;
|
|
666
673
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
667
674
|
locale: applicationContext.dataLocale
|
|
668
675
|
})),
|
|
669
676
|
locale = _useApplicationContex.locale;
|
|
670
|
-
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context =>
|
|
671
|
-
|
|
672
|
-
|
|
677
|
+
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context => {
|
|
678
|
+
var _context$project;
|
|
679
|
+
return {
|
|
680
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
681
|
+
};
|
|
682
|
+
}),
|
|
673
683
|
projectKey = _useApplicationContex2.projectKey;
|
|
674
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
684
|
+
const _useStorage = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context = "".concat(projectKey, "/")).call(_context, OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION), {}),
|
|
675
685
|
_useStorage2 = _slicedToArray(_useStorage, 1),
|
|
676
686
|
cachedSelectedGroups = _useStorage2[0];
|
|
677
|
-
const _useStorage3 = experimentalComponents.useStorage(
|
|
678
|
-
[props.resourceType]: _reduceInstanceProperty__default["default"](
|
|
687
|
+
const _useStorage3 = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context2 = "".concat(projectKey, "/")).call(_context2, OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP), {
|
|
688
|
+
[props.resourceType]: _reduceInstanceProperty__default["default"](_context3 = props.fieldGroups).call(_context3, (acc, group) => {
|
|
679
689
|
acc[group.groupName] = group.isExpanded;
|
|
680
690
|
return acc;
|
|
681
691
|
}, {})
|
|
@@ -687,11 +697,11 @@ const useInitialValues = props => {
|
|
|
687
697
|
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups[props.resourceType] || {});
|
|
688
698
|
return {
|
|
689
699
|
outputFormat: props.outputFormat,
|
|
690
|
-
fileName:
|
|
700
|
+
fileName: "".concat(resourceTypeToFileName({
|
|
691
701
|
resourceType: props.resourceType,
|
|
692
702
|
isUpperCase: true,
|
|
693
703
|
isPlural: true
|
|
694
|
-
})
|
|
704
|
+
})),
|
|
695
705
|
locales: [locale],
|
|
696
706
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
697
707
|
};
|
|
@@ -707,7 +717,7 @@ async function createExportOperation(_ref) {
|
|
|
707
717
|
locales = _ref.locales,
|
|
708
718
|
filters = _ref.filters,
|
|
709
719
|
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
710
|
-
const uri =
|
|
720
|
+
const uri = "/".concat(projectKey, "/export-operations");
|
|
711
721
|
const response = await asyncDispatchFn(sdk.actions.post({
|
|
712
722
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
713
723
|
uri: uri,
|
|
@@ -731,20 +741,24 @@ const useStartExportOperation = props => {
|
|
|
731
741
|
const intl = reactIntl.useIntl();
|
|
732
742
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
733
743
|
const showNotification = actionsGlobal.useShowNotification();
|
|
734
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext =>
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
744
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
745
|
+
var _applicationContext$p;
|
|
746
|
+
return {
|
|
747
|
+
locale: applicationContext.dataLocale,
|
|
748
|
+
projectKey: (_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.key
|
|
749
|
+
};
|
|
750
|
+
}),
|
|
738
751
|
projectKey = _useApplicationContex.projectKey;
|
|
739
752
|
const extractFieldsFromGroups = groups => {
|
|
740
753
|
let selectedGeneralFields = [];
|
|
741
754
|
const getSelectedFields = fields => {
|
|
742
755
|
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
756
|
+
var _field$isChecked;
|
|
743
757
|
if (field.fields) {
|
|
744
758
|
return getSelectedFields(field.fields);
|
|
745
759
|
}
|
|
746
760
|
if (field.isChecked) selectedGeneralFields.push(field);
|
|
747
|
-
return field.isChecked
|
|
761
|
+
return (_field$isChecked = field.isChecked) !== null && _field$isChecked !== void 0 ? _field$isChecked : false;
|
|
748
762
|
});
|
|
749
763
|
};
|
|
750
764
|
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
@@ -808,6 +822,7 @@ const useStartExportOperation = props => {
|
|
|
808
822
|
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; }
|
|
809
823
|
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; }
|
|
810
824
|
function ExportScopeSection() {
|
|
825
|
+
var _originalSelectedReso;
|
|
811
826
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
812
827
|
exportType = _useExportResourcesCo.exportType,
|
|
813
828
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
@@ -836,12 +851,12 @@ function ExportScopeSection() {
|
|
|
836
851
|
})
|
|
837
852
|
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
838
853
|
value: EXPORT_TYPES.SELECTED,
|
|
839
|
-
isDisabled: !originalSelectedResourceIds
|
|
854
|
+
isDisabled: !(originalSelectedResourceIds !== null && originalSelectedResourceIds !== void 0 && originalSelectedResourceIds.length),
|
|
840
855
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
841
|
-
tone: !originalSelectedResourceIds
|
|
842
|
-
intlMessage: originalSelectedResourceIds
|
|
856
|
+
tone: !(originalSelectedResourceIds !== null && originalSelectedResourceIds !== void 0 && originalSelectedResourceIds.length) ? 'tertiary' : undefined,
|
|
857
|
+
intlMessage: originalSelectedResourceIds !== null && originalSelectedResourceIds !== void 0 && originalSelectedResourceIds.length ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeSelected), {}, {
|
|
843
858
|
values: {
|
|
844
|
-
total: new Intl.NumberFormat().format(originalSelectedResourceIds
|
|
859
|
+
total: new Intl.NumberFormat().format((_originalSelectedReso = originalSelectedResourceIds === null || originalSelectedResourceIds === void 0 ? void 0 : originalSelectedResourceIds.length) !== null && _originalSelectedReso !== void 0 ? _originalSelectedReso : 0)
|
|
845
860
|
}
|
|
846
861
|
}) : messages.exportScopeSelectedWithoutCount
|
|
847
862
|
})
|
|
@@ -851,21 +866,25 @@ function ExportScopeSection() {
|
|
|
851
866
|
}
|
|
852
867
|
|
|
853
868
|
const ExportFileSettingsStep = () => {
|
|
869
|
+
var _context;
|
|
854
870
|
const intl = reactIntl.useIntl();
|
|
855
871
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
856
872
|
formik = _useExportResourcesCo.formik,
|
|
857
873
|
resourceType = _useExportResourcesCo.resourceType,
|
|
858
874
|
onClose = _useExportResourcesCo.onClose;
|
|
859
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext =>
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
875
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => {
|
|
876
|
+
var _applicationContext$p;
|
|
877
|
+
return {
|
|
878
|
+
locale: applicationContext.dataLocale,
|
|
879
|
+
locales: ((_applicationContext$p = applicationContext.project) === null || _applicationContext$p === void 0 ? void 0 : _applicationContext$p.languages) || []
|
|
880
|
+
};
|
|
881
|
+
}),
|
|
863
882
|
locales = _useApplicationContex.locales,
|
|
864
883
|
locale = _useApplicationContex.locale;
|
|
865
884
|
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
866
885
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
867
886
|
isOpen: true,
|
|
868
|
-
title: intl.formatMessage(messages[
|
|
887
|
+
title: intl.formatMessage(messages["modalTitle.".concat(resourceType)]),
|
|
869
888
|
labelPrimary: intl.formatMessage(messages.continue),
|
|
870
889
|
onPrimaryButtonClick: formik.submitForm,
|
|
871
890
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -878,7 +897,7 @@ const ExportFileSettingsStep = () => {
|
|
|
878
897
|
scale: "l",
|
|
879
898
|
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
880
899
|
gridRowGap: uiKit.designTokens.spacingL,
|
|
881
|
-
gridTemplateColumns:
|
|
900
|
+
gridTemplateColumns: _concatInstanceProperty__default["default"](_context = "calc(".concat(uiKit.designTokens.constraint3, " + ")).call(_context, uiKit.designTokens.spacingL, ") auto"),
|
|
882
901
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
883
902
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
884
903
|
intlMessage: messages.exportScope
|
|
@@ -971,19 +990,23 @@ const NoSearchResults = () => {
|
|
|
971
990
|
};
|
|
972
991
|
|
|
973
992
|
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; }
|
|
974
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
993
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$4(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
975
994
|
const exportFieldSelectionContextDefaultValues = {
|
|
976
995
|
updateExpandedGroups: (_name, _value) => {}
|
|
977
996
|
};
|
|
978
997
|
const ExportFieldSelectionContext = /*#__PURE__*/React.createContext(exportFieldSelectionContextDefaultValues);
|
|
979
998
|
const ExportFieldSelectionProvider = _ref => {
|
|
999
|
+
var _context;
|
|
980
1000
|
let resourceType = _ref.resourceType,
|
|
981
1001
|
children = _ref.children;
|
|
982
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
983
|
-
|
|
984
|
-
|
|
1002
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1003
|
+
var _context$project;
|
|
1004
|
+
return {
|
|
1005
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
1006
|
+
};
|
|
1007
|
+
}),
|
|
985
1008
|
projectKey = _useApplicationContex.projectKey;
|
|
986
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
1009
|
+
const _useStorage = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context = "".concat(projectKey, "/")).call(_context, OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP), {}),
|
|
987
1010
|
_useStorage2 = _slicedToArray(_useStorage, 2),
|
|
988
1011
|
cachedExpandedGroups = _useStorage2[0],
|
|
989
1012
|
setCachedExpandedGroups = _useStorage2[1];
|
|
@@ -1021,18 +1044,20 @@ const calculateTotalSelectedFields = (group, formik) => {
|
|
|
1021
1044
|
// check `isReadOnly` fields
|
|
1022
1045
|
function countReadOnlyDependentFields(fields) {
|
|
1023
1046
|
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1047
|
+
var _field$dependentGroup;
|
|
1024
1048
|
if (field.fields) {
|
|
1025
1049
|
countReadOnlyDependentFields(field.fields);
|
|
1026
|
-
} else if (field.dependentGroupNames
|
|
1050
|
+
} else if ((_field$dependentGroup = field.dependentGroupNames) !== null && _field$dependentGroup !== void 0 && _field$dependentGroup.length && isRequiredGroupChecked(field.dependentGroupNames, formik)) {
|
|
1027
1051
|
result += 1;
|
|
1028
1052
|
}
|
|
1029
1053
|
});
|
|
1030
1054
|
}
|
|
1031
1055
|
function countReadOnlyFields(fields) {
|
|
1032
1056
|
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1057
|
+
var _field$dependentGroup2;
|
|
1033
1058
|
if (field.fields) {
|
|
1034
1059
|
countReadOnlyFields(field.fields);
|
|
1035
|
-
} else if (field.isReadOnly && !field.dependentGroupNames
|
|
1060
|
+
} else if (field.isReadOnly && !((_field$dependentGroup2 = field.dependentGroupNames) !== null && _field$dependentGroup2 !== void 0 && _field$dependentGroup2.length)) {
|
|
1036
1061
|
result += 1;
|
|
1037
1062
|
}
|
|
1038
1063
|
});
|
|
@@ -1089,7 +1114,7 @@ const CollapsibleFieldWrapper = _ref => {
|
|
|
1089
1114
|
registerContentNode
|
|
1090
1115
|
});
|
|
1091
1116
|
}
|
|
1092
|
-
},
|
|
1117
|
+
}, "".concat(isForceExpanded));
|
|
1093
1118
|
return children({
|
|
1094
1119
|
isOpen: true,
|
|
1095
1120
|
toggle: () => {},
|
|
@@ -1107,13 +1132,28 @@ const FieldSection = _ref3 => {
|
|
|
1107
1132
|
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1108
1133
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1109
1134
|
scale: "s",
|
|
1110
|
-
children: fields
|
|
1135
|
+
children: fields === null || fields === void 0 ? void 0 : _mapInstanceProperty__default["default"](fields).call(fields, (field, index) => {
|
|
1136
|
+
var _context;
|
|
1111
1137
|
const isAnyOfTheChildFieldsChecked = checkAtLeastOneFieldChecked(field.fields);
|
|
1138
|
+
const allAllFieldsSelected = checkAllFieldsSelected(field.fields || []);
|
|
1139
|
+
const checkIsChecked = () => {
|
|
1140
|
+
if (field.isExpandable) {
|
|
1141
|
+
return allAllFieldsSelected;
|
|
1142
|
+
}
|
|
1143
|
+
if (field.isReadOnly) {
|
|
1144
|
+
if (field.dependentGroupNames) {
|
|
1145
|
+
return isRequiredGroupChecked(field.dependentGroupNames, formik);
|
|
1146
|
+
}
|
|
1147
|
+
return isAnySiblingChecked;
|
|
1148
|
+
}
|
|
1149
|
+
return isAnyOfTheChildFieldsChecked || field.isChecked;
|
|
1150
|
+
};
|
|
1112
1151
|
if (field.isHidden) return null;
|
|
1113
1152
|
return jsxRuntime.jsx(CollapsibleFieldWrapper, {
|
|
1114
1153
|
isForceExpanded: isForceExpanded,
|
|
1115
1154
|
field: field,
|
|
1116
1155
|
children: _ref4 => {
|
|
1156
|
+
var _context2, _field$fields3;
|
|
1117
1157
|
let isOpen = _ref4.isOpen,
|
|
1118
1158
|
toggle = _ref4.toggle,
|
|
1119
1159
|
registerContentNode = _ref4.registerContentNode;
|
|
@@ -1123,11 +1163,12 @@ const FieldSection = _ref3 => {
|
|
|
1123
1163
|
size: "20",
|
|
1124
1164
|
style: {
|
|
1125
1165
|
position: 'absolute',
|
|
1126
|
-
left:
|
|
1166
|
+
left: "calc(-1 * ".concat(uiKit.designTokens.spacingXl, ")")
|
|
1127
1167
|
},
|
|
1128
1168
|
onClick: () => {
|
|
1129
1169
|
if (!isForceExpanded) {
|
|
1130
|
-
|
|
1170
|
+
var _context3;
|
|
1171
|
+
updateExpandedGroups(_concatInstanceProperty__default["default"](_context3 = "".concat(groupName, ".")).call(_context3, field.name), !isOpen);
|
|
1131
1172
|
}
|
|
1132
1173
|
toggle();
|
|
1133
1174
|
},
|
|
@@ -1137,19 +1178,22 @@ const FieldSection = _ref3 => {
|
|
|
1137
1178
|
scale: "s",
|
|
1138
1179
|
alignItems: "center",
|
|
1139
1180
|
children: jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
1140
|
-
|
|
1181
|
+
isIndeterminate: field.isExpandable && !allAllFieldsSelected && isAnyOfTheChildFieldsChecked,
|
|
1182
|
+
isChecked: checkIsChecked(),
|
|
1141
1183
|
isReadOnly: field.isReadOnly || field.isRequired,
|
|
1142
1184
|
onChange: e => {
|
|
1143
|
-
|
|
1185
|
+
var _context4, _field$fields2;
|
|
1186
|
+
const path = _concatInstanceProperty__default["default"](_context4 = "".concat(parentKeys.join('.'), ".fields[")).call(_context4, index, "]");
|
|
1144
1187
|
// Update all child fields
|
|
1145
1188
|
const updateAllChildFieldsChecked = (path, checked) => {
|
|
1146
1189
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
1147
1190
|
if (item && item.fields) {
|
|
1148
|
-
var
|
|
1149
|
-
_forEachInstanceProperty__default["default"](
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1191
|
+
var _context5;
|
|
1192
|
+
_forEachInstanceProperty__default["default"](_context5 = item.fields).call(_context5, (field, i) => {
|
|
1193
|
+
var _context6, _field$fields;
|
|
1194
|
+
const fieldPath = _concatInstanceProperty__default["default"](_context6 = "".concat(path, ".fields[")).call(_context6, i, "]");
|
|
1195
|
+
if (!((_field$fields = field.fields) !== null && _field$fields !== void 0 && _field$fields.length)) {
|
|
1196
|
+
formik.setFieldValue("".concat(fieldPath, ".isChecked"), checked,
|
|
1153
1197
|
// pass `false` to avoid revalidating the form with intermediate values
|
|
1154
1198
|
false);
|
|
1155
1199
|
}
|
|
@@ -1157,8 +1201,8 @@ const FieldSection = _ref3 => {
|
|
|
1157
1201
|
});
|
|
1158
1202
|
}
|
|
1159
1203
|
};
|
|
1160
|
-
if (!field.fields
|
|
1161
|
-
formik.setFieldValue(
|
|
1204
|
+
if (!((_field$fields2 = field.fields) !== null && _field$fields2 !== void 0 && _field$fields2.length)) {
|
|
1205
|
+
formik.setFieldValue("".concat(path, ".isChecked"), e.target.checked,
|
|
1162
1206
|
// pass `false` to avoid revalidating the form with intermediate values
|
|
1163
1207
|
false);
|
|
1164
1208
|
}
|
|
@@ -1167,7 +1211,7 @@ const FieldSection = _ref3 => {
|
|
|
1167
1211
|
children: [field.label, " ", field.isRequired && '*']
|
|
1168
1212
|
})
|
|
1169
1213
|
})]
|
|
1170
|
-
}), field.fields && field.fields
|
|
1214
|
+
}), field.fields && ((_field$fields3 = field.fields) === null || _field$fields3 === void 0 ? void 0 : _field$fields3.length) > 0 && jsxRuntime.jsx(StyledExpandableContent, {
|
|
1171
1215
|
ref: registerContentNode,
|
|
1172
1216
|
isOpen: isOpen,
|
|
1173
1217
|
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
@@ -1175,16 +1219,16 @@ const FieldSection = _ref3 => {
|
|
|
1175
1219
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSection, {
|
|
1176
1220
|
fields: field.fields,
|
|
1177
1221
|
formik: formik,
|
|
1178
|
-
parentKeys: [...parentKeys,
|
|
1222
|
+
parentKeys: [...parentKeys, "fields[".concat(index, "]")],
|
|
1179
1223
|
isAnySiblingChecked: isAnySiblingChecked,
|
|
1180
1224
|
isForceExpanded: isForceExpanded,
|
|
1181
1225
|
groupName: groupName
|
|
1182
1226
|
})]
|
|
1183
1227
|
})
|
|
1184
1228
|
})]
|
|
1185
|
-
},
|
|
1229
|
+
}, _concatInstanceProperty__default["default"](_context2 = "".concat(field.name, "-")).call(_context2, index));
|
|
1186
1230
|
}
|
|
1187
|
-
},
|
|
1231
|
+
}, _concatInstanceProperty__default["default"](_context = "".concat(field.name, ".")).call(_context, isForceExpanded));
|
|
1188
1232
|
})
|
|
1189
1233
|
});
|
|
1190
1234
|
};
|
|
@@ -1213,7 +1257,7 @@ const FieldGroupSection = _ref2 => {
|
|
|
1213
1257
|
const isAtleastOneFieldChecked = React.useMemo(() => checkAtLeastOneFieldChecked(group.fields), [group.fields]);
|
|
1214
1258
|
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1215
1259
|
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1216
|
-
const parentKey =
|
|
1260
|
+
const parentKey = "groups[".concat(index, "]");
|
|
1217
1261
|
const handleChangeAllFields = e => {
|
|
1218
1262
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
1219
1263
|
function updateAllFields(fields, checked) {
|
|
@@ -1284,7 +1328,8 @@ const FieldGroupSection = _ref2 => {
|
|
|
1284
1328
|
formik: formik,
|
|
1285
1329
|
parentKeys: [parentKey],
|
|
1286
1330
|
isAnySiblingChecked: isAtleastOneFieldChecked,
|
|
1287
|
-
groupName: group.groupName
|
|
1331
|
+
groupName: group.groupName,
|
|
1332
|
+
isForceExpanded: isForceExpanded
|
|
1288
1333
|
})
|
|
1289
1334
|
})
|
|
1290
1335
|
})
|
|
@@ -1295,11 +1340,11 @@ const FieldGroupSection = _ref2 => {
|
|
|
1295
1340
|
})]
|
|
1296
1341
|
});
|
|
1297
1342
|
}
|
|
1298
|
-
},
|
|
1343
|
+
}, "".concat(isForceExpanded));
|
|
1299
1344
|
};
|
|
1300
1345
|
|
|
1301
1346
|
function ownKeys$2(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; }
|
|
1302
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
1347
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context9 = ownKeys$2(Object(t), !0)).call(_context9, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context10 = ownKeys$2(Object(t))).call(_context10, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1303
1348
|
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1304
1349
|
target: "e5mvpn60"
|
|
1305
1350
|
} )({
|
|
@@ -1307,16 +1352,20 @@ const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
|
1307
1352
|
styles: "max-height:50vh;overflow:auto"
|
|
1308
1353
|
} );
|
|
1309
1354
|
const ExportFieldsSelectionStep = () => {
|
|
1355
|
+
var _context, _context7, _context8;
|
|
1310
1356
|
const intl = reactIntl.useIntl();
|
|
1311
1357
|
const _React$useState = React__default["default"].useState(''),
|
|
1312
1358
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1313
1359
|
fieldSearchTerm = _React$useState2[0],
|
|
1314
1360
|
setFieldSearchTerm = _React$useState2[1];
|
|
1315
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
1316
|
-
|
|
1317
|
-
|
|
1361
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1362
|
+
var _context$project;
|
|
1363
|
+
return {
|
|
1364
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
1365
|
+
};
|
|
1366
|
+
}),
|
|
1318
1367
|
projectKey = _useApplicationContex.projectKey;
|
|
1319
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
1368
|
+
const _useStorage = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context = "".concat(projectKey, "/")).call(_context, OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION), {}),
|
|
1320
1369
|
_useStorage2 = _slicedToArray(_useStorage, 2);
|
|
1321
1370
|
_useStorage2[0];
|
|
1322
1371
|
const setCachedSelectedGroups = _useStorage2[1];
|
|
@@ -1326,18 +1375,19 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1326
1375
|
resourceType = _useExportResourcesCo.resourceType,
|
|
1327
1376
|
onClose = _useExportResourcesCo.onClose;
|
|
1328
1377
|
React__default["default"].useEffect(() => {
|
|
1329
|
-
var
|
|
1378
|
+
var _context4;
|
|
1330
1379
|
formik.validateForm();
|
|
1331
1380
|
const selectedFields = {};
|
|
1332
1381
|
function getSelectedFields(field, groupName) {
|
|
1333
|
-
|
|
1382
|
+
var _context2;
|
|
1383
|
+
const fieldName = field.name ? _concatInstanceProperty__default["default"](_context2 = "".concat(groupName, ".")).call(_context2, field.name) : groupName;
|
|
1334
1384
|
if (field.fields) {
|
|
1335
|
-
var
|
|
1336
|
-
return _forEachInstanceProperty__default["default"](
|
|
1385
|
+
var _context3;
|
|
1386
|
+
return _forEachInstanceProperty__default["default"](_context3 = field.fields).call(_context3, f => getSelectedFields(f, fieldName));
|
|
1337
1387
|
}
|
|
1338
1388
|
selectedFields[fieldName] = field.isChecked;
|
|
1339
1389
|
}
|
|
1340
|
-
_forEachInstanceProperty__default["default"](
|
|
1390
|
+
_forEachInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](formik).groups).call(_context4, group => getSelectedFields(group, group.groupLabel));
|
|
1341
1391
|
setCachedSelectedGroups({
|
|
1342
1392
|
[resourceType]: selectedFields
|
|
1343
1393
|
});
|
|
@@ -1345,11 +1395,11 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1345
1395
|
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
1346
1396
|
// adds `isHidden` property to each field based on search term
|
|
1347
1397
|
const filteredGroups = React__default["default"].useMemo(() => {
|
|
1348
|
-
var
|
|
1398
|
+
var _fieldSearchTerm$trim, _context6;
|
|
1349
1399
|
const updateFields = (fields, parentMatches) => {
|
|
1350
1400
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1351
|
-
var
|
|
1352
|
-
const matches = _includesInstanceProperty__default["default"](
|
|
1401
|
+
var _context5;
|
|
1402
|
+
const matches = _includesInstanceProperty__default["default"](_context5 = field.label.toLowerCase()).call(_context5, fieldSearchTerm.toLowerCase());
|
|
1353
1403
|
let isHidden = !matches && !parentMatches;
|
|
1354
1404
|
if (field.fields) {
|
|
1355
1405
|
const updatedFields = updateFields(field.fields, matches);
|
|
@@ -1363,8 +1413,8 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1363
1413
|
});
|
|
1364
1414
|
});
|
|
1365
1415
|
};
|
|
1366
|
-
if (!fieldSearchTerm
|
|
1367
|
-
return _mapInstanceProperty__default["default"](
|
|
1416
|
+
if (!(fieldSearchTerm !== null && fieldSearchTerm !== void 0 && (_fieldSearchTerm$trim = _trimInstanceProperty__default["default"](fieldSearchTerm).call(fieldSearchTerm)) !== null && _fieldSearchTerm$trim !== void 0 && _fieldSearchTerm$trim.length)) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
1417
|
+
return _mapInstanceProperty__default["default"](_context6 = _valuesInstanceProperty__default["default"](formik).groups).call(_context6, group => {
|
|
1368
1418
|
const updatedFields = updateFields(group.fields, false);
|
|
1369
1419
|
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
1370
1420
|
return _objectSpread$2(_objectSpread$2({}, group), {}, {
|
|
@@ -1393,40 +1443,32 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1393
1443
|
size: 16,
|
|
1394
1444
|
children: jsxRuntime.jsx(ExportFieldSelectionProvider, {
|
|
1395
1445
|
resourceType: resourceType,
|
|
1396
|
-
children: jsxRuntime.
|
|
1397
|
-
scale: "
|
|
1398
|
-
children: jsxRuntime.
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
,
|
|
1415
|
-
onSubmit: () => {}
|
|
1416
|
-
}), hasResults ? jsxRuntime.jsx(StyledGridCard, {
|
|
1417
|
-
insetScale: "none",
|
|
1418
|
-
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1419
|
-
gridAutoFlow: "row",
|
|
1420
|
-
gridTemplateColumns: `calc(${uiKit.designTokens.spacingL} + ${uiKit.designTokens.constraint5} + ${uiKit.designTokens.spacingL}) auto`,
|
|
1421
|
-
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => jsxRuntime.jsx(FieldGroupSection, {
|
|
1446
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1447
|
+
scale: "m",
|
|
1448
|
+
children: [jsxRuntime.jsx(uiKit.SearchTextInput, {
|
|
1449
|
+
placeholder: intl.formatMessage(messages.searchForFields),
|
|
1450
|
+
value: fieldSearchTerm,
|
|
1451
|
+
onChange: onSearchChangeThrottled,
|
|
1452
|
+
onReset: onSearchReset
|
|
1453
|
+
// TODO: `SearchTextInput` props to be improved. The `onSubmit` callback shouldn't be mandatory
|
|
1454
|
+
,
|
|
1455
|
+
onSubmit: () => {}
|
|
1456
|
+
}), hasResults ? jsxRuntime.jsx(StyledGridCard, {
|
|
1457
|
+
insetScale: "none",
|
|
1458
|
+
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1459
|
+
gridAutoFlow: "row",
|
|
1460
|
+
gridTemplateColumns: _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = "calc(".concat(uiKit.designTokens.spacingL, " + ")).call(_context8, uiKit.designTokens.constraint5, " + ")).call(_context7, uiKit.designTokens.spacingL, ") auto"),
|
|
1461
|
+
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => {
|
|
1462
|
+
var _fieldSearchTerm$trim2;
|
|
1463
|
+
return jsxRuntime.jsx(FieldGroupSection, {
|
|
1422
1464
|
group: group,
|
|
1423
1465
|
index: index,
|
|
1424
1466
|
formik: formik,
|
|
1425
|
-
isForceExpanded: fieldSearchTerm
|
|
1426
|
-
}, group.groupLabel)
|
|
1467
|
+
isForceExpanded: (fieldSearchTerm === null || fieldSearchTerm === void 0 || (_fieldSearchTerm$trim2 = _trimInstanceProperty__default["default"](fieldSearchTerm).call(fieldSearchTerm)) === null || _fieldSearchTerm$trim2 === void 0 ? void 0 : _fieldSearchTerm$trim2.length) > 0
|
|
1468
|
+
}, group.groupLabel);
|
|
1427
1469
|
})
|
|
1428
|
-
})
|
|
1429
|
-
})
|
|
1470
|
+
})
|
|
1471
|
+
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
1430
1472
|
})
|
|
1431
1473
|
})
|
|
1432
1474
|
});
|
|
@@ -1437,13 +1479,14 @@ const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
|
1437
1479
|
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; }
|
|
1438
1480
|
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__default["default"](_context = ownKeys$1(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$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1439
1481
|
const ExportResourcesProvider = props => {
|
|
1482
|
+
var _props$selectedResour;
|
|
1440
1483
|
const initialValues = useInitialValues(props);
|
|
1441
1484
|
const _React$useState = React__default["default"].useState(1),
|
|
1442
1485
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1443
1486
|
currentStep = _React$useState2[0],
|
|
1444
1487
|
setCurrentStep = _React$useState2[1];
|
|
1445
1488
|
const _React$useState3 = React__default["default"].useState({
|
|
1446
|
-
exportType: props.selectedResourceIds
|
|
1489
|
+
exportType: (_props$selectedResour = props.selectedResourceIds) !== null && _props$selectedResour !== void 0 && _props$selectedResour.length ? EXPORT_TYPES.SELECTED : EXPORT_TYPES.ALL,
|
|
1447
1490
|
selectedResourceIds: props.selectedResourceIds
|
|
1448
1491
|
}),
|
|
1449
1492
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
@@ -1534,8 +1577,8 @@ const loadMessages = async locale => {
|
|
|
1534
1577
|
return i18n.parseChunkImport(chunkImport);
|
|
1535
1578
|
} catch (error) {
|
|
1536
1579
|
// eslint-disable-next-line no-console
|
|
1537
|
-
console.warn(
|
|
1538
|
-
sentry.reportErrorToSentry(new Error(
|
|
1580
|
+
console.warn("Something went wrong while loading the export-resources-modal messages for ".concat(locale), error);
|
|
1581
|
+
sentry.reportErrorToSentry(new Error("Something went wrong while loading the export-resources-modal messages for ".concat(locale)), {
|
|
1539
1582
|
extra: error
|
|
1540
1583
|
});
|
|
1541
1584
|
return {};
|