@konoma-development/react-components 0.3.17 → 0.3.18
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.
|
@@ -16850,7 +16850,7 @@ function Table({ noDataClasses = baseClasses$2.noDataClasses, wrapperClasses = b
|
|
|
16850
16850
|
})
|
|
16851
16851
|
]
|
|
16852
16852
|
}, locale),
|
|
16853
|
-
/* @__PURE__ */ jsx(DndProvider, {
|
|
16853
|
+
allowReorder ? /* @__PURE__ */ jsx(DndProvider, {
|
|
16854
16854
|
backend: HTML5Backend,
|
|
16855
16855
|
debugMode: true,
|
|
16856
16856
|
children: data.map((entry, i) => {
|
|
@@ -16879,7 +16879,32 @@ function Table({ noDataClasses = baseClasses$2.noDataClasses, wrapperClasses = b
|
|
|
16879
16879
|
detailsRow
|
|
16880
16880
|
}, i);
|
|
16881
16881
|
})
|
|
16882
|
-
}),
|
|
16882
|
+
}) : /* @__PURE__ */ jsx(Fragment$1, { children: data.map((entry, i) => {
|
|
16883
|
+
return /* @__PURE__ */ jsx(Row, {
|
|
16884
|
+
index: i,
|
|
16885
|
+
name,
|
|
16886
|
+
entry,
|
|
16887
|
+
allowReorder,
|
|
16888
|
+
onDragRow,
|
|
16889
|
+
onDropRow,
|
|
16890
|
+
currentColumnsCenter,
|
|
16891
|
+
currentColumnsLeft,
|
|
16892
|
+
currentColumnsRight,
|
|
16893
|
+
cellRenderer,
|
|
16894
|
+
header,
|
|
16895
|
+
onRowClick,
|
|
16896
|
+
onRowDoubleClick,
|
|
16897
|
+
rowClasses,
|
|
16898
|
+
rowLeftWrapperClasses,
|
|
16899
|
+
rowCenterWrapperClasses,
|
|
16900
|
+
rowRightWrapperClasses,
|
|
16901
|
+
subRowClasses,
|
|
16902
|
+
subRowLeftWrapperClasses,
|
|
16903
|
+
subRowCenterWrapperClasses,
|
|
16904
|
+
subRowRightWrapperClasses,
|
|
16905
|
+
detailsRow
|
|
16906
|
+
}, i);
|
|
16907
|
+
}) }),
|
|
16883
16908
|
data.length === 0 && /* @__PURE__ */ jsx("div", {
|
|
16884
16909
|
"data-testid": name + "-table-no-data",
|
|
16885
16910
|
className: noDataClasses,
|
|
@@ -16918,7 +16943,7 @@ function Row({ index, entry, onDragRow, onDropRow, onRowClick, onRowDoubleClick,
|
|
|
16918
16943
|
const previewRef = useRef(null);
|
|
16919
16944
|
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
16920
16945
|
if (allowReorder && !Object.prototype.hasOwnProperty.call(entry, "index")) throw new Error("Entry must have index property");
|
|
16921
|
-
const [{ handlerId }, drop] = useDrop({
|
|
16946
|
+
const [{ handlerId }, drop] = allowReorder ? useDrop({
|
|
16922
16947
|
accept: "row",
|
|
16923
16948
|
collect(monitor) {
|
|
16924
16949
|
return { handlerId: monitor.getHandlerId() };
|
|
@@ -16936,8 +16961,8 @@ function Row({ index, entry, onDragRow, onDropRow, onRowClick, onRowDoubleClick,
|
|
|
16936
16961
|
onDragRow(dragIndex, hoverIndex);
|
|
16937
16962
|
item.index = hoverIndex;
|
|
16938
16963
|
}
|
|
16939
|
-
});
|
|
16940
|
-
const [{ opacity }, drag, preview] = useDrag({
|
|
16964
|
+
}) : [{ handlerId: null }, () => void 0];
|
|
16965
|
+
const [{ opacity }, drag, preview] = allowReorder ? useDrag({
|
|
16941
16966
|
type: "row",
|
|
16942
16967
|
end: (item, monitor) => {
|
|
16943
16968
|
if (!monitor.didDrop()) return;
|
|
@@ -16951,9 +16976,14 @@ function Row({ index, entry, onDragRow, onDropRow, onRowClick, onRowDoubleClick,
|
|
|
16951
16976
|
};
|
|
16952
16977
|
},
|
|
16953
16978
|
collect: (monitor) => ({ opacity: monitor.isDragging() ? .4 : 1 })
|
|
16954
|
-
})
|
|
16979
|
+
}) : [
|
|
16980
|
+
{ opacity: 1 },
|
|
16981
|
+
() => void 0,
|
|
16982
|
+
() => void 0
|
|
16983
|
+
];
|
|
16955
16984
|
if (allowReorder) {
|
|
16956
|
-
|
|
16985
|
+
const dropResult = drop(previewRef);
|
|
16986
|
+
if (dropResult) preview(dropResult);
|
|
16957
16987
|
drag(dragRef);
|
|
16958
16988
|
}
|
|
16959
16989
|
return /* @__PURE__ */ jsxs("div", {
|