@oliasoft-open-source/react-ui-library 3.2.0 → 3.3.0-beta-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/dist/index.js +37 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35952,7 +35952,10 @@ const Table = (props) => {
|
|
|
35952
35952
|
stickyHeaders,
|
|
35953
35953
|
striped: striped2 = true,
|
|
35954
35954
|
testId,
|
|
35955
|
-
draggable: draggable2
|
|
35955
|
+
draggable: draggable2,
|
|
35956
|
+
hasAutoEmptyRow = false,
|
|
35957
|
+
onChangeAutoEmptyRow = () => {
|
|
35958
|
+
}
|
|
35956
35959
|
} = table2;
|
|
35957
35960
|
const targetRef = useRef();
|
|
35958
35961
|
const [dimensions, setDimensions] = useState({
|
|
@@ -35972,6 +35975,34 @@ const Table = (props) => {
|
|
|
35972
35975
|
const rowActions = hasRowActions(rows, headers);
|
|
35973
35976
|
const colSpan = columnCount + (rowActions ? 1 : 0);
|
|
35974
35977
|
const [rowsMetaData, setRowsMetaData] = useState([]);
|
|
35978
|
+
const allRows = rows;
|
|
35979
|
+
if (hasAutoEmptyRow) {
|
|
35980
|
+
const lastRowCells = rows[rows.length - 1].cells;
|
|
35981
|
+
const newEmptyRowIndex = rows.length;
|
|
35982
|
+
const newEmptyCells = lastRowCells.map((cell, i) => {
|
|
35983
|
+
if (cell.type === "Input") {
|
|
35984
|
+
return {
|
|
35985
|
+
...cell,
|
|
35986
|
+
value: "",
|
|
35987
|
+
onChange: (evt) => onChangeAutoEmptyRow(evt, newEmptyRowIndex, i),
|
|
35988
|
+
error: void 0,
|
|
35989
|
+
disabled: i === 0 ? false : cell.disabled
|
|
35990
|
+
};
|
|
35991
|
+
}
|
|
35992
|
+
return {
|
|
35993
|
+
...cell,
|
|
35994
|
+
value: "",
|
|
35995
|
+
error: void 0,
|
|
35996
|
+
warning: void 0,
|
|
35997
|
+
disabled: true
|
|
35998
|
+
};
|
|
35999
|
+
});
|
|
36000
|
+
const newEmptyRow = {
|
|
36001
|
+
cells: newEmptyCells,
|
|
36002
|
+
testId: testId && `${testId}-last-empty-row`
|
|
36003
|
+
};
|
|
36004
|
+
allRows.push(newEmptyRow);
|
|
36005
|
+
}
|
|
35975
36006
|
return draggable2 ? /* @__PURE__ */ jsx("div", {
|
|
35976
36007
|
ref: targetRef,
|
|
35977
36008
|
children: /* @__PURE__ */ jsx(DragDropContext, {
|
|
@@ -36022,7 +36053,7 @@ const Table = (props) => {
|
|
|
36022
36053
|
}, `0_${rowIndex}`);
|
|
36023
36054
|
})]
|
|
36024
36055
|
}), /* @__PURE__ */ jsxs("tbody", {
|
|
36025
|
-
children: [
|
|
36056
|
+
children: [allRows.slice(0, visibleRows).map((row2, rowIndex) => /* @__PURE__ */ jsx(PublicDraggable, {
|
|
36026
36057
|
draggableId: rowIndex + "",
|
|
36027
36058
|
index: rowIndex,
|
|
36028
36059
|
isDragDisabled: row2.noDrag,
|
|
@@ -36084,7 +36115,7 @@ const Table = (props) => {
|
|
|
36084
36115
|
}, `0_${rowIndex}`);
|
|
36085
36116
|
})]
|
|
36086
36117
|
}), /* @__PURE__ */ jsx("tbody", {
|
|
36087
|
-
children:
|
|
36118
|
+
children: allRows.slice(0, visibleRows).map((row2, rowIndex) => /* @__PURE__ */ jsx(Row, {
|
|
36088
36119
|
rowIndex,
|
|
36089
36120
|
row: row2,
|
|
36090
36121
|
columnCount,
|
|
@@ -36129,7 +36160,9 @@ Table.propTypes = {
|
|
|
36129
36160
|
}),
|
|
36130
36161
|
bordered: propTypes$1.exports.bool,
|
|
36131
36162
|
striped: propTypes$1.exports.bool,
|
|
36132
|
-
testId: propTypes$1.exports.string
|
|
36163
|
+
testId: propTypes$1.exports.string,
|
|
36164
|
+
hasLastEmptyRow: propTypes$1.exports.bool,
|
|
36165
|
+
handleLastEmptyRow: propTypes$1.exports.func
|
|
36133
36166
|
}).isRequired,
|
|
36134
36167
|
onListReorder: propTypes$1.exports.func
|
|
36135
36168
|
};
|