@plone/volto 19.0.0-alpha.32 → 19.0.0-alpha.34

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.
Files changed (33) hide show
  1. package/AGENTS.md +47 -0
  2. package/CHANGELOG.md +27 -0
  3. package/README.md +0 -1
  4. package/package.json +16 -19
  5. package/src/actions/controlpanels/controlpanels.js +7 -12
  6. package/src/actions/controlpanels/controlpanels.test.js +2 -3
  7. package/src/components/manage/Contents/Contents.jsx +410 -323
  8. package/src/components/manage/Contents/Contents.test.jsx +1 -1
  9. package/src/components/manage/Contents/ContentsIndexHeader.jsx +47 -81
  10. package/src/components/manage/Contents/ContentsIndexHeader.test.jsx +10 -3
  11. package/src/components/manage/Contents/ContentsItem.jsx +226 -278
  12. package/src/components/manage/Contents/ContentsItem.test.jsx +10 -6
  13. package/src/components/manage/Controlpanels/ContentType.jsx +131 -222
  14. package/src/components/manage/Controlpanels/Controlpanel.jsx +122 -218
  15. package/src/components/manage/Controlpanels/Controlpanel.test.jsx +1 -29
  16. package/src/components/manage/Form/Field.jsx +1 -69
  17. package/src/components/manage/Widgets/ArrayWidget.jsx +111 -88
  18. package/src/components/manage/Widgets/ArrayWidget.test.jsx +0 -6
  19. package/src/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthIndexField.jsx +56 -50
  20. package/src/components/manage/Widgets/SelectStyling.jsx +52 -20
  21. package/src/config/Loadables.jsx +1 -5
  22. package/src/server.jsx +7 -1
  23. package/theme/themes/default/globals/site.variables +3 -3
  24. package/theme/themes/pastanaga/extras/contents.less +0 -4
  25. package/theme/themes/pastanaga/globals/site.variables +0 -3
  26. package/types/components/manage/Contents/Contents.d.ts +1 -1
  27. package/types/components/manage/Contents/ContentsIndexHeader.d.ts +6 -11
  28. package/types/components/manage/Contents/ContentsItem.d.ts +3 -10
  29. package/types/components/manage/Controlpanels/ContentType.d.ts +2 -2
  30. package/types/components/manage/Controlpanels/Controlpanel.d.ts +2 -5
  31. package/types/components/manage/Controlpanels/index.d.ts +2 -2
  32. package/types/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthIndexField.d.ts +22 -5
  33. package/types/components/manage/Widgets/SelectStyling.d.ts +1 -0
@@ -414,6 +414,7 @@ class Contents extends Component {
414
414
  isClient: false,
415
415
  };
416
416
  this.filterTimeout = null;
417
+ this.dragA11yRef = React.createRef();
417
418
  }
418
419
 
419
420
  /**
@@ -691,16 +692,14 @@ class Contents extends Component {
691
692
  * @returns {undefined}
692
693
  */
693
694
  onOrderIndex(index, delta) {
695
+ const nextIndex = {
696
+ ...this.state.index,
697
+ order: move(this.state.index.order, index, index + delta),
698
+ };
694
699
  this.setState({
695
- index: {
696
- ...this.state.index,
697
- order: move(this.state.index.order, index, index + delta),
698
- },
700
+ index: nextIndex,
699
701
  });
700
- this.props.updateColumnsContent(
701
- getBaseUrl(this.props.pathname),
702
- this.state.index,
703
- );
702
+ this.props.updateColumnsContent(getBaseUrl(this.props.pathname), nextIndex);
704
703
  }
705
704
 
