arengibook 3.1.27-main → 3.1.28-main
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 +43 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55730,8 +55730,10 @@ var Table$1 = function Table(_ref13) {
|
|
|
55730
55730
|
onCellChange = _ref13.onCellChange,
|
|
55731
55731
|
tableId = _ref13.tableId,
|
|
55732
55732
|
onAdd = _ref13.onAdd,
|
|
55733
|
+
_ref13$showAdd = _ref13.showAdd,
|
|
55734
|
+
showAdd = _ref13$showAdd === void 0 ? true : _ref13$showAdd,
|
|
55733
55735
|
_ref13$addLabel = _ref13.addLabel,
|
|
55734
|
-
addLabel = _ref13$addLabel === void 0 ? '
|
|
55736
|
+
addLabel = _ref13$addLabel === void 0 ? '+' : _ref13$addLabel,
|
|
55735
55737
|
onDeleteRow = _ref13.onDeleteRow,
|
|
55736
55738
|
_ref13$rowSelection = _ref13.rowSelection,
|
|
55737
55739
|
rowSelection = _ref13$rowSelection === void 0 ? false : _ref13$rowSelection,
|
|
@@ -55788,6 +55790,29 @@ var Table$1 = function Table(_ref13) {
|
|
|
55788
55790
|
return updated;
|
|
55789
55791
|
});
|
|
55790
55792
|
}, [onChange]);
|
|
55793
|
+
var handleAddRow = useCallback(function () {
|
|
55794
|
+
// id temporaire négatif pour éviter les collisions avec les id BDD positifs
|
|
55795
|
+
var newRow = {
|
|
55796
|
+
id: -Date.now()
|
|
55797
|
+
};
|
|
55798
|
+
columns.forEach(function (col) {
|
|
55799
|
+
switch (col.type) {
|
|
55800
|
+
case 'selectMultiple':
|
|
55801
|
+
case 'badges':
|
|
55802
|
+
case 'documents':
|
|
55803
|
+
newRow[col.field] = [];
|
|
55804
|
+
break;
|
|
55805
|
+
default:
|
|
55806
|
+
newRow[col.field] = null;
|
|
55807
|
+
}
|
|
55808
|
+
});
|
|
55809
|
+
setData(function (prev) {
|
|
55810
|
+
var updated = [newRow].concat(_toConsumableArray$a(prev));
|
|
55811
|
+
onChange === null || onChange === void 0 || onChange(updated);
|
|
55812
|
+
onAdd === null || onAdd === void 0 || onAdd(newRow, updated);
|
|
55813
|
+
return updated;
|
|
55814
|
+
});
|
|
55815
|
+
}, [columns, onChange, onAdd]);
|
|
55791
55816
|
var _useState37 = useState({}),
|
|
55792
55817
|
_useState38 = _slicedToArray$d(_useState37, 2),
|
|
55793
55818
|
editingRows = _useState38[0],
|
|
@@ -57071,7 +57096,18 @@ var Table$1 = function Table(_ref13) {
|
|
|
57071
57096
|
alignItems: 'center',
|
|
57072
57097
|
gap: '0.5rem'
|
|
57073
57098
|
}
|
|
57074
|
-
},
|
|
57099
|
+
}, showAdd === true && /*#__PURE__*/React__default.createElement("button", {
|
|
57100
|
+
type: "button",
|
|
57101
|
+
className: "p-button p-component p-button-outlined p-button-sm",
|
|
57102
|
+
onClick: handleAddRow,
|
|
57103
|
+
"aria-label": addLabel,
|
|
57104
|
+
title: addLabel
|
|
57105
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
57106
|
+
style: {
|
|
57107
|
+
fontWeight: 'bold',
|
|
57108
|
+
fontSize: '12px'
|
|
57109
|
+
}
|
|
57110
|
+
}, addLabel)), lockable && /*#__PURE__*/React__default.createElement("button", {
|
|
57075
57111
|
type: "button",
|
|
57076
57112
|
className: "p-button p-component p-button-outlined p-button-sm",
|
|
57077
57113
|
onClick: function onClick() {
|
|
@@ -57325,22 +57361,7 @@ var Table$1 = function Table(_ref13) {
|
|
|
57325
57361
|
height: "calc(100vh - ".concat(headerH, "px)")
|
|
57326
57362
|
};
|
|
57327
57363
|
}() : undefined
|
|
57328
|
-
},
|
|
57329
|
-
style: {
|
|
57330
|
-
display: 'flex',
|
|
57331
|
-
justifyContent: 'flex-end',
|
|
57332
|
-
padding: '0 0 8px 0'
|
|
57333
|
-
}
|
|
57334
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
57335
|
-
className: "btn btn-add",
|
|
57336
|
-
onClick: onAdd,
|
|
57337
|
-
style: {
|
|
57338
|
-
border: '2px solid #1E976A',
|
|
57339
|
-
color: '#1E976A',
|
|
57340
|
-
padding: '5px 12px',
|
|
57341
|
-
cursor: 'pointer'
|
|
57342
|
-
}
|
|
57343
|
-
}, addLabel)), /*#__PURE__*/React__default.createElement(DataTable, {
|
|
57364
|
+
}, /*#__PURE__*/React__default.createElement(DataTable, {
|
|
57344
57365
|
key: tableKey,
|
|
57345
57366
|
value: data,
|
|
57346
57367
|
header: header,
|
|
@@ -58220,7 +58241,10 @@ var TablePresets = {
|
|
|
58220
58241
|
value: dataTyped,
|
|
58221
58242
|
columns: columnsTyped,
|
|
58222
58243
|
editable: true,
|
|
58223
|
-
tableId: 'table-presets-demo'
|
|
58244
|
+
tableId: 'table-presets-demo',
|
|
58245
|
+
onAdd: function onAdd(row, updated) {
|
|
58246
|
+
console.log(row.id);
|
|
58247
|
+
}
|
|
58224
58248
|
}
|
|
58225
58249
|
};
|
|
58226
58250
|
|