@commercetools-frontend-extensions/export-resources-modal 4.2.1 → 4.3.1
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 +10 -1
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +583 -254
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +547 -236
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +580 -252
- package/dist/declarations/src/@constants/misc.d.ts +1 -0
- package/dist/declarations/src/@types/export-resources-modal-shape.d.ts +5 -0
- package/dist/declarations/src/@types/formik.d.ts +10 -0
- package/package.json +7 -7
|
@@ -16,19 +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
|
-
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
30
30
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
31
|
-
var
|
|
31
|
+
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
32
32
|
var omitEmpty = require('omit-empty-es');
|
|
33
33
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
34
34
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
@@ -36,14 +36,15 @@ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
|
36
36
|
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
|
|
37
37
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
38
38
|
var moment = require('moment');
|
|
39
|
+
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
40
|
+
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
39
41
|
var experimentalComponents = require('@commercetools-frontend/experimental-components');
|
|
40
42
|
var sdk = require('@commercetools-frontend/sdk');
|
|
41
43
|
var actionsGlobal = require('@commercetools-frontend/actions-global');
|
|
42
44
|
var constants = require('@commercetools-frontend/constants');
|
|
43
45
|
var _styled = require('@emotion/styled/base');
|
|
44
|
-
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/every');
|
|
45
46
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
46
|
-
var
|
|
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,11 +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
|
-
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
69
70
|
var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
|
|
70
|
-
var
|
|
71
|
+
var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
|
|
71
72
|
var omitEmpty__default = /*#__PURE__*/_interopDefault(omitEmpty);
|
|
72
73
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
73
74
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -75,10 +76,11 @@ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
|
|
|
75
76
|
var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
|
|
76
77
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
77
78
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
78
|
-
var
|
|
79
|
+
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
79
80
|
var _everyInstanceProperty__default = /*#__PURE__*/_interopDefault(_everyInstanceProperty);
|
|
81
|
+
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
80
82
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
81
|
-
var
|
|
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
|
|
|
@@ -268,17 +270,22 @@ var messages = reactIntl.defineMessages({
|
|
|
268
270
|
id: 'ExportResourcesModal.exportSettings',
|
|
269
271
|
description: 'Label for Export Settings',
|
|
270
272
|
defaultMessage: 'Settings'
|
|
273
|
+
},
|
|
274
|
+
selected: {
|
|
275
|
+
id: 'ExportResourcesModal.selected',
|
|
276
|
+
description: 'Label for total Selected',
|
|
277
|
+
defaultMessage: '{total} selected'
|
|
271
278
|
}
|
|
272
279
|
});
|
|
273
280
|
|
|
274
|
-
function ownKeys$
|
|
275
|
-
function _objectSpread$
|
|
281
|
+
function ownKeys$7(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; }
|
|
282
|
+
function _objectSpread$7(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$7(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$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
276
283
|
function renderFileNameError(key) {
|
|
277
284
|
switch (key) {
|
|
278
285
|
case 'missing':
|
|
279
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
286
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages.missingFileNameError));
|
|
280
287
|
case 'invalidInput':
|
|
281
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
288
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages.invalidFileNameError));
|
|
282
289
|
default:
|
|
283
290
|
return null;
|
|
284
291
|
}
|
|
@@ -286,65 +293,69 @@ function renderFileNameError(key) {
|
|
|
286
293
|
function renderLocaleError(key) {
|
|
287
294
|
switch (key) {
|
|
288
295
|
case 'missing':
|
|
289
|
-
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$
|
|
296
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$7({}, messages.missingLocaleError));
|
|
290
297
|
default:
|
|
291
298
|
return null;
|
|
292
299
|
}
|
|
293
300
|
}
|
|
294
301
|
|
|
295
|
-
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); }; }
|
|
296
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; })(); }
|
|
297
304
|
let MissingExportResourceProviderError = /*#__PURE__*/function (_Error) {
|
|
305
|
+
_inherits(MissingExportResourceProviderError, _Error);
|
|
306
|
+
var _super = _createSuper$3(MissingExportResourceProviderError);
|
|
298
307
|
function MissingExportResourceProviderError() {
|
|
299
308
|
var _this;
|
|
300
309
|
_classCallCheck(this, MissingExportResourceProviderError);
|
|
301
|
-
_this =
|
|
310
|
+
_this = _super.call(this, 'useExportResourcesContext must be used within ExportResourcesProvider');
|
|
302
311
|
_this.name = 'MissingExportResourceProviderError';
|
|
303
312
|
return _this;
|
|
304
313
|
}
|
|
305
|
-
_inherits(MissingExportResourceProviderError, _Error);
|
|
306
314
|
return _createClass(MissingExportResourceProviderError);
|
|
307
315
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
308
316
|
|
|
309
|
-
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); }; }
|
|
310
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; })(); }
|
|
311
319
|
let UnexpectedExportOperationStateError = /*#__PURE__*/function (_Error) {
|
|
320
|
+
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
321
|
+
var _super = _createSuper$2(UnexpectedExportOperationStateError);
|
|
312
322
|
function UnexpectedExportOperationStateError(state) {
|
|
313
323
|
var _this;
|
|
314
324
|
_classCallCheck(this, UnexpectedExportOperationStateError);
|
|
315
|
-
_this =
|
|
325
|
+
_this = _super.call(this, "Unexpected export operation state \"".concat(state, "\""));
|
|
316
326
|
_this.name = 'UnexpectedExportOperationStateError';
|
|
317
327
|
return _this;
|
|
318
328
|
}
|
|
319
|
-
_inherits(UnexpectedExportOperationStateError, _Error);
|
|
320
329
|
return _createClass(UnexpectedExportOperationStateError);
|
|
321
330
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
322
331
|
|
|
323
|
-
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); }; }
|
|
324
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; })(); }
|
|
325
334
|
let UnexpectedResourceTypeError = /*#__PURE__*/function (_Error) {
|
|
335
|
+
_inherits(UnexpectedResourceTypeError, _Error);
|
|
336
|
+
var _super = _createSuper$1(UnexpectedResourceTypeError);
|
|
326
337
|
function UnexpectedResourceTypeError(resourceType) {
|
|
327
338
|
var _this;
|
|
328
339
|
_classCallCheck(this, UnexpectedResourceTypeError);
|
|
329
|
-
_this =
|
|
340
|
+
_this = _super.call(this, "Unexpected resource type \"".concat(resourceType, "\""));
|
|
330
341
|
_this.name = 'UnexpectedResourceTypeError';
|
|
331
342
|
return _this;
|
|
332
343
|
}
|
|
333
|
-
_inherits(UnexpectedResourceTypeError, _Error);
|
|
334
344
|
return _createClass(UnexpectedResourceTypeError);
|
|
335
345
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
336
346
|
|
|
337
|
-
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); }; }
|
|
338
348
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
339
349
|
let InvalidResponseError = /*#__PURE__*/function (_Error) {
|
|
350
|
+
_inherits(InvalidResponseError, _Error);
|
|
351
|
+
var _super = _createSuper(InvalidResponseError);
|
|
340
352
|
function InvalidResponseError(message) {
|
|
341
353
|
var _this;
|
|
342
354
|
_classCallCheck(this, InvalidResponseError);
|
|
343
|
-
_this =
|
|
355
|
+
_this = _super.call(this, message);
|
|
344
356
|
_this.name = 'InvalidResponseError';
|
|
345
357
|
return _this;
|
|
346
358
|
}
|
|
347
|
-
_inherits(InvalidResponseError, _Error);
|
|
348
359
|
return _createClass(InvalidResponseError);
|
|
349
360
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
350
361
|
|
|
@@ -356,10 +367,10 @@ function useExportResourcesContext() {
|
|
|
356
367
|
return context;
|
|
357
368
|
}
|
|
358
369
|
|
|
359
|
-
function checkAtLeastOneFieldChecked
|
|
360
|
-
return _someInstanceProperty__default["default"](fields).call(fields, field => {
|
|
370
|
+
function checkAtLeastOneFieldChecked(fields) {
|
|
371
|
+
return fields === null || fields === void 0 ? void 0 : _someInstanceProperty__default["default"](fields).call(fields, field => {
|
|
361
372
|
if (field.fields) {
|
|
362
|
-
return field.isChecked || checkAtLeastOneFieldChecked
|
|
373
|
+
return field.isChecked || checkAtLeastOneFieldChecked(field.fields);
|
|
363
374
|
}
|
|
364
375
|
return field.isChecked;
|
|
365
376
|
});
|
|
@@ -389,7 +400,7 @@ function validate(_ref) {
|
|
|
389
400
|
if (step === 2) {
|
|
390
401
|
const allFields = _reduceInstanceProperty__default["default"](groups).call(groups, (acc, group) => _concatInstanceProperty__default["default"](acc).call(acc, group.fields), []);
|
|
391
402
|
const checkedFieldsCount = _filterInstanceProperty__default["default"](allFields).call(allFields, field => {
|
|
392
|
-
if (field.fields) return checkAtLeastOneFieldChecked
|
|
403
|
+
if (field.fields) return checkAtLeastOneFieldChecked(field.fields);
|
|
393
404
|
return !field.isRequired && !field.isReadOnly && field.isChecked;
|
|
394
405
|
}).length;
|
|
395
406
|
if (checkedFieldsCount < 1) {
|
|
@@ -402,6 +413,7 @@ function validate(_ref) {
|
|
|
402
413
|
|
|
403
414
|
const Z_INDEX_DROPDOWN = 30000;
|
|
404
415
|
const OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION = 'OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION';
|
|
416
|
+
const OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP = 'OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP';
|
|
405
417
|
|
|
406
418
|
const EXPORT_OPERATION_STATES = {
|
|
407
419
|
PROCESSING: 'processing',
|
|
@@ -435,12 +447,6 @@ const OUTPUT_FORMAT_OPTIONS = [{
|
|
|
435
447
|
label: 'JSON'
|
|
436
448
|
}];
|
|
437
449
|
|
|
438
|
-
const FIELD_DEFINITIONS_URLS = {
|
|
439
|
-
category: 'https://docs.commercetools.com/merchant-center/import-categories#supported-headers-and-values',
|
|
440
|
-
product: 'https://docs.commercetools.com/merchant-center/import-products#supported-headers-and-values',
|
|
441
|
-
'inventory-entry': 'https://docs.commercetools.com/merchant-center/import-inventory#supported-headers-and-values'
|
|
442
|
-
};
|
|
443
|
-
|
|
444
450
|
const resourceTypeMessages = {
|
|
445
451
|
category: {
|
|
446
452
|
exportScopeAll: messages.exportScopeAllCategories,
|
|
@@ -457,6 +463,7 @@ const resourceTypeMessages = {
|
|
|
457
463
|
};
|
|
458
464
|
|
|
459
465
|
function resourceTypeToFileName(_ref) {
|
|
466
|
+
var _context;
|
|
460
467
|
let resourceType = _ref.resourceType,
|
|
461
468
|
_ref$isUpperCase = _ref.isUpperCase,
|
|
462
469
|
isUpperCase = _ref$isUpperCase === void 0 ? false : _ref$isUpperCase,
|
|
@@ -481,7 +488,7 @@ function resourceTypeToFileName(_ref) {
|
|
|
481
488
|
throw new UnexpectedResourceTypeError(resourceType);
|
|
482
489
|
}
|
|
483
490
|
const result = isUpperCase ? displayName : displayName.toLowerCase();
|
|
484
|
-
return
|
|
491
|
+
return _concatInstanceProperty__default["default"](_context = "".concat(result, "_Export_")).call(_context, todayFormatted);
|
|
485
492
|
}
|
|
486
493
|
function mapLocalesToOptions(locales) {
|
|
487
494
|
return _mapInstanceProperty__default["default"](locales).call(locales, locale => ({
|
|
@@ -493,13 +500,14 @@ function isFilledArray(maybeArray) {
|
|
|
493
500
|
return _Array$isArray__default["default"](maybeArray) && maybeArray.length;
|
|
494
501
|
}
|
|
495
502
|
function appendCsvOrJsonExtensionIfAbsent(fileName, fileFormat) {
|
|
503
|
+
var _context2;
|
|
496
504
|
const extensionRegex = /\.(csv|json)$/i;
|
|
497
|
-
if (!extensionRegex.test(fileName)) return
|
|
505
|
+
if (!extensionRegex.test(fileName)) return _concatInstanceProperty__default["default"](_context2 = "".concat(fileName, ".")).call(_context2, fileFormat);
|
|
498
506
|
return fileName;
|
|
499
507
|
}
|
|
500
508
|
function getExportLogsLink(projectKey, msg) {
|
|
501
509
|
return jsxRuntime.jsx(uiKit.Link, {
|
|
502
|
-
to:
|
|
510
|
+
to: "/".concat(projectKey, "/operations/export/logs"),
|
|
503
511
|
children: msg
|
|
504
512
|
});
|
|
505
513
|
}
|
|
@@ -534,13 +542,13 @@ function sortFieldsByFieldOrder(_ref2) {
|
|
|
534
542
|
// Later, filters will be passed directly from parent views (category, product...) instead of being built within the Export resources modal
|
|
535
543
|
// The `selectedResourceIds` prop will also be removed
|
|
536
544
|
function tmpBuildFilters(selectedResourceIds) {
|
|
537
|
-
if (!selectedResourceIds || selectedResourceIds
|
|
538
|
-
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id =>
|
|
539
|
-
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, ")")];
|
|
540
548
|
}
|
|
541
549
|
|
|
542
|
-
function ownKeys$
|
|
543
|
-
function _objectSpread$
|
|
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; }
|
|
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; }
|
|
544
552
|
const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
545
553
|
const updateFields = (fields, parentChecked, fieldName) => {
|
|
546
554
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
@@ -548,8 +556,10 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
548
556
|
if (field.isRequired) {
|
|
549
557
|
isChecked = true;
|
|
550
558
|
} else {
|
|
551
|
-
|
|
552
|
-
|
|
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)];
|
|
553
563
|
} else if (!field.isReadOnly && field.isSelectedByDefault) {
|
|
554
564
|
isChecked = true;
|
|
555
565
|
} else if (parentChecked) {
|
|
@@ -557,18 +567,19 @@ const updateFieldGroupsWithIsCheckedValue = (groups, cachedSelectedGroups) => {
|
|
|
557
567
|
}
|
|
558
568
|
}
|
|
559
569
|
if (field.fields) {
|
|
560
|
-
|
|
570
|
+
var _context3;
|
|
571
|
+
const updatedFields = updateFields(field.fields, isChecked, _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, ".")).call(_context3, field.name));
|
|
561
572
|
isChecked = false;
|
|
562
573
|
field.fields = updatedFields;
|
|
563
574
|
}
|
|
564
|
-
return _objectSpread$
|
|
575
|
+
return _objectSpread$6(_objectSpread$6({}, field), {}, {
|
|
565
576
|
isChecked
|
|
566
577
|
});
|
|
567
578
|
});
|
|
568
579
|
};
|
|
569
580
|
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
570
581
|
const updatedFields = updateFields(group.fields, false, group.groupLabel);
|
|
571
|
-
return _objectSpread$
|
|
582
|
+
return _objectSpread$6(_objectSpread$6({}, group), {}, {
|
|
572
583
|
fields: updatedFields
|
|
573
584
|
});
|
|
574
585
|
});
|
|
@@ -580,43 +591,121 @@ const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
|
580
591
|
if (field.fields) {
|
|
581
592
|
field.fields = updateAdditionalFieldExtensions(field.fields, updatedAdditionalFieldExtensions);
|
|
582
593
|
}
|
|
583
|
-
return _objectSpread$
|
|
594
|
+
return _objectSpread$6(_objectSpread$6({}, field), {}, {
|
|
584
595
|
additionalFieldExtensions: updatedAdditionalFieldExtensions
|
|
585
596
|
});
|
|
586
597
|
});
|
|
587
598
|
}
|
|
599
|
+
function combineDependentGroupNames(fields) {
|
|
600
|
+
return _reduceInstanceProperty__default["default"](fields).call(fields, (acc, field) => {
|
|
601
|
+
if (field.dependentGroupNames) {
|
|
602
|
+
acc = [...acc, ...field.dependentGroupNames];
|
|
603
|
+
}
|
|
604
|
+
if (field.fields) {
|
|
605
|
+
acc = [...acc, ...combineDependentGroupNames(field.fields)];
|
|
606
|
+
}
|
|
607
|
+
return acc;
|
|
608
|
+
}, []);
|
|
609
|
+
}
|
|
588
610
|
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
589
|
-
return _objectSpread$
|
|
611
|
+
return _objectSpread$6(_objectSpread$6({}, group), {}, {
|
|
612
|
+
dependentGroupNames: combineDependentGroupNames(group.fields),
|
|
590
613
|
fields: updateAdditionalFieldExtensions(group.fields, group.additionalFieldExtensions || [])
|
|
591
614
|
});
|
|
592
615
|
});
|
|
593
616
|
};
|
|
617
|
+
const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
618
|
+
function updateFields(fields, groupName) {
|
|
619
|
+
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
620
|
+
let isExpanded = null;
|
|
621
|
+
if (field.isExpandable) {
|
|
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;
|
|
624
|
+
}
|
|
625
|
+
if (field.fields) {
|
|
626
|
+
field.fields = updateFields(field.fields, groupName);
|
|
627
|
+
}
|
|
628
|
+
if (isExpanded !== null) {
|
|
629
|
+
return _objectSpread$6(_objectSpread$6({}, field), {}, {
|
|
630
|
+
isExpanded
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
return field;
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
637
|
+
var _ref2, _cachedExpandedGroups2;
|
|
638
|
+
const updatedFields = updateFields(group.fields, group.groupName);
|
|
639
|
+
return _objectSpread$6(_objectSpread$6({}, group), {}, {
|
|
640
|
+
isExpanded: (_ref2 = (_cachedExpandedGroups2 = cachedExpandedGroups[group.groupName]) !== null && _cachedExpandedGroups2 !== void 0 ? _cachedExpandedGroups2 : group.isExpanded) !== null && _ref2 !== void 0 ? _ref2 : false,
|
|
641
|
+
fields: updatedFields
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
const isRequiredGroupChecked = function () {
|
|
647
|
+
let dependentGroupNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
648
|
+
let formik = arguments.length > 1 ? arguments[1] : undefined;
|
|
649
|
+
let result = false;
|
|
650
|
+
if (dependentGroupNames !== null && dependentGroupNames !== void 0 && dependentGroupNames.length) {
|
|
651
|
+
_someInstanceProperty__default["default"](dependentGroupNames).call(dependentGroupNames, dependentGroupName => {
|
|
652
|
+
var _context;
|
|
653
|
+
const dependentGroup = _findInstanceProperty__default["default"](_context = _valuesInstanceProperty__default["default"](formik).groups).call(_context, group => group.groupName === dependentGroupName);
|
|
654
|
+
if (dependentGroup) {
|
|
655
|
+
result = checkAtLeastOneFieldChecked(dependentGroup.fields);
|
|
656
|
+
}
|
|
657
|
+
return result;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
return result;
|
|
661
|
+
};
|
|
662
|
+
const checkAllFieldsSelected = fields => {
|
|
663
|
+
return _everyInstanceProperty__default["default"](fields).call(fields, field => {
|
|
664
|
+
if (field.fields) {
|
|
665
|
+
return checkAllFieldsSelected(field.fields);
|
|
666
|
+
}
|
|
667
|
+
return field.isChecked || field.isRequired || field.isReadOnly;
|
|
668
|
+
});
|
|
669
|
+
};
|
|
594
670
|
|
|
595
671
|
const useInitialValues = props => {
|
|
672
|
+
var _context, _context2, _context3;
|
|
596
673
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
597
674
|
locale: applicationContext.dataLocale
|
|
598
675
|
})),
|
|
599
676
|
locale = _useApplicationContex.locale;
|
|
600
|
-
const _useApplicationContex2 = applicationShellConnectors.useApplicationContext(context =>
|
|
601
|
-
|
|
602
|
-
|
|
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
|
+
}),
|
|
603
683
|
projectKey = _useApplicationContex2.projectKey;
|
|
604
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
684
|
+
const _useStorage = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context = "".concat(projectKey, "/")).call(_context, OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION), {}),
|
|
605
685
|
_useStorage2 = _slicedToArray(_useStorage, 1),
|
|
606
686
|
cachedSelectedGroups = _useStorage2[0];
|
|
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) => {
|
|
689
|
+
acc[group.groupName] = group.isExpanded;
|
|
690
|
+
return acc;
|
|
691
|
+
}, {})
|
|
692
|
+
}),
|
|
693
|
+
_useStorage4 = _slicedToArray(_useStorage3, 1),
|
|
694
|
+
cachedExpandedGroups = _useStorage4[0];
|
|
607
695
|
return React__default["default"].useMemo(() => {
|
|
608
|
-
|
|
696
|
+
let groups = updateFieldGroupsWithIsCheckedValue(props.fieldGroups, cachedSelectedGroups[props.resourceType] || {});
|
|
697
|
+
groups = updateFieldGroupsWithIsExpandedValue(groups, cachedExpandedGroups[props.resourceType] || {});
|
|
609
698
|
return {
|
|
610
699
|
outputFormat: props.outputFormat,
|
|
611
|
-
fileName:
|
|
700
|
+
fileName: "".concat(resourceTypeToFileName({
|
|
612
701
|
resourceType: props.resourceType,
|
|
613
702
|
isUpperCase: true,
|
|
614
703
|
isPlural: true
|
|
615
|
-
})
|
|
704
|
+
})),
|
|
616
705
|
locales: [locale],
|
|
617
706
|
groups: updateFieldGroupWithAdditionalFieldExtensions(groups)
|
|
618
707
|
};
|
|
619
|
-
}, [props.fieldGroups, props.
|
|
708
|
+
}, [props.fieldGroups, props.resourceType, props.outputFormat, cachedSelectedGroups, cachedExpandedGroups, locale]);
|
|
620
709
|
};
|
|
621
710
|
|
|
622
711
|
async function createExportOperation(_ref) {
|
|
@@ -628,7 +717,7 @@ async function createExportOperation(_ref) {
|
|
|
628
717
|
locales = _ref.locales,
|
|
629
718
|
filters = _ref.filters,
|
|
630
719
|
asyncDispatchFn = _ref.asyncDispatchFn;
|
|
631
|
-
const uri =
|
|
720
|
+
const uri = "/".concat(projectKey, "/export-operations");
|
|
632
721
|
const response = await asyncDispatchFn(sdk.actions.post({
|
|
633
722
|
mcApiProxyTarget: constants.MC_API_PROXY_TARGETS.EXPORT,
|
|
634
723
|
uri: uri,
|
|
@@ -652,20 +741,24 @@ const useStartExportOperation = props => {
|
|
|
652
741
|
const intl = reactIntl.useIntl();
|
|
653
742
|
const asyncDispatch = sdk.useAsyncDispatch();
|
|
654
743
|
const showNotification = actionsGlobal.useShowNotification();
|
|
655
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext =>
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
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
|
+
}),
|
|
659
751
|
projectKey = _useApplicationContex.projectKey;
|
|
660
752
|
const extractFieldsFromGroups = groups => {
|
|
661
753
|
let selectedGeneralFields = [];
|
|
662
754
|
const getSelectedFields = fields => {
|
|
663
755
|
return _filterInstanceProperty__default["default"](fields).call(fields, field => {
|
|
756
|
+
var _field$isChecked;
|
|
664
757
|
if (field.fields) {
|
|
665
758
|
return getSelectedFields(field.fields);
|
|
666
759
|
}
|
|
667
760
|
if (field.isChecked) selectedGeneralFields.push(field);
|
|
668
|
-
return field.isChecked
|
|
761
|
+
return (_field$isChecked = field.isChecked) !== null && _field$isChecked !== void 0 ? _field$isChecked : false;
|
|
669
762
|
});
|
|
670
763
|
};
|
|
671
764
|
_forEachInstanceProperty__default["default"](groups).call(groups, group => {
|
|
@@ -726,9 +819,10 @@ const useStartExportOperation = props => {
|
|
|
726
819
|
};
|
|
727
820
|
};
|
|
728
821
|
|
|
729
|
-
function ownKeys$
|
|
730
|
-
function _objectSpread$
|
|
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; }
|
|
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; }
|
|
731
824
|
function ExportScopeSection() {
|
|
825
|
+
var _originalSelectedReso;
|
|
732
826
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
733
827
|
exportType = _useExportResourcesCo.exportType,
|
|
734
828
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
@@ -749,7 +843,7 @@ function ExportScopeSection() {
|
|
|
749
843
|
children: [jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
750
844
|
value: EXPORT_TYPES.ALL,
|
|
751
845
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
752
|
-
intlMessage: _objectSpread$
|
|
846
|
+
intlMessage: _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeAll), {}, {
|
|
753
847
|
values: {
|
|
754
848
|
total: new Intl.NumberFormat().format(totalResourcesCount)
|
|
755
849
|
}
|
|
@@ -757,12 +851,12 @@ function ExportScopeSection() {
|
|
|
757
851
|
})
|
|
758
852
|
}), jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
759
853
|
value: EXPORT_TYPES.SELECTED,
|
|
760
|
-
isDisabled: !originalSelectedResourceIds
|
|
854
|
+
isDisabled: !(originalSelectedResourceIds !== null && originalSelectedResourceIds !== void 0 && originalSelectedResourceIds.length),
|
|
761
855
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
762
|
-
tone: !originalSelectedResourceIds
|
|
763
|
-
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), {}, {
|
|
764
858
|
values: {
|
|
765
|
-
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)
|
|
766
860
|
}
|
|
767
861
|
}) : messages.exportScopeSelectedWithoutCount
|
|
768
862
|
})
|
|
@@ -772,21 +866,25 @@ function ExportScopeSection() {
|
|
|
772
866
|
}
|
|
773
867
|
|
|
774
868
|
const ExportFileSettingsStep = () => {
|
|
869
|
+
var _context;
|
|
775
870
|
const intl = reactIntl.useIntl();
|
|
776
871
|
const _useExportResourcesCo = useExportResourcesContext(),
|
|
777
872
|
formik = _useExportResourcesCo.formik,
|
|
778
873
|
resourceType = _useExportResourcesCo.resourceType,
|
|
779
874
|
onClose = _useExportResourcesCo.onClose;
|
|
780
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext =>
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
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
|
+
}),
|
|
784
882
|
locales = _useApplicationContex.locales,
|
|
785
883
|
locale = _useApplicationContex.locale;
|
|
786
884
|
const areAllLocalesChecked = _valuesInstanceProperty__default["default"](formik).locales.length === locales.length;
|
|
787
885
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
788
886
|
isOpen: true,
|
|
789
|
-
title: intl.formatMessage(messages[
|
|
887
|
+
title: intl.formatMessage(messages["modalTitle.".concat(resourceType)]),
|
|
790
888
|
labelPrimary: intl.formatMessage(messages.continue),
|
|
791
889
|
onPrimaryButtonClick: formik.submitForm,
|
|
792
890
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -799,7 +897,7 @@ const ExportFileSettingsStep = () => {
|
|
|
799
897
|
scale: "l",
|
|
800
898
|
children: jsxRuntime.jsxs(uiKit.Grid, {
|
|
801
899
|
gridRowGap: uiKit.designTokens.spacingL,
|
|
802
|
-
gridTemplateColumns:
|
|
900
|
+
gridTemplateColumns: _concatInstanceProperty__default["default"](_context = "calc(".concat(uiKit.designTokens.constraint3, " + ")).call(_context, uiKit.designTokens.spacingL, ") auto"),
|
|
803
901
|
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
804
902
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
805
903
|
intlMessage: messages.exportScope
|
|
@@ -861,7 +959,7 @@ const ExportFileSettingsStep = () => {
|
|
|
861
959
|
});
|
|
862
960
|
};
|
|
863
961
|
|
|
864
|
-
var _ref = {
|
|
962
|
+
var _ref$1 = {
|
|
865
963
|
name: "ti75j2",
|
|
866
964
|
styles: "margin:0"
|
|
867
965
|
} ;
|
|
@@ -877,7 +975,7 @@ const NoSearchResults = () => {
|
|
|
877
975
|
intlMessage: messages.suggestions
|
|
878
976
|
})]
|
|
879
977
|
}), jsxRuntime.jsxs("ul", {
|
|
880
|
-
css: _ref,
|
|
978
|
+
css: _ref$1,
|
|
881
979
|
children: [jsxRuntime.jsx("li", {
|
|
882
980
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
883
981
|
intlMessage: messages.checkTheSpelling
|
|
@@ -891,169 +989,386 @@ const NoSearchResults = () => {
|
|
|
891
989
|
});
|
|
892
990
|
};
|
|
893
991
|
|
|
894
|
-
function ownKeys$
|
|
895
|
-
function _objectSpread$
|
|
896
|
-
const
|
|
897
|
-
|
|
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; }
|
|
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; }
|
|
994
|
+
const exportFieldSelectionContextDefaultValues = {
|
|
995
|
+
updateExpandedGroups: (_name, _value) => {}
|
|
996
|
+
};
|
|
997
|
+
const ExportFieldSelectionContext = /*#__PURE__*/React.createContext(exportFieldSelectionContextDefaultValues);
|
|
998
|
+
const ExportFieldSelectionProvider = _ref => {
|
|
999
|
+
var _context;
|
|
1000
|
+
let resourceType = _ref.resourceType,
|
|
1001
|
+
children = _ref.children;
|
|
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
|
+
}),
|
|
1008
|
+
projectKey = _useApplicationContex.projectKey;
|
|
1009
|
+
const _useStorage = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context = "".concat(projectKey, "/")).call(_context, OPERATIONS_EXPORT_RESOURCES_MODAL_EXPANDED_GROUP), {}),
|
|
1010
|
+
_useStorage2 = _slicedToArray(_useStorage, 2),
|
|
1011
|
+
cachedExpandedGroups = _useStorage2[0],
|
|
1012
|
+
setCachedExpandedGroups = _useStorage2[1];
|
|
1013
|
+
const updateExpandedGroups = React.useCallback((name, value) => {
|
|
1014
|
+
setCachedExpandedGroups({
|
|
1015
|
+
[resourceType]: _objectSpread$4(_objectSpread$4({}, cachedExpandedGroups[resourceType] || {}), {}, {
|
|
1016
|
+
[name]: value
|
|
1017
|
+
})
|
|
1018
|
+
});
|
|
1019
|
+
}, [cachedExpandedGroups, resourceType, setCachedExpandedGroups]);
|
|
1020
|
+
return jsxRuntime.jsx(ExportFieldSelectionContext.Provider, {
|
|
1021
|
+
value: {
|
|
1022
|
+
updateExpandedGroups
|
|
1023
|
+
},
|
|
1024
|
+
children: children
|
|
1025
|
+
});
|
|
1026
|
+
};
|
|
1027
|
+
const useExportFieldSelectionContext = () => {
|
|
1028
|
+
return React.useContext(ExportFieldSelectionContext);
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
const calculateTotalSelectedFields = (group, formik) => {
|
|
1032
|
+
let result = 0;
|
|
1033
|
+
// Check `isChecked` fields
|
|
1034
|
+
function countSelectedFields(fields) {
|
|
1035
|
+
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1036
|
+
if (field.fields) {
|
|
1037
|
+
countSelectedFields(field.fields);
|
|
1038
|
+
} else if (field.isChecked) {
|
|
1039
|
+
result += 1;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
countSelectedFields(group.fields);
|
|
1044
|
+
// check `isReadOnly` fields
|
|
1045
|
+
function countReadOnlyDependentFields(fields) {
|
|
1046
|
+
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1047
|
+
var _field$dependentGroup;
|
|
1048
|
+
if (field.fields) {
|
|
1049
|
+
countReadOnlyDependentFields(field.fields);
|
|
1050
|
+
} else if ((_field$dependentGroup = field.dependentGroupNames) !== null && _field$dependentGroup !== void 0 && _field$dependentGroup.length && isRequiredGroupChecked(field.dependentGroupNames, formik)) {
|
|
1051
|
+
result += 1;
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
function countReadOnlyFields(fields) {
|
|
1056
|
+
_forEachInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1057
|
+
var _field$dependentGroup2;
|
|
1058
|
+
if (field.fields) {
|
|
1059
|
+
countReadOnlyFields(field.fields);
|
|
1060
|
+
} else if (field.isReadOnly && !((_field$dependentGroup2 = field.dependentGroupNames) !== null && _field$dependentGroup2 !== void 0 && _field$dependentGroup2.length)) {
|
|
1061
|
+
result += 1;
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
if (result > 0) {
|
|
1066
|
+
countReadOnlyFields(group.fields);
|
|
1067
|
+
}
|
|
1068
|
+
if (group.dependentGroupNames) {
|
|
1069
|
+
countReadOnlyDependentFields(group.fields);
|
|
1070
|
+
}
|
|
1071
|
+
return result;
|
|
1072
|
+
};
|
|
1073
|
+
const ExportFieldSelectionStamp = _ref => {
|
|
1074
|
+
let group = _ref.group;
|
|
1075
|
+
const _useExportResourcesCo = useExportResourcesContext(),
|
|
1076
|
+
formik = _useExportResourcesCo.formik;
|
|
1077
|
+
const _useIntl = reactIntl.useIntl(),
|
|
1078
|
+
formatMessage = _useIntl.formatMessage;
|
|
1079
|
+
return jsxRuntime.jsx(uiKit.Card, {
|
|
1080
|
+
type: "flat",
|
|
1081
|
+
insetScale: "m",
|
|
1082
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1083
|
+
justifyContent: "flex-end",
|
|
1084
|
+
children: jsxRuntime.jsx(uiKit.Stamp, {
|
|
1085
|
+
tone: "secondary",
|
|
1086
|
+
isCondensed: true,
|
|
1087
|
+
label: formatMessage(messages.selected, {
|
|
1088
|
+
total: calculateTotalSelectedFields(group, formik)
|
|
1089
|
+
})
|
|
1090
|
+
})
|
|
1091
|
+
})
|
|
1092
|
+
});
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
const FieldWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1096
|
+
target: "e1judmlm0"
|
|
898
1097
|
} )({
|
|
899
|
-
name: "
|
|
900
|
-
styles: "
|
|
1098
|
+
name: "bjn8wh",
|
|
1099
|
+
styles: "position:relative"
|
|
901
1100
|
} );
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1101
|
+
const CollapsibleFieldWrapper = _ref => {
|
|
1102
|
+
let isForceExpanded = _ref.isForceExpanded,
|
|
1103
|
+
field = _ref.field,
|
|
1104
|
+
children = _ref.children;
|
|
1105
|
+
if (field.isExpandable) return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
1106
|
+
isDefaultClosed: isForceExpanded ? false : !field.isExpanded,
|
|
1107
|
+
children: _ref2 => {
|
|
1108
|
+
let isOpen = _ref2.isOpen,
|
|
1109
|
+
toggle = _ref2.toggle,
|
|
1110
|
+
registerContentNode = _ref2.registerContentNode;
|
|
1111
|
+
return children({
|
|
1112
|
+
isOpen,
|
|
1113
|
+
toggle,
|
|
1114
|
+
registerContentNode
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
}, "".concat(isForceExpanded));
|
|
1118
|
+
return children({
|
|
1119
|
+
isOpen: true,
|
|
1120
|
+
toggle: () => {},
|
|
1121
|
+
registerContentNode: () => {}
|
|
1122
|
+
});
|
|
1123
|
+
};
|
|
1124
|
+
const FieldSection = _ref3 => {
|
|
1125
|
+
let fields = _ref3.fields,
|
|
1126
|
+
parentKeys = _ref3.parentKeys,
|
|
1127
|
+
formik = _ref3.formik,
|
|
1128
|
+
isAnySiblingChecked = _ref3.isAnySiblingChecked,
|
|
1129
|
+
isForceExpanded = _ref3.isForceExpanded,
|
|
1130
|
+
groupName = _ref3.groupName;
|
|
1131
|
+
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1132
|
+
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
913
1133
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
914
1134
|
scale: "s",
|
|
915
|
-
children: fields
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1135
|
+
children: fields === null || fields === void 0 ? void 0 : _mapInstanceProperty__default["default"](fields).call(fields, (field, index) => {
|
|
1136
|
+
var _context;
|
|
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;
|
|
924
1148
|
}
|
|
925
|
-
|
|
1149
|
+
if (isAnyOfTheChildFieldsChecked) {
|
|
1150
|
+
return field.isChecked;
|
|
1151
|
+
}
|
|
1152
|
+
return false;
|
|
926
1153
|
};
|
|
927
|
-
const isAnyOfTheChildFieldsChecked = isAtleastOneChildChecked();
|
|
928
1154
|
if (field.isHidden) return null;
|
|
929
|
-
return jsxRuntime.
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1155
|
+
return jsxRuntime.jsx(CollapsibleFieldWrapper, {
|
|
1156
|
+
isForceExpanded: isForceExpanded,
|
|
1157
|
+
field: field,
|
|
1158
|
+
children: _ref4 => {
|
|
1159
|
+
var _context2, _field$fields3;
|
|
1160
|
+
let isOpen = _ref4.isOpen,
|
|
1161
|
+
toggle = _ref4.toggle,
|
|
1162
|
+
registerContentNode = _ref4.registerContentNode;
|
|
1163
|
+
return jsxRuntime.jsxs(React.Fragment, {
|
|
1164
|
+
children: [jsxRuntime.jsxs(FieldWrapper, {
|
|
1165
|
+
children: [field.isExpandable && jsxRuntime.jsx(uiKit.IconButton, {
|
|
1166
|
+
size: "20",
|
|
1167
|
+
style: {
|
|
1168
|
+
position: 'absolute',
|
|
1169
|
+
left: "calc(-1 * ".concat(uiKit.designTokens.spacingXl, ")")
|
|
1170
|
+
},
|
|
1171
|
+
onClick: () => {
|
|
1172
|
+
if (!isForceExpanded) {
|
|
1173
|
+
var _context3;
|
|
1174
|
+
updateExpandedGroups(_concatInstanceProperty__default["default"](_context3 = "".concat(groupName, ".")).call(_context3, field.name), !isOpen);
|
|
946
1175
|
}
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1176
|
+
toggle();
|
|
1177
|
+
},
|
|
1178
|
+
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
1179
|
+
label: ""
|
|
1180
|
+
}), jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1181
|
+
scale: "s",
|
|
1182
|
+
alignItems: "center",
|
|
1183
|
+
children: jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
1184
|
+
isIndeterminate: field.isExpandable && !allAllFieldsSelected && isAnyOfTheChildFieldsChecked,
|
|
1185
|
+
isChecked: checkIsChecked(),
|
|
1186
|
+
isReadOnly: field.isReadOnly || field.isRequired,
|
|
1187
|
+
onChange: e => {
|
|
1188
|
+
var _context4, _field$fields2;
|
|
1189
|
+
const path = _concatInstanceProperty__default["default"](_context4 = "".concat(parentKeys.join('.'), ".fields[")).call(_context4, index, "]");
|
|
1190
|
+
// Update all child fields
|
|
1191
|
+
const updateAllChildFieldsChecked = (path, checked) => {
|
|
1192
|
+
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), path);
|
|
1193
|
+
if (item && item.fields) {
|
|
1194
|
+
var _context5;
|
|
1195
|
+
_forEachInstanceProperty__default["default"](_context5 = item.fields).call(_context5, (field, i) => {
|
|
1196
|
+
var _context6, _field$fields;
|
|
1197
|
+
const fieldPath = _concatInstanceProperty__default["default"](_context6 = "".concat(path, ".fields[")).call(_context6, i, "]");
|
|
1198
|
+
if (!((_field$fields = field.fields) !== null && _field$fields !== void 0 && _field$fields.length)) {
|
|
1199
|
+
formik.setFieldValue("".concat(fieldPath, ".isChecked"), checked,
|
|
1200
|
+
// pass `false` to avoid revalidating the form with intermediate values
|
|
1201
|
+
false);
|
|
1202
|
+
}
|
|
1203
|
+
updateAllChildFieldsChecked(fieldPath, checked);
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
if (!((_field$fields2 = field.fields) !== null && _field$fields2 !== void 0 && _field$fields2.length)) {
|
|
1208
|
+
formik.setFieldValue("".concat(path, ".isChecked"), e.target.checked,
|
|
1209
|
+
// pass `false` to avoid revalidating the form with intermediate values
|
|
1210
|
+
false);
|
|
1211
|
+
}
|
|
1212
|
+
updateAllChildFieldsChecked(path, e.target.checked);
|
|
1213
|
+
},
|
|
1214
|
+
children: [field.label, " ", field.isRequired && '*']
|
|
1215
|
+
})
|
|
1216
|
+
})]
|
|
1217
|
+
}), field.fields && ((_field$fields3 = field.fields) === null || _field$fields3 === void 0 ? void 0 : _field$fields3.length) > 0 && jsxRuntime.jsx(StyledExpandableContent, {
|
|
1218
|
+
ref: registerContentNode,
|
|
1219
|
+
isOpen: isOpen,
|
|
1220
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1221
|
+
scale: "xl",
|
|
1222
|
+
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSection, {
|
|
1223
|
+
fields: field.fields,
|
|
1224
|
+
formik: formik,
|
|
1225
|
+
parentKeys: [...parentKeys, "fields[".concat(index, "]")],
|
|
1226
|
+
isAnySiblingChecked: isAnySiblingChecked,
|
|
1227
|
+
isForceExpanded: isForceExpanded,
|
|
1228
|
+
groupName: groupName
|
|
1229
|
+
})]
|
|
1230
|
+
})
|
|
1231
|
+
})]
|
|
1232
|
+
}, _concatInstanceProperty__default["default"](_context2 = "".concat(field.name, "-")).call(_context2, index));
|
|
1233
|
+
}
|
|
1234
|
+
}, _concatInstanceProperty__default["default"](_context = "".concat(field.name, ".")).call(_context, isForceExpanded));
|
|
969
1235
|
})
|
|
970
1236
|
});
|
|
971
1237
|
};
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
}
|
|
1238
|
+
|
|
1239
|
+
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; }
|
|
1240
|
+
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__default["default"](_context = ownKeys$3(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$3(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
1241
|
+
const StyledGroupCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1242
|
+
target: "e1igkh7t2"
|
|
1243
|
+
} )("height:100%;border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1244
|
+
const StyledFieldsCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1245
|
+
target: "e1igkh7t1"
|
|
1246
|
+
} )("border-radius:0;", props => props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
1247
|
+
var _ref = {
|
|
1248
|
+
name: "2ce4ng",
|
|
1249
|
+
styles: "overflow:hidden;height:0;margin-top:0!important"
|
|
1250
|
+
} ;
|
|
1251
|
+
const StyledExpandableContent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
1252
|
+
target: "e1igkh7t0"
|
|
1253
|
+
} )(props => !props.isOpen && _ref, " ", props => !props.isOpen && props.showTopBorder && /*#__PURE__*/react.css("border-top:", uiKit.designTokens.borderWidth1, " solid ", uiKit.designTokens.colorNeutral90, ";" + ("" ), "" ), ";" + ("" ));
|
|
988
1254
|
const FieldGroupSection = _ref2 => {
|
|
989
1255
|
let group = _ref2.group,
|
|
990
1256
|
index = _ref2.index,
|
|
991
|
-
formik = _ref2.formik
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
const
|
|
1257
|
+
formik = _ref2.formik,
|
|
1258
|
+
isForceExpanded = _ref2.isForceExpanded;
|
|
1259
|
+
const allAllFieldsSelected = React.useMemo(() => checkAllFieldsSelected(group.fields), [group.fields]);
|
|
1260
|
+
const isAtleastOneFieldChecked = React.useMemo(() => checkAtLeastOneFieldChecked(group.fields), [group.fields]);
|
|
1261
|
+
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1262
|
+
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1263
|
+
const parentKey = "groups[".concat(index, "]");
|
|
995
1264
|
const handleChangeAllFields = e => {
|
|
996
1265
|
const item = get__default["default"](_valuesInstanceProperty__default["default"](formik), parentKey);
|
|
997
1266
|
function updateAllFields(fields, checked) {
|
|
998
1267
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
999
1268
|
if (field.fields) {
|
|
1000
|
-
return _objectSpread$
|
|
1269
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
1001
1270
|
fields: updateAllFields(field.fields, checked)
|
|
1002
1271
|
});
|
|
1003
1272
|
}
|
|
1004
1273
|
if (field.isReadOnly || field.isRequired) return field;
|
|
1005
|
-
return _objectSpread$
|
|
1274
|
+
return _objectSpread$3(_objectSpread$3({}, field), {}, {
|
|
1006
1275
|
isChecked: checked
|
|
1007
1276
|
});
|
|
1008
1277
|
});
|
|
1009
1278
|
}
|
|
1010
|
-
formik.setFieldValue(parentKey, _objectSpread$
|
|
1279
|
+
formik.setFieldValue(parentKey, _objectSpread$3(_objectSpread$3({}, item), {}, {
|
|
1011
1280
|
fields: updateAllFields(item.fields, e.target.checked)
|
|
1012
1281
|
}));
|
|
1013
1282
|
};
|
|
1014
1283
|
if (group.isHidden) return null;
|
|
1015
|
-
return jsxRuntime.
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1284
|
+
return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
1285
|
+
isDefaultClosed: isForceExpanded ? false : !group.isExpanded,
|
|
1286
|
+
children: _ref3 => {
|
|
1287
|
+
let isOpen = _ref3.isOpen,
|
|
1288
|
+
toggle = _ref3.toggle,
|
|
1289
|
+
registerContentNode = _ref3.registerContentNode;
|
|
1290
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1291
|
+
children: [jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1292
|
+
children: jsxRuntime.jsx(StyledGroupCard, {
|
|
1293
|
+
type: "flat",
|
|
1294
|
+
insetScale: "m",
|
|
1295
|
+
showTopBorder: index > 0,
|
|
1296
|
+
children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1297
|
+
scale: "s",
|
|
1298
|
+
alignItems: "center",
|
|
1299
|
+
children: [jsxRuntime.jsx(uiKit.IconButton, {
|
|
1300
|
+
size: "20",
|
|
1301
|
+
onClick: () => {
|
|
1302
|
+
if (!isForceExpanded) {
|
|
1303
|
+
updateExpandedGroups(group.groupName, !isOpen);
|
|
1304
|
+
}
|
|
1305
|
+
toggle();
|
|
1306
|
+
},
|
|
1307
|
+
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
1308
|
+
label: ""
|
|
1309
|
+
}), jsxRuntime.jsx(uiKit.CheckboxInput, {
|
|
1310
|
+
isIndeterminate: !allAllFieldsSelected && (isAtleastOneFieldChecked || isRequiredGroupChecked(group.dependentGroupNames, formik)),
|
|
1311
|
+
isChecked: allAllFieldsSelected,
|
|
1312
|
+
onChange: handleChangeAllFields,
|
|
1313
|
+
children: group.groupLabel
|
|
1314
|
+
})]
|
|
1315
|
+
})
|
|
1040
1316
|
})
|
|
1041
|
-
})
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1317
|
+
}), jsxRuntime.jsx(uiKit.Grid.Item, {
|
|
1318
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1319
|
+
children: [jsxRuntime.jsx(StyledExpandableContent, {
|
|
1320
|
+
ref: registerContentNode,
|
|
1321
|
+
isOpen: isOpen,
|
|
1322
|
+
showTopBorder: index > 0,
|
|
1323
|
+
children: jsxRuntime.jsx(StyledFieldsCard, {
|
|
1324
|
+
type: "flat",
|
|
1325
|
+
insetScale: "m",
|
|
1326
|
+
showTopBorder: true,
|
|
1327
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1328
|
+
scale: "s",
|
|
1329
|
+
children: jsxRuntime.jsx(FieldSection, {
|
|
1330
|
+
fields: group.fields,
|
|
1331
|
+
formik: formik,
|
|
1332
|
+
parentKeys: [parentKey],
|
|
1333
|
+
isAnySiblingChecked: isAtleastOneFieldChecked,
|
|
1334
|
+
groupName: group.groupName,
|
|
1335
|
+
isForceExpanded: isForceExpanded
|
|
1336
|
+
})
|
|
1337
|
+
})
|
|
1338
|
+
})
|
|
1339
|
+
}), !isOpen && jsxRuntime.jsx(ExportFieldSelectionStamp, {
|
|
1340
|
+
group: group
|
|
1341
|
+
})]
|
|
1342
|
+
})
|
|
1343
|
+
})]
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
}, "".concat(isForceExpanded));
|
|
1045
1347
|
};
|
|
1348
|
+
|
|
1349
|
+
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; }
|
|
1350
|
+
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; }
|
|
1351
|
+
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1352
|
+
target: "e5mvpn60"
|
|
1353
|
+
} )({
|
|
1354
|
+
name: "1lf8z6",
|
|
1355
|
+
styles: "max-height:50vh;overflow:auto"
|
|
1356
|
+
} );
|
|
1046
1357
|
const ExportFieldsSelectionStep = () => {
|
|
1358
|
+
var _context, _context7, _context8;
|
|
1047
1359
|
const intl = reactIntl.useIntl();
|
|
1048
1360
|
const _React$useState = React__default["default"].useState(''),
|
|
1049
1361
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1050
1362
|
fieldSearchTerm = _React$useState2[0],
|
|
1051
1363
|
setFieldSearchTerm = _React$useState2[1];
|
|
1052
|
-
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context =>
|
|
1053
|
-
|
|
1054
|
-
|
|
1364
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(context => {
|
|
1365
|
+
var _context$project;
|
|
1366
|
+
return {
|
|
1367
|
+
projectKey: (_context$project = context.project) === null || _context$project === void 0 ? void 0 : _context$project.key
|
|
1368
|
+
};
|
|
1369
|
+
}),
|
|
1055
1370
|
projectKey = _useApplicationContex.projectKey;
|
|
1056
|
-
const _useStorage = experimentalComponents.useStorage(
|
|
1371
|
+
const _useStorage = experimentalComponents.useStorage(_concatInstanceProperty__default["default"](_context = "".concat(projectKey, "/")).call(_context, OPERATIONS_EXPORT_RESOURCES_MODAL_SELECTION), {}),
|
|
1057
1372
|
_useStorage2 = _slicedToArray(_useStorage, 2);
|
|
1058
1373
|
_useStorage2[0];
|
|
1059
1374
|
const setCachedSelectedGroups = _useStorage2[1];
|
|
@@ -1063,18 +1378,19 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1063
1378
|
resourceType = _useExportResourcesCo.resourceType,
|
|
1064
1379
|
onClose = _useExportResourcesCo.onClose;
|
|
1065
1380
|
React__default["default"].useEffect(() => {
|
|
1066
|
-
var
|
|
1381
|
+
var _context4;
|
|
1067
1382
|
formik.validateForm();
|
|
1068
1383
|
const selectedFields = {};
|
|
1069
1384
|
function getSelectedFields(field, groupName) {
|
|
1070
|
-
|
|
1385
|
+
var _context2;
|
|
1386
|
+
const fieldName = field.name ? _concatInstanceProperty__default["default"](_context2 = "".concat(groupName, ".")).call(_context2, field.name) : groupName;
|
|
1071
1387
|
if (field.fields) {
|
|
1072
|
-
var
|
|
1073
|
-
return _forEachInstanceProperty__default["default"](
|
|
1388
|
+
var _context3;
|
|
1389
|
+
return _forEachInstanceProperty__default["default"](_context3 = field.fields).call(_context3, f => getSelectedFields(f, fieldName));
|
|
1074
1390
|
}
|
|
1075
1391
|
selectedFields[fieldName] = field.isChecked;
|
|
1076
1392
|
}
|
|
1077
|
-
_forEachInstanceProperty__default["default"](
|
|
1393
|
+
_forEachInstanceProperty__default["default"](_context4 = _valuesInstanceProperty__default["default"](formik).groups).call(_context4, group => getSelectedFields(group, group.groupLabel));
|
|
1078
1394
|
setCachedSelectedGroups({
|
|
1079
1395
|
[resourceType]: selectedFields
|
|
1080
1396
|
});
|
|
@@ -1082,11 +1398,11 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1082
1398
|
}, [_valuesInstanceProperty__default["default"](formik).groups]);
|
|
1083
1399
|
// adds `isHidden` property to each field based on search term
|
|
1084
1400
|
const filteredGroups = React__default["default"].useMemo(() => {
|
|
1085
|
-
var
|
|
1401
|
+
var _fieldSearchTerm$trim, _context6;
|
|
1086
1402
|
const updateFields = (fields, parentMatches) => {
|
|
1087
1403
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
1088
|
-
var
|
|
1089
|
-
const matches = _includesInstanceProperty__default["default"](
|
|
1404
|
+
var _context5;
|
|
1405
|
+
const matches = _includesInstanceProperty__default["default"](_context5 = field.label.toLowerCase()).call(_context5, fieldSearchTerm.toLowerCase());
|
|
1090
1406
|
let isHidden = !matches && !parentMatches;
|
|
1091
1407
|
if (field.fields) {
|
|
1092
1408
|
const updatedFields = updateFields(field.fields, matches);
|
|
@@ -1100,8 +1416,8 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1100
1416
|
});
|
|
1101
1417
|
});
|
|
1102
1418
|
};
|
|
1103
|
-
if (!fieldSearchTerm
|
|
1104
|
-
return _mapInstanceProperty__default["default"](
|
|
1419
|
+
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;
|
|
1420
|
+
return _mapInstanceProperty__default["default"](_context6 = _valuesInstanceProperty__default["default"](formik).groups).call(_context6, group => {
|
|
1105
1421
|
const updatedFields = updateFields(group.fields, false);
|
|
1106
1422
|
const isHidden = _everyInstanceProperty__default["default"](updatedFields).call(updatedFields, field => field.isHidden);
|
|
1107
1423
|
return _objectSpread$2(_objectSpread$2({}, group), {}, {
|
|
@@ -1120,7 +1436,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1120
1436
|
};
|
|
1121
1437
|
return jsxRuntime.jsx(applicationComponents.FormDialog, {
|
|
1122
1438
|
isOpen: true,
|
|
1123
|
-
title: intl.formatMessage(messages
|
|
1439
|
+
title: intl.formatMessage(messages.selectFieldsToExport),
|
|
1124
1440
|
labelPrimary: intl.formatMessage(messages.startExport),
|
|
1125
1441
|
onPrimaryButtonClick: formik.submitForm,
|
|
1126
1442
|
isPrimaryButtonDisabled: !formik.isValid,
|
|
@@ -1128,21 +1444,11 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1128
1444
|
onSecondaryButtonClick: () => setCurrentStep(1),
|
|
1129
1445
|
onClose: onClose,
|
|
1130
1446
|
size: 16,
|
|
1131
|
-
children: jsxRuntime.jsx(
|
|
1132
|
-
|
|
1447
|
+
children: jsxRuntime.jsx(ExportFieldSelectionProvider, {
|
|
1448
|
+
resourceType: resourceType,
|
|
1133
1449
|
children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1134
1450
|
scale: "m",
|
|
1135
|
-
children: [jsxRuntime.
|
|
1136
|
-
justifyContent: "space-between",
|
|
1137
|
-
children: [jsxRuntime.jsx(uiKit.Text.Body, {
|
|
1138
|
-
intlMessage: messages.selectFieldsToExport
|
|
1139
|
-
}), jsxRuntime.jsx(uiKit.Link, {
|
|
1140
|
-
isExternal: true,
|
|
1141
|
-
tone: "secondary",
|
|
1142
|
-
intlMessage: messages.fieldDefinitions,
|
|
1143
|
-
to: FIELD_DEFINITIONS_URLS[resourceType]
|
|
1144
|
-
})]
|
|
1145
|
-
}), jsxRuntime.jsx(uiKit.SearchTextInput, {
|
|
1451
|
+
children: [jsxRuntime.jsx(uiKit.SearchTextInput, {
|
|
1146
1452
|
placeholder: intl.formatMessage(messages.searchForFields),
|
|
1147
1453
|
value: fieldSearchTerm,
|
|
1148
1454
|
onChange: onSearchChangeThrottled,
|
|
@@ -1154,12 +1460,16 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1154
1460
|
insetScale: "none",
|
|
1155
1461
|
children: jsxRuntime.jsx(uiKit.Grid, {
|
|
1156
1462
|
gridAutoFlow: "row",
|
|
1157
|
-
gridTemplateColumns:
|
|
1158
|
-
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) =>
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1463
|
+
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"),
|
|
1464
|
+
children: _mapInstanceProperty__default["default"](filteredGroups).call(filteredGroups, (group, index) => {
|
|
1465
|
+
var _fieldSearchTerm$trim2;
|
|
1466
|
+
return jsxRuntime.jsx(FieldGroupSection, {
|
|
1467
|
+
group: group,
|
|
1468
|
+
index: index,
|
|
1469
|
+
formik: formik,
|
|
1470
|
+
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
|
|
1471
|
+
}, group.groupLabel);
|
|
1472
|
+
})
|
|
1163
1473
|
})
|
|
1164
1474
|
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
1165
1475
|
})
|
|
@@ -1172,13 +1482,14 @@ const ExportResourcesContext = /*#__PURE__*/React.createContext();
|
|
|
1172
1482
|
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; }
|
|
1173
1483
|
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; }
|
|
1174
1484
|
const ExportResourcesProvider = props => {
|
|
1485
|
+
var _props$selectedResour;
|
|
1175
1486
|
const initialValues = useInitialValues(props);
|
|
1176
1487
|
const _React$useState = React__default["default"].useState(1),
|
|
1177
1488
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1178
1489
|
currentStep = _React$useState2[0],
|
|
1179
1490
|
setCurrentStep = _React$useState2[1];
|
|
1180
1491
|
const _React$useState3 = React__default["default"].useState({
|
|
1181
|
-
exportType: props.selectedResourceIds
|
|
1492
|
+
exportType: (_props$selectedResour = props.selectedResourceIds) !== null && _props$selectedResour !== void 0 && _props$selectedResour.length ? EXPORT_TYPES.SELECTED : EXPORT_TYPES.ALL,
|
|
1182
1493
|
selectedResourceIds: props.selectedResourceIds
|
|
1183
1494
|
}),
|
|
1184
1495
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
@@ -1269,8 +1580,8 @@ const loadMessages = async locale => {
|
|
|
1269
1580
|
return i18n.parseChunkImport(chunkImport);
|
|
1270
1581
|
} catch (error) {
|
|
1271
1582
|
// eslint-disable-next-line no-console
|
|
1272
|
-
console.warn(
|
|
1273
|
-
sentry.reportErrorToSentry(new Error(
|
|
1583
|
+
console.warn("Something went wrong while loading the export-resources-modal messages for ".concat(locale), error);
|
|
1584
|
+
sentry.reportErrorToSentry(new Error("Something went wrong while loading the export-resources-modal messages for ".concat(locale)), {
|
|
1274
1585
|
extra: error
|
|
1275
1586
|
});
|
|
1276
1587
|
return {};
|