706
705
  /**
@@ -725,6 +724,81 @@ class Contents extends Component {
725
724
  }
726
725
  }
727
726
 
727
+ onDragStart = ({ active }) => {
728
+ this.dragSnapshot = {
729
+ type: active?.data?.current?.type,
730
+ items: this.state.items,
731
+ indexOrder: this.state.index.order,
732
+ };
733
+ };
734
+
735
+ onDragOver = ({ active, over }) => {
736
+ const activeType = active?.data?.current?.type;
737
+ const overType = over?.data?.current?.type;
738
+ if (!over || active.id === over.id || activeType !== overType) {
739
+ return;
740
+ }
741
+ if (activeType === 'item') {
742
+ const oldIndex = this.state.items.findIndex(
743
+ (item) => item['@id'] === active.id,
744
+ );
745
+ const newIndex = this.state.items.findIndex(
746
+ (item) => item['@id'] === over.id,
747
+ );
748
+ if (oldIndex !== -1 && newIndex !== -1 && oldIndex !== newIndex) {
749
+ this.onOrderItem(active.id, oldIndex, newIndex - oldIndex, false);
750
+ }
751
+ }
752
+ if (activeType === 'index') {
753
+ const activeIndexId = active.data.current.indexId;
754
+ const overIndexId = over.data.current.indexId;
755
+ const oldIndex = this.state.index.order.indexOf(activeIndexId);
756
+ const newIndex = this.state.index.order.indexOf(overIndexId);
757
+ if (oldIndex !== -1 && newIndex !== -1 && oldIndex !== newIndex) {
758
+ this.onOrderIndex(oldIndex, newIndex - oldIndex);
759
+ }
760
+ }
761
+ };
762
+
763
+ onDragEnd = ({ active, over }) => {
764
+ const activeType = active?.data?.current?.type;
765
+
766
+ if (!over || activeType !== over?.data?.current?.type) {
767
+ this.onDragCancel();
768
+ return;
769
+ }
770
+
771
+ if (activeType === 'item') {
772
+ const startOrder = this.dragSnapshot.items.findIndex(
773
+ (item) => item['@id'] === active.id,
774
+ );
775
+ const endOrder = this.state.items.findIndex(
776
+ (item) => item['@id'] === active.id,
777
+ );
778
+
779
+ if (startOrder !== endOrder && endOrder !== -1) {
780
+ this.onOrderItem(active.id, startOrder, endOrder - startOrder, true);
781
+ }
782
+ }
783
+
784
+ this.dragSnapshot = null;
785
+ };
786
+
787
+ onDragCancel = () => {
788
+ if (!this.dragSnapshot) {
789
+ return;
790
+ }
791
+
792
+ this.setState({
793
+ items: this.dragSnapshot.items,
794
+ index: {
795
+ ...this.state.index,
796
+ order: this.dragSnapshot.indexOrder,
797
+ },
798
+ });
799
+ this.dragSnapshot = null;
800
+ };
801
+
728
802
  /**
729
803
  * On sort items
730
804
  * @method onSortItems
@@ -1127,6 +1201,17 @@ class Contents extends Component {
1127
1201
  const selected = this.state.selected.length > 0;
1128
1202
  const filteredItems = this.state.filteredItems || this.state.selected;
1129
1203
  const path = getBaseUrl(this.props.pathname);
1204
+ const { DndContext, closestCenter } = this.props.dndKitCore;
1205
+ const {
1206
+ restrictToHorizontalAxis,
1207
+ restrictToVerticalAxis,
1208
+ restrictToParentElement,
1209
+ } = this.props.dndKitModifiers;
1210
+ const {
1211
+ SortableContext,
1212
+ verticalListSortingStrategy,
1213
+ horizontalListSortingStrategy,
1214
+ } = this.props.dndKitSortable;
1130
1215
  const folderContentsAction = find(this.props.objectActions, {
1131
1216
  id: 'folderContents',
1132
1217
  });
@@ -1140,6 +1225,9 @@ class Contents extends Component {
1140
1225
 
1141
1226
  const Container =
1142
1227
  config.getComponent({ name: 'Container' }).component || SemanticContainer;
1228
+ const visibleIndexIds = this.state.index.order.filter(
1229
+ (index) => this.state.index.values[index].selected,
1230
+ );
1143
1231
 
1144
1232
  return this.props.token && this.props.objectActions?.length > 0 ? (
1145
1233
  <>
@@ -1582,266 +1670,317 @@ class Contents extends Component {
1582
1670
  messages.resultCount,
1583
1671
  )}: ${this.props.total || 0}`}
1584
1672
  </span>
1673
+ <div ref={this.dragA11yRef} />
1585
1674
  <Table selectable compact singleLine attached>
1586
1675
  <Table.Header>
1587
- <Table.Row>
1588
- <Table.HeaderCell>
1589
- <Popup
1590
- menu={true}
1591
- position="bottom left"
1592
- flowing={true}
1593
- basic={true}
1594
- on="click"
1595
- popper={{
1596
- className: 'dropdown-popup',
1597
- }}
1598
- trigger={
1599
- <Icon
1600
- name={configurationSVG}
1601
- size="24px"
1602
- color="#826a6a"
1603
- className="dropdown-popup-trigger configuration-svg"
1604
- />
1605
- }
1606
- >
1607
- <Menu vertical borderless fluid>
1608
- <Menu.Header
1609
- content={this.props.intl.formatMessage(
1610
- messages.rearrangeBy,
1611
- )}
1612
- />
1613
- {map(
1614
- [
1615
- 'id',
1616
- 'sortable_title',
1617
- 'EffectiveDate',
1618
- 'CreationDate',
1619
- 'ModificationDate',
1620
- 'portal_type',
1621
- ],
1622
- (index) => (
1623
- <Dropdown
1624
- key={index}
1625
- item
1626
- simple
1627
- className={`sort_${index} icon-align`}
1628
- icon={
1629
- <Icon
1630
- name={downKeySVG}
1631
- size="24px"
1632
- className="left"
1633
- />
1634
- }
1635
- text={this.props.intl.formatMessage(
1636
- {
1637
- id: Indexes[index].label,
1638
- },
1639
- )}
1640
- >
1641
- <Dropdown.Menu>
1642
- <Dropdown.Item
1643
- onClick={this.onSortItems}
1644
- value={`${Indexes[index].sort_on}|ascending`}
1645
- className={`sort_${Indexes[index].sort_on}_ascending icon-align`}
1646
- >
1647
- <Icon
1648
- name={sortDownSVG}
1649
- size="24px"
1650
- />{' '}
1651
- <FormattedMessage
1652
- id="Ascending"
1653
- defaultMessage="Ascending"
1654
- />
1655
- </Dropdown.Item>
1656
- <Dropdown.Item
1657
- onClick={this.onSortItems}
1658
- value={`${Indexes[index].sort_on}|descending`}
1659
- className={`sort_${Indexes[index].sort_on}_descending icon-align`}
1660
- >
1676
+ <DndContext
1677
+ collisionDetection={closestCenter}
1678
+ onDragStart={this.onDragStart}
1679
+ onDragOver={this.onDragOver}
1680
+ onDragEnd={this.onDragEnd}
1681
+ onDragCancel={this.onDragCancel}
1682
+ modifiers={[
1683
+ restrictToHorizontalAxis,
1684
+ restrictToParentElement,
1685
+ ]}
1686
+ accessibility={{
1687
+ container: this.dragA11yRef.current,
1688
+ }}
1689
+ >
1690
+ <Table.Row>
1691
+ <Table.HeaderCell>
1692
+ <Popup
1693
+ menu={true}
1694
+ position="bottom left"
1695
+ flowing={true}
1696
+ basic={true}
1697
+ on="click"
1698
+ popper={{
1699
+ className: 'dropdown-popup',
1700
+ }}
1701
+ trigger={
1702
+ <Icon
1703
+ name={configurationSVG}
1704
+ size="24px"
1705
+ color="#826a6a"
1706
+ className="dropdown-popup-trigger configuration-svg"
1707
+ />
1708
+ }
1709
+ >
1710
+ <Menu vertical borderless fluid>
1711
+ <Menu.Header
1712
+ content={this.props.intl.formatMessage(
1713
+ messages.rearrangeBy,
1714
+ )}
1715
+ />
1716
+ {map(
1717
+ [
1718
+ 'id',
1719
+ 'sortable_title',
1720
+ 'EffectiveDate',
1721
+ 'CreationDate',
1722
+ 'ModificationDate',
1723
+ 'portal_type',
1724
+ ],
1725
+ (index) => (
1726
+ <Dropdown
1727
+ key={index}
1728
+ item
1729
+ simple
1730
+ className={`sort_${index} icon-align`}
1731
+ icon={
1661
1732
  <Icon
1662
- name={sortUpSVG}
1733
+ name={downKeySVG}
1663
1734
  size="24px"
1664
- />{' '}
1665
- <FormattedMessage
1666
- id="Descending"
1667
- defaultMessage="Descending"
1735
+ className="left"
1668
1736
  />
1669
- </Dropdown.Item>
1670
- </Dropdown.Menu>
1671
- </Dropdown>
1672
- ),
1673
- )}
1674
- </Menu>
1675
- </Popup>
1676
- </Table.HeaderCell>
1677
- <Table.HeaderCell>
1678
- <Popup
1679
- menu={true}
1680
- position="bottom left"
1681
- flowing={true}
1682
- basic={true}
1683
- on="click"
1684
- popper={{
1685
- className: 'dropdown-popup',
1686
- }}
1687
- trigger={
1688
- <Icon
1689
- name={
1690
- this.state.selected.length === 0
1691
- ? checkboxUncheckedSVG
1692
- : this.state.selected.length ===
1693
- this.state.items.length
1694
- ? checkboxCheckedSVG
1695
- : checkboxIndeterminateSVG
1696
- }
1697
- color={
1698
- this.state.selected.length > 0
1699
- ? '#007eb1'
1700
- : '#826a6a'
1701
- }
1702
- className="dropdown-popup-trigger"
1703
- size="24px"
1704
- />
1705
- }
1706
- >
1707
- <Menu vertical borderless fluid>
1708
- <Menu.Header
1709
- content={this.props.intl.formatMessage(
1710
- messages.select,
1737
+ }
1738
+ text={this.props.intl.formatMessage(
1739
+ {
1740
+ id: Indexes[index].label,
1741
+ },
1742
+ )}
1743
+ >
1744
+ <Dropdown.Menu>
1745
+ <Dropdown.Item
1746
+ onClick={this.onSortItems}
1747
+ value={`${Indexes[index].sort_on}|ascending`}
1748
+ className={`sort_${Indexes[index].sort_on}_ascending icon-align`}
1749
+ >
1750
+ <Icon
1751
+ name={sortDownSVG}
1752
+ size="24px"
1753
+ />{' '}
1754
+ <FormattedMessage
1755
+ id="Ascending"
1756
+ defaultMessage="Ascending"
1757
+ />
1758
+ </Dropdown.Item>
1759
+ <Dropdown.Item
1760
+ onClick={this.onSortItems}
1761
+ value={`${Indexes[index].sort_on}|descending`}
1762
+ className={`sort_${Indexes[index].sort_on}_descending icon-align`}
1763
+ >
1764
+ <Icon
1765
+ name={sortUpSVG}
1766
+ size="24px"
1767
+ />{' '}
1768
+ <FormattedMessage
1769
+ id="Descending"
1770
+ defaultMessage="Descending"
1771
+ />
1772
+ </Dropdown.Item>
1773
+ </Dropdown.Menu>
1774
+ </Dropdown>
1775
+ ),
1711
1776
  )}
1712
- />
1713
- <Menu.Item onClick={this.onSelectAll}>
1777
+ </Menu>
1778
+ </Popup>
1779
+ </Table.HeaderCell>
1780
+ <Table.HeaderCell>
1781
+ <Popup
1782
+ menu={true}
1783
+ position="bottom left"
1784
+ flowing={true}
1785
+ basic={true}
1786
+ on="click"
1787
+ popper={{
1788
+ className: 'dropdown-popup',
1789
+ }}
1790
+ trigger={
1714
1791
  <Icon
1715
- name={checkboxCheckedSVG}
1716
- color="#007eb1"
1792
+ name={
1793
+ this.state.selected.length === 0
1794
+ ? checkboxUncheckedSVG
1795
+ : this.state.selected.length ===
1796
+ this.state.items.length
1797
+ ? checkboxCheckedSVG
1798
+ : checkboxIndeterminateSVG
1799
+ }
1800
+ color={
1801
+ this.state.selected.length > 0
1802
+ ? '#007eb1'
1803
+ : '#826a6a'
1804
+ }
1805
+ className="dropdown-popup-trigger"
1717
1806
  size="24px"
1718
- />{' '}
1719
- <FormattedMessage
1720
- id="All"
1721
- defaultMessage="All"
1722
1807
  />
1723
- </Menu.Item>
1724
- <Menu.Item onClick={this.onSelectNone}>
1725
- <Icon
1726
- name={checkboxUncheckedSVG}
1727
- size="24px"
1728
- />{' '}
1729
- <FormattedMessage
1730
- id="None"
1731
- defaultMessage="None"
1808
+ }
1809
+ >
1810
+ <Menu vertical borderless fluid>
1811
+ <Menu.Header
1812
+ content={this.props.intl.formatMessage(
1813
+ messages.select,
1814
+ )}
1732
1815
  />
1733
- </Menu.Item>
1734
- <Divider />
1735
- <Menu.Header
1736
- content={this.props.intl.formatMessage(
1737
- messages.selected,
1738
- {
1739
- count: this.state.selected.length,
1740
- },
1741
- )}
1742
- />
1743
- <Input
1744
- icon={
1745
- <Icon name={zoomSVG} size="24px" />
1746
- }
1747
- iconPosition="left"
1748
- className="item search"
1749
- placeholder={this.props.intl.formatMessage(
1750
- messages.filter,
1751
- )}
1752
- value={
1753
- this.state.selectedMenuFilter || ''
1754
- }
1755
- onChange={this.onChangeSelected}
1756
- onClick={(e) => {
1757
- e.preventDefault();
1758
- e.stopPropagation();
1759
- }}
1760
- />
1761
- <Menu.Menu scrolling>
1762
- {map(filteredItems, (item) => (
1763
- <Menu.Item
1764
- key={item}
1765
- value={item}
1766
- onClick={this.onDeselect}
1767
- >
1768
- <Icon
1769
- name={deleteSVG}
1770
- color="#e40166"
1771
- size="24px"
1772
- />{' '}
1773
- {this.getFieldById(item, 'title')}
1774
- </Menu.Item>
1775
- ))}
1776
- </Menu.Menu>
1777
- </Menu>
1778
- </Popup>
1779
- </Table.HeaderCell>
1780
- <Table.HeaderCell
1781
- width={Math.ceil(
1782
- 16 / this.state.index.selectedCount,
1783
- )}
1784
- >
1785
- <FormattedMessage
1786
- id="Title"
1787
- defaultMessage="Title"
1788
- />
1789
- </Table.HeaderCell>
1790
- {map(
1791
- this.state.index.order,
1792
- (index, order) =>
1793
- this.state.index.values[index].selected && (
1794
- <ContentsIndexHeader
1795
- key={index}
1796
- width={Math.ceil(
1797
- 16 / this.state.index.selectedCount,
1798
- )}
1799
- label={
1800
- this.state.index.values[index].label
1801
- }
1802
- order={order}
1803
- onOrderIndex={this.onOrderIndex}
1804
- />
1805
- ),
1806
- )}
1807
- <Table.HeaderCell textAlign="right">
1808
- <FormattedMessage
1809
- id="Actions"
1810
- defaultMessage="Actions"
1811
- />
1812
- </Table.HeaderCell>
1813
- </Table.Row>
1816
+ <Menu.Item onClick={this.onSelectAll}>
1817
+ <Icon
1818
+ name={checkboxCheckedSVG}
1819
+ color="#007eb1"
1820
+ size="24px"
1821
+ />{' '}
1822
+ <FormattedMessage
1823
+ id="All"
1824
+ defaultMessage="All"
1825
+ />
1826
+ </Menu.Item>
1827
+ <Menu.Item onClick={this.onSelectNone}>
1828
+ <Icon
1829
+ name={checkboxUncheckedSVG}
1830
+ size="24px"
1831
+ />{' '}
1832
+ <FormattedMessage
1833
+ id="None"
1834
+ defaultMessage="None"
1835
+ />
1836
+ </Menu.Item>
1837
+ <Divider />
1838
+ <Menu.Header
1839
+ content={this.props.intl.formatMessage(
1840
+ messages.selected,
1841
+ {
1842
+ count: this.state.selected.length,
1843
+ },
1844
+ )}
1845
+ />
1846
+ <Input
1847
+ icon={
1848
+ <Icon name={zoomSVG} size="24px" />
1849
+ }
1850
+ iconPosition="left"
1851
+ className="item search"
1852
+ placeholder={this.props.intl.formatMessage(
1853
+ messages.filter,
1854
+ )}
1855
+ value={
1856
+ this.state.selectedMenuFilter || ''
1857
+ }
1858
+ onChange={this.onChangeSelected}
1859
+ onClick={(e) => {
1860
+ e.preventDefault();
1861
+ e.stopPropagation();
1862
+ }}
1863
+ />
1864
+ <Menu.Menu scrolling>
1865
+ {map(filteredItems, (item) => (
1866
+ <Menu.Item
1867
+ key={item}
1868
+ value={item}
1869
+ onClick={this.onDeselect}
1870
+ >
1871
+ <Icon
1872
+ name={deleteSVG}
1873
+ color="#e40166"
1874
+ size="24px"
1875
+ />{' '}
1876
+ {this.getFieldById(item, 'title')}
1877
+ </Menu.Item>
1878
+ ))}
1879
+ </Menu.Menu>
1880
+ </Menu>
1881
+ </Popup>
1882
+ </Table.HeaderCell>
1883
+ <Table.HeaderCell
1884
+ width={Math.ceil(
1885
+ 16 / this.state.index.selectedCount,
1886
+ )}
1887
+ >
1888
+ <FormattedMessage
1889
+ id="Title"
1890
+ defaultMessage="Title"
1891
+ />
1892
+ </Table.HeaderCell>
1893
+ <SortableContext
1894
+ items={visibleIndexIds.map(
1895
+ (index) => `index:${index}`,
1896
+ )}
1897
+ strategy={horizontalListSortingStrategy}
1898
+ >
1899
+ {map(
1900
+ this.state.index.order,
1901
+ (index) =>
1902
+ this.state.index.values[index]
1903
+ .selected && (
1904
+ <ContentsIndexHeader
1905
+ key={index}
1906
+ id={index}
1907
+ width={Math.ceil(
1908
+ 16 /
1909
+ this.state.index.selectedCount,
1910
+ )}
1911
+ label={
1912
+ this.state.index.values[index]
1913
+ .label
1914
+ }
1915
+ />
1916
+ ),
1917
+ )}
1918
+ </SortableContext>
1919
+ <Table.HeaderCell textAlign="right">
1920
+ <FormattedMessage
1921
+ id="Actions"
1922
+ defaultMessage="Actions"
1923
+ />
1924
+ </Table.HeaderCell>
1925
+ </Table.Row>
1926
+ </DndContext>
1814
1927
  </Table.Header>
1815
1928
  <Table.Body>
1816
- {this.state.items.map((item, order) => (
1817
- <ContentsItem
1818
- key={item['@id']}
1819
- item={item}
1820
- order={order}
1821
- selected={
1822
- indexOf(
1823
- this.state.selected,
1824
- item['@id'],
1825
- ) !== -1
1826
- }
1827
- onClick={this.onSelect}
1828
- indexes={filter(
1829
- map(this.state.index.order, (index) => ({
1830
- id: index,
1831
- type: this.state.index.values[index].type,
1832
- })),
1833
- (index) =>
1834
- this.state.index.values[index.id]
1835
- .selected,
1929
+ <DndContext
1930
+ collisionDetection={closestCenter}
1931
+ onDragStart={this.onDragStart}
1932
+ onDragOver={this.onDragOver}
1933
+ onDragEnd={this.onDragEnd}
1934
+ onDragCancel={this.onDragCancel}
1935
+ modifiers={[
1936
+ restrictToVerticalAxis,
1937
+ restrictToParentElement,
1938
+ ]}
1939
+ accessibility={{
1940
+ container: this.dragA11yRef.current,
1941
+ }}
1942
+ >
1943
+ <SortableContext
1944
+ items={this.state.items.map(
1945
+ (item) => item['@id'],
1836
1946
  )}
1837
- onCut={this.cut}
1838
- onCopy={this.copy}
1839
- onDelete={this.delete}
1840
- onOrderItem={this.onOrderItem}
1841
- onMoveToTop={this.onMoveToTop}
1842
- onMoveToBottom={this.onMoveToBottom}
1843
- />
1844
- ))}
1947
+ strategy={verticalListSortingStrategy}
1948
+ >
1949
+ {this.state.items.map((item, order) => (
1950
+ <ContentsItem
1951
+ key={item['@id']}
1952
+ item={item}
1953
+ order={order}
1954
+ selected={
1955
+ indexOf(
1956
+ this.state.selected,
1957
+ item['@id'],
1958
+ ) !== -1
1959
+ }
1960
+ onClick={this.onSelect}
1961
+ indexes={filter(
1962
+ map(
1963
+ this.state.index.order,
1964
+ (index) => ({
1965
+ id: index,
1966
+ type: this.state.index.values[index]
1967
+ .type,
1968
+ }),
1969
+ ),
1970
+ (index) =>
1971
+ this.state.index.values[index.id]
1972
+ .selected,
1973
+ )}
1974
+ onCut={this.cut}
1975
+ onCopy={this.copy}
1976
+ onDelete={this.delete}
1977
+ onOrderItem={this.onOrderItem}
1978
+ onMoveToTop={this.onMoveToTop}
1979
+ onMoveToBottom={this.onMoveToBottom}
1980
+ />
1981
+ ))}
1982
+ </SortableContext>
1983
+ </DndContext>
1845
1984
  </Table.Body>
1846
1985
  </Table>
1847
1986
  </div>
@@ -1900,25 +2039,14 @@ class Contents extends Component {
1900
2039
  }
1901
2040
  }
1902
2041
 
1903
- let dndContext;
1904
-
1905
- const DragDropConnector = (props) => {
1906
- const { DragDropContext } = props.reactDnd;
1907
- const HTML5Backend = props.reactDndHtml5Backend.default;
1908
-
1909
- const DndConnectedContents = React.useMemo(() => {
1910
- if (!dndContext) {
1911
- dndContext = DragDropContext(HTML5Backend);
1912
- }
1913
- return dndContext(Contents);
1914
- }, [DragDropContext, HTML5Backend]);
1915
-
1916
- return <DndConnectedContents {...props} />;
1917
- };
1918
-
1919
- export const __test__ = compose(
2042
+ export const ContentsComponent = compose(
1920
2043
  injectIntl,
1921
- injectLazyLibs(['toastify', 'reactDnd']),
2044
+ injectLazyLibs([
2045
+ 'toastify',
2046
+ 'dndKitCore',
2047
+ 'dndKitModifiers',
2048
+ 'dndKitSortable',
2049
+ ]),
1922
2050
  connect(
1923
2051
  (store, props) => {
1924
2052
  return {
@@ -1958,53 +2086,12 @@ export const __test__ = compose(
1958
2086
  ),
1959
2087
  )(Contents);
1960
2088
 
1961
- export default compose(
1962
- injectIntl,
1963
- connect(
1964
- (store, props) => {
1965
- return {
1966
- token: store.userSession.token,
1967
- items: store.search.items,
1968
- sort: store.content.update.sort,
1969
- index: store.content.updatecolumns.idx,
1970
- breadcrumbs: store.breadcrumbs.items,
1971
- total: store.search.total,
1972
- searchRequest: {
1973
- loading: store.search.loading,
1974
- loaded: store.search.loaded,
1975
- },
1976
- pathname: props.location.pathname,
1977
- action: store.clipboard.action,
1978
- source: store.clipboard.source,
1979
- clipboardRequest: store.clipboard.request,
1980
- deleteRequest: store.content.delete,
1981
- updateRequest: store.content.update,
1982
- objectActions: store.actions.actions.object,
1983
- orderRequest: store.content.order,
1984
- };
1985
- },
1986
- {
1987
- searchContent,
1988
- cut,
1989
- copy,
1990
- copyContent,
1991
- deleteContent,
1992
- listActions,
1993
- moveContent,
1994
- orderContent,
1995
- sortContent,
1996
- updateColumnsContent,
1997
- getContent,
1998
- },
1999
- ),
2000
- asyncConnect([
2001
- {
2002
- key: 'actions',
2003
- // Dispatch async/await to make the operation synchronous, otherwise it returns
2004
- // before the promise is resolved
2005
- promise: async ({ location, store: { dispatch } }) =>
2006
- await dispatch(listActions(getBaseUrl(location.pathname))),
2007
- },
2008
- ]),
2009
- injectLazyLibs(['toastify', 'reactDnd', 'reactDndHtml5Backend']),
2010
- )(DragDropConnector);
2089
+ export default asyncConnect([
2090
+ {
2091
+ key: 'actions',
2092
+ // Dispatch async/await to make the operation synchronous, otherwise it returns
2093
+ // before the promise is resolved
2094
+ promise: async ({ location, store: { dispatch } }) =>
2095
+ await dispatch(listActions(getBaseUrl(location.pathname))),
2096
+ },
2097
+ ])(ContentsComponent);