@commercetools-frontend-extensions/export-resources-modal 4.4.1 → 4.4.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.
|
@@ -557,19 +557,19 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
557
557
|
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
558
558
|
return "id in (".concat(formattedIds, ")");
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
var
|
|
560
|
+
function areFiltersApplied(filters) {
|
|
561
|
+
var _filters$where;
|
|
562
562
|
if (!filters) {
|
|
563
563
|
return false;
|
|
564
564
|
}
|
|
565
|
-
return filters.where !== undefined && _trimInstanceProperty__default["default"](
|
|
565
|
+
return filters.where !== undefined && ((_filters$where = filters.where) === null || _filters$where === void 0 ? void 0 : _trimInstanceProperty__default["default"](_filters$where).call(_filters$where)) !== '';
|
|
566
566
|
}
|
|
567
567
|
function getInitialExportType(args) {
|
|
568
568
|
var _args$selectedResourc, _args$filters;
|
|
569
569
|
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
570
570
|
return EXPORT_TYPES.SELECTED;
|
|
571
571
|
}
|
|
572
|
-
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total) {
|
|
572
|
+
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total && areFiltersApplied(args.filters)) {
|
|
573
573
|
return EXPORT_TYPES.FILTERED;
|
|
574
574
|
}
|
|
575
575
|
return EXPORT_TYPES.ALL;
|
|
@@ -858,8 +858,8 @@ function ExportScopeSection() {
|
|
|
858
858
|
exportType = _useExportResourcesCo.exportType,
|
|
859
859
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
860
860
|
filters = _useExportResourcesCo.filters,
|
|
861
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
862
861
|
hasFilters = _useExportResourcesCo.hasFilters,
|
|
862
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
863
863
|
setExportType = _useExportResourcesCo.setExportType,
|
|
864
864
|
resourceType = _useExportResourcesCo.resourceType;
|
|
865
865
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
@@ -884,9 +884,9 @@ function ExportScopeSection() {
|
|
|
884
884
|
})
|
|
885
885
|
}), filters && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
886
886
|
value: EXPORT_TYPES.FILTERED,
|
|
887
|
-
isDisabled: !filters.total,
|
|
887
|
+
isDisabled: !filters.total || !hasFilters,
|
|
888
888
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
889
|
-
tone: !hasFilters ? 'tertiary' : undefined,
|
|
889
|
+
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
890
890
|
intlMessage: filters.total ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
891
891
|
values: {
|
|
892
892
|
total: intl.formatNumber(filters.total)
|
|
@@ -1607,7 +1607,7 @@ const ExportResourcesProvider = props => {
|
|
|
1607
1607
|
totalResourcesCount: props.totalResourcesCount,
|
|
1608
1608
|
selectedResourceIds: props.selectedResourceIds,
|
|
1609
1609
|
filters: props.filters,
|
|
1610
|
-
hasFilters:
|
|
1610
|
+
hasFilters: areFiltersApplied(props.filters),
|
|
1611
1611
|
setExportType
|
|
1612
1612
|
},
|
|
1613
1613
|
children: props.children
|
|
@@ -557,19 +557,19 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
557
557
|
const formattedIds = _mapInstanceProperty__default["default"](selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
558
558
|
return "id in (".concat(formattedIds, ")");
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
var
|
|
560
|
+
function areFiltersApplied(filters) {
|
|
561
|
+
var _filters$where;
|
|
562
562
|
if (!filters) {
|
|
563
563
|
return false;
|
|
564
564
|
}
|
|
565
|
-
return filters.where !== undefined && _trimInstanceProperty__default["default"](
|
|
565
|
+
return filters.where !== undefined && ((_filters$where = filters.where) === null || _filters$where === void 0 ? void 0 : _trimInstanceProperty__default["default"](_filters$where).call(_filters$where)) !== '';
|
|
566
566
|
}
|
|
567
567
|
function getInitialExportType(args) {
|
|
568
568
|
var _args$selectedResourc, _args$filters;
|
|
569
569
|
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
570
570
|
return EXPORT_TYPES.SELECTED;
|
|
571
571
|
}
|
|
572
|
-
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total) {
|
|
572
|
+
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total && areFiltersApplied(args.filters)) {
|
|
573
573
|
return EXPORT_TYPES.FILTERED;
|
|
574
574
|
}
|
|
575
575
|
return EXPORT_TYPES.ALL;
|
|
@@ -858,8 +858,8 @@ function ExportScopeSection() {
|
|
|
858
858
|
exportType = _useExportResourcesCo.exportType,
|
|
859
859
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
860
860
|
filters = _useExportResourcesCo.filters,
|
|
861
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
862
861
|
hasFilters = _useExportResourcesCo.hasFilters,
|
|
862
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
863
863
|
setExportType = _useExportResourcesCo.setExportType,
|
|
864
864
|
resourceType = _useExportResourcesCo.resourceType;
|
|
865
865
|
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
@@ -884,9 +884,9 @@ function ExportScopeSection() {
|
|
|
884
884
|
})
|
|
885
885
|
}), filters && jsxRuntime.jsx(uiKit.RadioInput.Option, {
|
|
886
886
|
value: EXPORT_TYPES.FILTERED,
|
|
887
|
-
isDisabled: !filters.total,
|
|
887
|
+
isDisabled: !filters.total || !hasFilters,
|
|
888
888
|
children: jsxRuntime.jsx(uiKit.Text.Body, {
|
|
889
|
-
tone: !hasFilters ? 'tertiary' : undefined,
|
|
889
|
+
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
890
890
|
intlMessage: filters.total ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
891
891
|
values: {
|
|
892
892
|
total: intl.formatNumber(filters.total)
|
|
@@ -1568,7 +1568,7 @@ const ExportResourcesProvider = props => {
|
|
|
1568
1568
|
totalResourcesCount: props.totalResourcesCount,
|
|
1569
1569
|
selectedResourceIds: props.selectedResourceIds,
|
|
1570
1570
|
filters: props.filters,
|
|
1571
|
-
hasFilters:
|
|
1571
|
+
hasFilters: areFiltersApplied(props.filters),
|
|
1572
1572
|
setExportType
|
|
1573
1573
|
},
|
|
1574
1574
|
children: props.children
|
|
@@ -522,19 +522,19 @@ function buildSelectedExportFilters(selectedResourceIds) {
|
|
|
522
522
|
const formattedIds = _mapInstanceProperty(selectedResourceIds).call(selectedResourceIds, id => "\"".concat(id, "\"")).join(', ');
|
|
523
523
|
return "id in (".concat(formattedIds, ")");
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
var
|
|
525
|
+
function areFiltersApplied(filters) {
|
|
526
|
+
var _filters$where;
|
|
527
527
|
if (!filters) {
|
|
528
528
|
return false;
|
|
529
529
|
}
|
|
530
|
-
return filters.where !== undefined &&
|
|
530
|
+
return filters.where !== undefined && ((_filters$where = filters.where) === null || _filters$where === void 0 ? void 0 : _trimInstanceProperty(_filters$where).call(_filters$where)) !== '';
|
|
531
531
|
}
|
|
532
532
|
function getInitialExportType(args) {
|
|
533
533
|
var _args$selectedResourc, _args$filters;
|
|
534
534
|
if ((_args$selectedResourc = args.selectedResourceIds) !== null && _args$selectedResourc !== void 0 && _args$selectedResourc.length) {
|
|
535
535
|
return EXPORT_TYPES.SELECTED;
|
|
536
536
|
}
|
|
537
|
-
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total) {
|
|
537
|
+
if ((_args$filters = args.filters) !== null && _args$filters !== void 0 && _args$filters.total && areFiltersApplied(args.filters)) {
|
|
538
538
|
return EXPORT_TYPES.FILTERED;
|
|
539
539
|
}
|
|
540
540
|
return EXPORT_TYPES.ALL;
|
|
@@ -823,8 +823,8 @@ function ExportScopeSection() {
|
|
|
823
823
|
exportType = _useExportResourcesCo.exportType,
|
|
824
824
|
totalResourcesCount = _useExportResourcesCo.totalResourcesCount,
|
|
825
825
|
filters = _useExportResourcesCo.filters,
|
|
826
|
-
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
827
826
|
hasFilters = _useExportResourcesCo.hasFilters,
|
|
827
|
+
selectedResourceIds = _useExportResourcesCo.selectedResourceIds,
|
|
828
828
|
setExportType = _useExportResourcesCo.setExportType,
|
|
829
829
|
resourceType = _useExportResourcesCo.resourceType;
|
|
830
830
|
return jsx(Spacings.Stack, {
|
|
@@ -849,9 +849,9 @@ function ExportScopeSection() {
|
|
|
849
849
|
})
|
|
850
850
|
}), filters && jsx(RadioInput.Option, {
|
|
851
851
|
value: EXPORT_TYPES.FILTERED,
|
|
852
|
-
isDisabled: !filters.total,
|
|
852
|
+
isDisabled: !filters.total || !hasFilters,
|
|
853
853
|
children: jsx(Text.Body, {
|
|
854
|
-
tone: !hasFilters ? 'tertiary' : undefined,
|
|
854
|
+
tone: !filters.total || !hasFilters ? 'tertiary' : undefined,
|
|
855
855
|
intlMessage: filters.total ? _objectSpread$5(_objectSpread$5({}, resourceTypeMessages[resourceType].exportScopeFiltered), {}, {
|
|
856
856
|
values: {
|
|
857
857
|
total: intl.formatNumber(filters.total)
|
|
@@ -1572,7 +1572,7 @@ const ExportResourcesProvider = props => {
|
|
|
1572
1572
|
totalResourcesCount: props.totalResourcesCount,
|
|
1573
1573
|
selectedResourceIds: props.selectedResourceIds,
|
|
1574
1574
|
filters: props.filters,
|
|
1575
|
-
hasFilters:
|
|
1575
|
+
hasFilters: areFiltersApplied(props.filters),
|
|
1576
1576
|
setExportType
|
|
1577
1577
|
},
|
|
1578
1578
|
children: props.children
|
package/package.json
CHANGED