@commercetools-frontend-extensions/export-resources-modal 0.0.0-canary-20250206164056 → 0.0.0-fec-202-react19-20250204105856
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/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +62 -119
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +56 -113
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +63 -120
- package/dist/declarations/src/@types/export-resources-modal-context.d.ts +1 -0
- package/dist/declarations/src/@types/export-resources-modal-types.d.ts +0 -1
- package/dist/declarations/src/@types/form.d.ts +7 -2
- package/package.json +30 -30
|
@@ -103,7 +103,7 @@ function getBold(msg) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
function getNewLine() {
|
|
106
|
-
return jsxRuntime.jsx("br", {},
|
|
106
|
+
return jsxRuntime.jsx("br", {}, "break");
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
var messages = reactIntl.defineMessages({
|
|
@@ -401,16 +401,6 @@ var messages = reactIntl.defineMessages({
|
|
|
401
401
|
id: 'ExportResourcesModal.fillRowsForProductExport',
|
|
402
402
|
description: 'A checkbox label for filling rows for product export',
|
|
403
403
|
defaultMessage: 'Include Product- and Variant-level information in every row'
|
|
404
|
-
},
|
|
405
|
-
loadMoreFields: {
|
|
406
|
-
id: 'ExportResourcesModal.loadMoreFields',
|
|
407
|
-
description: 'Load more fields message',
|
|
408
|
-
defaultMessage: 'Load more fields by using the search functionality'
|
|
409
|
-
},
|
|
410
|
-
itemCount: {
|
|
411
|
-
id: 'ExportResourcesModal.itemCount',
|
|
412
|
-
description: 'Label for item count',
|
|
413
|
-
defaultMessage: '{count, plural, one {# item} other {# items}}'
|
|
414
404
|
}
|
|
415
405
|
});
|
|
416
406
|
|
|
@@ -657,16 +647,16 @@ const isAnyDependentChecked = function (groups) {
|
|
|
657
647
|
const areAllFieldsChecked = fields => {
|
|
658
648
|
return _everyInstanceProperty__default["default"](fields).call(fields, field => field.fields ? areAllFieldsChecked(field.fields) : field.isChecked || field.isRequired || hasDependentFields(field));
|
|
659
649
|
};
|
|
660
|
-
const
|
|
661
|
-
const
|
|
650
|
+
const getTotalCheckedFields = group => {
|
|
651
|
+
const countCheckedFields = fields => {
|
|
662
652
|
return _reduceInstanceProperty__default["default"](fields).call(fields, (total, field) => {
|
|
663
653
|
if (field.fields) {
|
|
664
|
-
return total +
|
|
654
|
+
return total + countCheckedFields(field.fields);
|
|
665
655
|
}
|
|
666
656
|
return total + (field.isChecked ? 1 : 0);
|
|
667
657
|
}, 0);
|
|
668
658
|
};
|
|
669
|
-
return
|
|
659
|
+
return countCheckedFields(group.fields);
|
|
670
660
|
};
|
|
671
661
|
|
|
672
662
|
let Step = /*#__PURE__*/function (Step) {
|
|
@@ -905,22 +895,12 @@ const updateFieldGroupWithAdditionalFieldExtensions = groups => {
|
|
|
905
895
|
});
|
|
906
896
|
});
|
|
907
897
|
};
|
|
908
|
-
const getIsExpanded = (field, groupName, cachedExpandedGroups) => {
|
|
909
|
-
if (!field.isExpandable) {
|
|
910
|
-
return false;
|
|
911
|
-
}
|
|
912
|
-
if (field.fields && field.maxVisibleChildren && field.fields.length > field.maxVisibleChildren) {
|
|
913
|
-
return false;
|
|
914
|
-
}
|
|
915
|
-
const cacheKey = `${groupName}.${field.name}`;
|
|
916
|
-
return cachedExpandedGroups[cacheKey] ?? field.isExpanded ?? false;
|
|
917
|
-
};
|
|
918
898
|
const updateFieldGroupsWithIsExpandedValue = (groups, cachedExpandedGroups) => {
|
|
919
899
|
function updateFields(fields, groupName) {
|
|
920
900
|
return _mapInstanceProperty__default["default"](fields).call(fields, field => {
|
|
921
901
|
let isExpanded = null;
|
|
922
902
|
if (field.isExpandable) {
|
|
923
|
-
isExpanded =
|
|
903
|
+
isExpanded = cachedExpandedGroups[`${groupName}.${field.name}`] ?? field.isExpanded ?? false;
|
|
924
904
|
}
|
|
925
905
|
if (field.fields) {
|
|
926
906
|
field.fields = updateFields(field.fields, groupName);
|
|
@@ -1485,15 +1465,22 @@ const useExportFieldSelectionContext = () => {
|
|
|
1485
1465
|
return React.useContext(ExportFieldSelectionContext);
|
|
1486
1466
|
};
|
|
1487
1467
|
|
|
1488
|
-
const
|
|
1489
|
-
let
|
|
1468
|
+
const ExportFieldSelectionStamp = _ref => {
|
|
1469
|
+
let group = _ref.group;
|
|
1490
1470
|
const _useIntl = reactIntl.useIntl(),
|
|
1491
1471
|
formatMessage = _useIntl.formatMessage;
|
|
1492
|
-
return jsxRuntime.jsx(uiKit.
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1472
|
+
return jsxRuntime.jsx(uiKit.Card, {
|
|
1473
|
+
type: "flat",
|
|
1474
|
+
insetScale: "m",
|
|
1475
|
+
children: jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1476
|
+
justifyContent: "flex-end",
|
|
1477
|
+
children: jsxRuntime.jsx(uiKit.Stamp, {
|
|
1478
|
+
tone: "secondary",
|
|
1479
|
+
isCondensed: true,
|
|
1480
|
+
label: formatMessage(messages.selected, {
|
|
1481
|
+
total: getTotalCheckedFields(group)
|
|
1482
|
+
})
|
|
1483
|
+
})
|
|
1497
1484
|
})
|
|
1498
1485
|
});
|
|
1499
1486
|
};
|
|
@@ -1532,26 +1519,13 @@ const FieldSection = _ref3 => {
|
|
|
1532
1519
|
parentKeys = _ref3.parentKeys,
|
|
1533
1520
|
formik = _ref3.formik,
|
|
1534
1521
|
isAnySiblingChecked = _ref3.isAnySiblingChecked,
|
|
1535
|
-
|
|
1536
|
-
groupName = _ref3.groupName
|
|
1537
|
-
maxVisibleChildren = _ref3.maxVisibleChildren;
|
|
1522
|
+
isForceExpanded = _ref3.isForceExpanded,
|
|
1523
|
+
groupName = _ref3.groupName;
|
|
1538
1524
|
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
1539
1525
|
updateExpandedGroups = _useExportFieldSelect.updateExpandedGroups;
|
|
1540
|
-
|
|
1541
|
-
const hasMoreFields = maxVisibleChildren && !isSearchActive && fields && fields.length > maxVisibleChildren;
|
|
1542
|
-
const visibleIndex = field => fields?.filter(f => !f.isHidden).indexOf(field) || -1;
|
|
1543
|
-
const shouldDisplayField = field => {
|
|
1544
|
-
if (field.isHidden) return false;
|
|
1545
|
-
if (!maxVisibleChildren) return true;
|
|
1546
|
-
return maxVisibleChildren && visibleIndex(field) < maxVisibleChildren;
|
|
1547
|
-
};
|
|
1548
|
-
const shouldDisplayChildrenCount = field => {
|
|
1549
|
-
return Boolean(field.maxVisibleChildren);
|
|
1550
|
-
};
|
|
1551
|
-
return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
|
|
1526
|
+
return jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1552
1527
|
scale: "s",
|
|
1553
|
-
children:
|
|
1554
|
-
const isChildrenCountDisplayed = shouldDisplayChildrenCount(field);
|
|
1528
|
+
children: fields?.map((field, index) => {
|
|
1555
1529
|
const hasDependents = Boolean(field.dependentGroupNames?.length || field.dependentFieldNames?.length);
|
|
1556
1530
|
const isAnyOfTheChildFieldsChecked = isAnyFieldChecked(field.fields || []);
|
|
1557
1531
|
const allFieldsChecked = areAllFieldsChecked(field.fields || []);
|
|
@@ -1560,9 +1534,9 @@ const FieldSection = _ref3 => {
|
|
|
1560
1534
|
if (isParent) return areAllFieldsChecked(field.fields);
|
|
1561
1535
|
return field.isChecked;
|
|
1562
1536
|
};
|
|
1563
|
-
if (
|
|
1537
|
+
if (field.isHidden) return null;
|
|
1564
1538
|
return jsxRuntime.jsx(CollapsibleFieldWrapper, {
|
|
1565
|
-
isForceExpanded:
|
|
1539
|
+
isForceExpanded: isForceExpanded,
|
|
1566
1540
|
field: field,
|
|
1567
1541
|
children: _ref4 => {
|
|
1568
1542
|
let isOpen = _ref4.isOpen,
|
|
@@ -1577,17 +1551,17 @@ const FieldSection = _ref3 => {
|
|
|
1577
1551
|
left: `calc(-1 * ${uiKit.designTokens.spacingXl})`
|
|
1578
1552
|
},
|
|
1579
1553
|
onClick: () => {
|
|
1580
|
-
if (!
|
|
1554
|
+
if (!isForceExpanded) {
|
|
1581
1555
|
updateExpandedGroups(`${groupName}.${field.name}`, !isOpen);
|
|
1582
1556
|
}
|
|
1583
1557
|
toggle();
|
|
1584
1558
|
},
|
|
1585
1559
|
icon: isOpen ? jsxRuntime.jsx(uiKit.AngleDownIcon, {}) : jsxRuntime.jsx(uiKit.AngleRightIcon, {}),
|
|
1586
1560
|
label: ""
|
|
1587
|
-
}), jsxRuntime.
|
|
1561
|
+
}), jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1588
1562
|
scale: "s",
|
|
1589
1563
|
alignItems: "center",
|
|
1590
|
-
children:
|
|
1564
|
+
children: jsxRuntime.jsxs(uiKit.CheckboxInput, {
|
|
1591
1565
|
isIndeterminate: field.isExpandable && !allFieldsChecked && isAnyOfTheChildFieldsChecked,
|
|
1592
1566
|
isChecked: getIsChecked(),
|
|
1593
1567
|
isReadOnly: hasDependents || field.isRequired,
|
|
@@ -1618,60 +1592,26 @@ const FieldSection = _ref3 => {
|
|
|
1618
1592
|
updateAllChildFieldsChecked(path, checked);
|
|
1619
1593
|
},
|
|
1620
1594
|
children: [field.label, (hasDependents || field.isRequired) && ' *']
|
|
1621
|
-
})
|
|
1622
|
-
style: {
|
|
1623
|
-
flex: '0 0 auto'
|
|
1624
|
-
},
|
|
1625
|
-
children: jsxRuntime.jsx(FieldsCountStamp, {
|
|
1626
|
-
count: field.fields.length
|
|
1627
|
-
})
|
|
1628
|
-
})]
|
|
1595
|
+
})
|
|
1629
1596
|
})]
|
|
1630
|
-
}), field.fields && field.fields
|
|
1597
|
+
}), field.fields && field.fields?.length > 0 && jsxRuntime.jsx(StyledExpandableContent, {
|
|
1631
1598
|
ref: registerContentNode,
|
|
1632
1599
|
isOpen: isOpen,
|
|
1633
1600
|
children: isOpen && jsxRuntime.jsxs(uiKit.Spacings.Inline, {
|
|
1634
1601
|
scale: "xl",
|
|
1635
1602
|
children: [jsxRuntime.jsx("div", {}), jsxRuntime.jsx(FieldSection, {
|
|
1636
1603
|
fields: field.fields,
|
|
1637
|
-
maxVisibleChildren: field.maxVisibleChildren,
|
|
1638
1604
|
formik: formik,
|
|
1639
1605
|
parentKeys: [...parentKeys, `fields[${index}]`],
|
|
1640
1606
|
isAnySiblingChecked: isAnySiblingChecked,
|
|
1641
|
-
|
|
1607
|
+
isForceExpanded: isForceExpanded,
|
|
1642
1608
|
groupName: groupName
|
|
1643
1609
|
})]
|
|
1644
1610
|
})
|
|
1645
1611
|
})]
|
|
1646
1612
|
}, `${field.name}-${index}`);
|
|
1647
1613
|
}
|
|
1648
|
-
}, `${field.name}.${
|
|
1649
|
-
}), hasMoreFields && jsxRuntime.jsx("div", {
|
|
1650
|
-
css: /*#__PURE__*/react.css("padding-left:", uiKit.designTokens.spacingXs, ";" + ("" ), "" ),
|
|
1651
|
-
children: jsxRuntime.jsx(uiKit.Text.Detail, {
|
|
1652
|
-
tone: "tertiary",
|
|
1653
|
-
intlMessage: messages.loadMoreFields
|
|
1654
|
-
})
|
|
1655
|
-
})]
|
|
1656
|
-
});
|
|
1657
|
-
};
|
|
1658
|
-
|
|
1659
|
-
const SelectedGroupFieldsCountStamp = _ref => {
|
|
1660
|
-
let group = _ref.group;
|
|
1661
|
-
const _useIntl = reactIntl.useIntl(),
|
|
1662
|
-
formatMessage = _useIntl.formatMessage;
|
|
1663
|
-
return jsxRuntime.jsx(uiKit.Card, {
|
|
1664
|
-
type: "flat",
|
|
1665
|
-
insetScale: "m",
|
|
1666
|
-
children: jsxRuntime.jsx(uiKit.Spacings.Inline, {
|
|
1667
|
-
justifyContent: "flex-end",
|
|
1668
|
-
children: jsxRuntime.jsx(uiKit.Stamp, {
|
|
1669
|
-
tone: "secondary",
|
|
1670
|
-
isCondensed: true,
|
|
1671
|
-
label: formatMessage(messages.selected, {
|
|
1672
|
-
total: getGroupSelectedFieldCount(group)
|
|
1673
|
-
})
|
|
1674
|
-
})
|
|
1614
|
+
}, `${field.name}.${isForceExpanded}`);
|
|
1675
1615
|
})
|
|
1676
1616
|
});
|
|
1677
1617
|
};
|
|
@@ -1695,7 +1635,7 @@ const FieldGroupSection = _ref2 => {
|
|
|
1695
1635
|
let group = _ref2.group,
|
|
1696
1636
|
index = _ref2.index,
|
|
1697
1637
|
formik = _ref2.formik,
|
|
1698
|
-
|
|
1638
|
+
isForceExpanded = _ref2.isForceExpanded;
|
|
1699
1639
|
const allFieldsChecked = React.useMemo(() => areAllFieldsChecked(group.fields), [group.fields]);
|
|
1700
1640
|
const isAnyFieldInGroupChecked = React.useMemo(() => isAnyFieldChecked(group.fields), [group.fields]);
|
|
1701
1641
|
const _useExportFieldSelect = useExportFieldSelectionContext(),
|
|
@@ -1722,9 +1662,7 @@ const FieldGroupSection = _ref2 => {
|
|
|
1722
1662
|
};
|
|
1723
1663
|
if (group.isHidden) return null;
|
|
1724
1664
|
return jsxRuntime.jsx(uiKit.CollapsibleMotion, {
|
|
1725
|
-
isDefaultClosed:
|
|
1726
|
-
// Reset collapse state when search input becomes active/inactive
|
|
1727
|
-
,
|
|
1665
|
+
isDefaultClosed: isForceExpanded ? false : !group.isExpanded,
|
|
1728
1666
|
children: _ref3 => {
|
|
1729
1667
|
let isOpen = _ref3.isOpen,
|
|
1730
1668
|
toggle = _ref3.toggle,
|
|
@@ -1741,7 +1679,7 @@ const FieldGroupSection = _ref2 => {
|
|
|
1741
1679
|
children: [jsxRuntime.jsx(uiKit.IconButton, {
|
|
1742
1680
|
size: "20",
|
|
1743
1681
|
onClick: () => {
|
|
1744
|
-
if (!
|
|
1682
|
+
if (!isForceExpanded) {
|
|
1745
1683
|
updateExpandedGroups(group.groupName, !isOpen);
|
|
1746
1684
|
}
|
|
1747
1685
|
toggle();
|
|
@@ -1766,23 +1704,26 @@ const FieldGroupSection = _ref2 => {
|
|
|
1766
1704
|
type: "flat",
|
|
1767
1705
|
insetScale: "m",
|
|
1768
1706
|
showTopBorder: true,
|
|
1769
|
-
children: isOpen && jsxRuntime.jsx(
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1707
|
+
children: isOpen && jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
1708
|
+
scale: "s",
|
|
1709
|
+
children: jsxRuntime.jsx(FieldSection, {
|
|
1710
|
+
fields: group.fields,
|
|
1711
|
+
formik: formik,
|
|
1712
|
+
parentKeys: [parentKey],
|
|
1713
|
+
isAnySiblingChecked: isAnyFieldInGroupChecked,
|
|
1714
|
+
groupName: group.groupName,
|
|
1715
|
+
isForceExpanded: isForceExpanded
|
|
1716
|
+
})
|
|
1776
1717
|
})
|
|
1777
1718
|
})
|
|
1778
|
-
}), !isOpen && jsxRuntime.jsx(
|
|
1719
|
+
}), !isOpen && jsxRuntime.jsx(ExportFieldSelectionStamp, {
|
|
1779
1720
|
group: group
|
|
1780
1721
|
})]
|
|
1781
1722
|
})
|
|
1782
1723
|
})]
|
|
1783
1724
|
});
|
|
1784
1725
|
}
|
|
1785
|
-
}, `${
|
|
1726
|
+
}, `${isForceExpanded}`);
|
|
1786
1727
|
};
|
|
1787
1728
|
|
|
1788
1729
|
var _ref = {
|
|
@@ -1837,7 +1778,6 @@ const totalSpacing = 32 * 2 + (
|
|
|
1837
1778
|
// MC header
|
|
1838
1779
|
4; // borders
|
|
1839
1780
|
|
|
1840
|
-
const MIN_SEARCH_LENGTH = 3;
|
|
1841
1781
|
const StyledGridCard = /*#__PURE__*/_styled__default["default"](uiKit.Card, {
|
|
1842
1782
|
target: "e5mvpn60"
|
|
1843
1783
|
} )("max-height:calc(100vh - ", totalSpacing, "px);overflow:auto;" + ("" ));
|
|
@@ -1860,9 +1800,9 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1860
1800
|
setCurrentStep = _useExportResourcesMo.setCurrentStep,
|
|
1861
1801
|
resourceType = _useExportResourcesMo.resourceType,
|
|
1862
1802
|
onClose = _useExportResourcesMo.onClose;
|
|
1863
|
-
const isSearchActive = fieldSearchTerm?.trim()?.length >= MIN_SEARCH_LENGTH;
|
|
1864
1803
|
React__default["default"].useEffect(() => {
|
|
1865
1804
|
var _context2;
|
|
1805
|
+
formik.validateForm();
|
|
1866
1806
|
updateFieldDependenciesStatus(formik);
|
|
1867
1807
|
const checkedFields = {};
|
|
1868
1808
|
function getCheckedFields(field, groupName) {
|
|
@@ -1903,7 +1843,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1903
1843
|
});
|
|
1904
1844
|
});
|
|
1905
1845
|
};
|
|
1906
|
-
if (!
|
|
1846
|
+
if (!fieldSearchTerm?.trim()?.length) return _valuesInstanceProperty__default["default"](formik).groups;
|
|
1907
1847
|
const updateGroups = groups => {
|
|
1908
1848
|
return _mapInstanceProperty__default["default"](groups).call(groups, group => {
|
|
1909
1849
|
const updatedFields = updateFields(group.fields, false);
|
|
@@ -1915,12 +1855,12 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1915
1855
|
});
|
|
1916
1856
|
};
|
|
1917
1857
|
return updateGroups(_valuesInstanceProperty__default["default"](formik).groups);
|
|
1918
|
-
}, [_valuesInstanceProperty__default["default"](formik).groups, fieldSearchTerm
|
|
1858
|
+
}, [_valuesInstanceProperty__default["default"](formik).groups, fieldSearchTerm]);
|
|
1919
1859
|
const onSearchChange = React__default["default"].useCallback(event => {
|
|
1920
1860
|
setFieldSearchTerm(event.target.value);
|
|
1921
1861
|
}, [setFieldSearchTerm]);
|
|
1922
1862
|
const hasResults = Boolean(_findInstanceProperty__default["default"](filteredGroups).call(filteredGroups, group => !group.isHidden));
|
|
1923
|
-
const onSearchChangeDebounced = React__default["default"].useMemo(() => debounce__default["default"](onSearchChange,
|
|
1863
|
+
const onSearchChangeDebounced = React__default["default"].useMemo(() => debounce__default["default"](onSearchChange, 300), [onSearchChange]);
|
|
1924
1864
|
const onSearchReset = () => {
|
|
1925
1865
|
setFieldSearchTerm('');
|
|
1926
1866
|
};
|
|
@@ -1960,7 +1900,7 @@ const ExportFieldsSelectionStep = () => {
|
|
|
1960
1900
|
group: group,
|
|
1961
1901
|
index: index,
|
|
1962
1902
|
formik: formik,
|
|
1963
|
-
|
|
1903
|
+
isForceExpanded: fieldSearchTerm?.trim()?.length > 0
|
|
1964
1904
|
}, group.groupName))
|
|
1965
1905
|
})
|
|
1966
1906
|
}) : jsxRuntime.jsx(NoSearchResults, {})]
|
|
@@ -2005,6 +1945,9 @@ const ExportResourcesProvider = _ref => {
|
|
|
2005
1945
|
}),
|
|
2006
1946
|
onSubmit
|
|
2007
1947
|
});
|
|
1948
|
+
React__default["default"].useEffect(() => {
|
|
1949
|
+
formik$1.validateForm();
|
|
1950
|
+
}, [currentStep]);
|
|
2008
1951
|
return jsxRuntime.jsx(ExportResourcesContext.Provider, {
|
|
2009
1952
|
value: {
|
|
2010
1953
|
formik: formik$1,
|