arengibook 2.0.18-table → 2.0.20-table
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 +30 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47549,7 +47549,9 @@ var TreeSelectBodyCell = function TreeSelectBodyCell(_ref6) {
|
|
|
47549
47549
|
var DocumentEditorCell = function DocumentEditorCell(_ref7) {
|
|
47550
47550
|
var _options$value;
|
|
47551
47551
|
var options = _ref7.options,
|
|
47552
|
-
col = _ref7.col
|
|
47552
|
+
col = _ref7.col,
|
|
47553
|
+
onFilePickerOpen = _ref7.onFilePickerOpen,
|
|
47554
|
+
onFilePickerClose = _ref7.onFilePickerClose;
|
|
47553
47555
|
var _useState13 = useState(false),
|
|
47554
47556
|
_useState14 = _slicedToArray$c(_useState13, 2),
|
|
47555
47557
|
uploading = _useState14[0],
|
|
@@ -47615,6 +47617,16 @@ var DocumentEditorCell = function DocumentEditorCell(_ref7) {
|
|
|
47615
47617
|
return _ref8.apply(this, arguments);
|
|
47616
47618
|
};
|
|
47617
47619
|
}();
|
|
47620
|
+
var handlePickerClick = function handlePickerClick() {
|
|
47621
|
+
var _fileInputRef$current;
|
|
47622
|
+
onFilePickerOpen === null || onFilePickerOpen === void 0 || onFilePickerOpen();
|
|
47623
|
+
var _onFocus = function onFocus() {
|
|
47624
|
+
onFilePickerClose === null || onFilePickerClose === void 0 || onFilePickerClose();
|
|
47625
|
+
window.removeEventListener('focus', _onFocus);
|
|
47626
|
+
};
|
|
47627
|
+
window.addEventListener('focus', _onFocus);
|
|
47628
|
+
(_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 || _fileInputRef$current.click();
|
|
47629
|
+
};
|
|
47618
47630
|
var handleDelete = function handleDelete(id) {
|
|
47619
47631
|
options.editorCallback(docs.filter(function (d) {
|
|
47620
47632
|
return d.id !== id;
|
|
@@ -47644,10 +47656,7 @@ var DocumentEditorCell = function DocumentEditorCell(_ref7) {
|
|
|
47644
47656
|
}))), /*#__PURE__*/React__default.createElement("button", {
|
|
47645
47657
|
type: "button",
|
|
47646
47658
|
className: "p-button p-button-outlined p-button-sm doc-editor-add",
|
|
47647
|
-
onClick:
|
|
47648
|
-
var _fileInputRef$current;
|
|
47649
|
-
return (_fileInputRef$current = fileInputRef.current) === null || _fileInputRef$current === void 0 ? void 0 : _fileInputRef$current.click();
|
|
47650
|
-
},
|
|
47659
|
+
onClick: handlePickerClick,
|
|
47651
47660
|
disabled: uploading
|
|
47652
47661
|
}, /*#__PURE__*/React__default.createElement("i", {
|
|
47653
47662
|
className: uploading ? 'pi pi-spin pi-spinner' : 'pi pi-plus'
|
|
@@ -47830,6 +47839,7 @@ var DocumentBodyCell = function DocumentBodyCell(_ref0) {
|
|
|
47830
47839
|
docs = _useState22[0],
|
|
47831
47840
|
setDocs = _useState22[1];
|
|
47832
47841
|
var containerRef = useRef(null);
|
|
47842
|
+
var filePickerOpenRef = useRef(false);
|
|
47833
47843
|
useEffect(function () {
|
|
47834
47844
|
if (isRowEditing && !editing) {
|
|
47835
47845
|
var _rowData$col$field3;
|
|
@@ -47843,6 +47853,7 @@ var DocumentBodyCell = function DocumentBodyCell(_ref0) {
|
|
|
47843
47853
|
useEffect(function () {
|
|
47844
47854
|
if (!editing || isRowEditing) return;
|
|
47845
47855
|
var handler = function handler(e) {
|
|
47856
|
+
if (filePickerOpenRef.current) return;
|
|
47846
47857
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
47847
47858
|
setEditing(false);
|
|
47848
47859
|
}
|
|
@@ -47864,7 +47875,13 @@ var DocumentBodyCell = function DocumentBodyCell(_ref0) {
|
|
|
47864
47875
|
value: docs,
|
|
47865
47876
|
editorCallback: handleCallback
|
|
47866
47877
|
},
|
|
47867
|
-
col: col
|
|
47878
|
+
col: col,
|
|
47879
|
+
onFilePickerOpen: function onFilePickerOpen() {
|
|
47880
|
+
filePickerOpenRef.current = true;
|
|
47881
|
+
},
|
|
47882
|
+
onFilePickerClose: function onFilePickerClose() {
|
|
47883
|
+
filePickerOpenRef.current = false;
|
|
47884
|
+
}
|
|
47868
47885
|
}));
|
|
47869
47886
|
}
|
|
47870
47887
|
if (!docs.length) {
|
|
@@ -47933,6 +47950,10 @@ var Table = function Table(_ref1) {
|
|
|
47933
47950
|
_useState24 = _slicedToArray$c(_useState23, 2),
|
|
47934
47951
|
data = _useState24[0],
|
|
47935
47952
|
setData = _useState24[1];
|
|
47953
|
+
var onCellChangeRef = useRef(onCellChange);
|
|
47954
|
+
useEffect(function () {
|
|
47955
|
+
onCellChangeRef.current = onCellChange;
|
|
47956
|
+
}, [onCellChange]);
|
|
47936
47957
|
var updateRow = useCallback(function (rowId, field, newVal) {
|
|
47937
47958
|
setData(function (prev) {
|
|
47938
47959
|
var updated = prev.map(function (row) {
|
|
@@ -48343,7 +48364,7 @@ var Table = function Table(_ref1) {
|
|
|
48343
48364
|
}
|
|
48344
48365
|
}, [editable, rowEdit, textEditor, dateEditor, selectEditor, selectMultipleEditor, numericEditor, documentEditor, deviseEditor, treeSelectEditor]);
|
|
48345
48366
|
var onCellEditComplete = useCallback(function (e) {
|
|
48346
|
-
|
|
48367
|
+
var _onCellChangeRef$curr;
|
|
48347
48368
|
var rowData = e.rowData,
|
|
48348
48369
|
newRowData = e.newRowData,
|
|
48349
48370
|
field = e.field;
|
|
@@ -48357,12 +48378,12 @@ var Table = function Table(_ref1) {
|
|
|
48357
48378
|
});
|
|
48358
48379
|
setData(updated);
|
|
48359
48380
|
onChange === null || onChange === void 0 || onChange(updated);
|
|
48360
|
-
|
|
48381
|
+
(_onCellChangeRef$curr = onCellChangeRef.current) === null || _onCellChangeRef$curr === void 0 || _onCellChangeRef$curr.call(onCellChangeRef, {
|
|
48361
48382
|
rowData: rowData,
|
|
48362
48383
|
field: field,
|
|
48363
48384
|
newValue: newRowData[field]
|
|
48364
48385
|
});
|
|
48365
|
-
}, [data, onChange,
|
|
48386
|
+
}, [data, onChange, columns]);
|
|
48366
48387
|
|
|
48367
48388
|
/** Get the body renderer for a column based on its type */
|
|
48368
48389
|
var getBodyTemplate = useCallback(function (col) {
|