@insticc/react-datagrid-2 1.0.6 → 1.0.7
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/build/index.js +11 -111
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -79,6 +79,16 @@ var DataGrid = function DataGrid(_ref) {
|
|
|
79
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
80
80
|
rowSelection = _useState2[0],
|
|
81
81
|
setRowSelection = _useState2[1];
|
|
82
|
+
var _useState3 = (0, _react.useState)(true),
|
|
83
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
84
|
+
isLoading = _useState4[0],
|
|
85
|
+
setIsLoading = _useState4[1];
|
|
86
|
+
var _useState5 = (0, _react.useState)([]),
|
|
87
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
88
|
+
sorting = _useState6[0],
|
|
89
|
+
setSorting = _useState6[1];
|
|
90
|
+
//optionally access the underlying virtualizer instance
|
|
91
|
+
var rowVirtualizerInstanceRef = (0, _react.useRef)(null);
|
|
82
92
|
|
|
83
93
|
// get the selected rows (if is a int that means that the row is selected if is a double that means that is a subrow)
|
|
84
94
|
// so if is a subrow we need to go to the parent row and get the id that is on the position after the .
|
|
@@ -118,17 +128,6 @@ var DataGrid = function DataGrid(_ref) {
|
|
|
118
128
|
}));
|
|
119
129
|
}
|
|
120
130
|
}, [rowSelection]);
|
|
121
|
-
|
|
122
|
-
//optionally access the underlying virtualizer instance
|
|
123
|
-
var rowVirtualizerInstanceRef = (0, _react.useRef)(null);
|
|
124
|
-
var _useState3 = (0, _react.useState)(true),
|
|
125
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
126
|
-
isLoading = _useState4[0],
|
|
127
|
-
setIsLoading = _useState4[1];
|
|
128
|
-
var _useState5 = (0, _react.useState)([]),
|
|
129
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
130
|
-
sorting = _useState6[0],
|
|
131
|
-
setSorting = _useState6[1];
|
|
132
131
|
(0, _react.useEffect)(function () {
|
|
133
132
|
if (typeof window !== 'undefined') {
|
|
134
133
|
setIsLoading(false);
|
|
@@ -567,103 +566,4 @@ module.exports = {
|
|
|
567
566
|
// pagination: 'both',
|
|
568
567
|
// itemsPerPage: [10, 15, 20, 25],
|
|
569
568
|
// rowHeight: 60,
|
|
570
|
-
// };
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* [ DataGrid Example ]
|
|
574
|
-
import React from "react";
|
|
575
|
-
import { Icon } from "semantic-ui-react";
|
|
576
|
-
import DataGrid from "../../Components/DataGrid";
|
|
577
|
-
class DataGridExample extends React.Component {
|
|
578
|
-
constructor(props) {
|
|
579
|
-
super(props);
|
|
580
|
-
this.state = {};
|
|
581
|
-
}
|
|
582
|
-
// ... Omited code related to the data fetching
|
|
583
|
-
getActions = () => {
|
|
584
|
-
return [
|
|
585
|
-
{
|
|
586
|
-
name: "Edit",
|
|
587
|
-
onClick: this.editRow,
|
|
588
|
-
icon: <Icon name="edit"/>,
|
|
589
|
-
selectionMode: "multi",
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
name: "Delete",
|
|
593
|
-
onClick: this.deleteRow,
|
|
594
|
-
icon: require("../../images/trash.png"),
|
|
595
|
-
color: "red",
|
|
596
|
-
selectionMode: "single",
|
|
597
|
-
confirmMessage: "Are you sure you want to delete this row?",
|
|
598
|
-
},
|
|
599
|
-
]
|
|
600
|
-
}
|
|
601
|
-
createColumns = () => {
|
|
602
|
-
return [
|
|
603
|
-
{
|
|
604
|
-
accessorKey: 'id',
|
|
605
|
-
header: 'ID',
|
|
606
|
-
size: 350,
|
|
607
|
-
enableClickToCopy: true,
|
|
608
|
-
Cell: ({ renderedCellValue }) => (
|
|
609
|
-
<span>
|
|
610
|
-
<Icon name="copy outline"/> {renderedCellValue}
|
|
611
|
-
</span>
|
|
612
|
-
),
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
accessorKey: 'name',
|
|
616
|
-
header: 'Name',
|
|
617
|
-
size: 400,
|
|
618
|
-
filterFn: 'regex',
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
accessorKey: 'description',
|
|
622
|
-
header: 'Description',
|
|
623
|
-
enableResizing: false,
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
accessorKey: 'type',
|
|
627
|
-
header: 'Type',
|
|
628
|
-
enableColumnFilterModes: false,
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
accessorFn: (row) => `${row.senderContext} ${row.role} (${row.contextType})`,
|
|
632
|
-
header: 'Sender',
|
|
633
|
-
size: 300,
|
|
634
|
-
},
|
|
635
|
-
]
|
|
636
|
-
}
|
|
637
|
-
getRows = () => {
|
|
638
|
-
const rows = this.props.data.map((rule) => {
|
|
639
|
-
return {
|
|
640
|
-
id: rule.idRule,
|
|
641
|
-
name: rule.name,
|
|
642
|
-
description: rule.description || 'N/A',
|
|
643
|
-
type: rule.RuleType.name,
|
|
644
|
-
senderContext: rule.Sender.context || '',
|
|
645
|
-
role: rule.Sender.role,
|
|
646
|
-
contextType: rule.ContextType.name,
|
|
647
|
-
context: rule.context,
|
|
648
|
-
conditions: rule.Conditions || [],
|
|
649
|
-
addressee: rule.addressee || '',
|
|
650
|
-
contact: rule.contactProperty || '',
|
|
651
|
-
createdAt: rule.createdAt || '',
|
|
652
|
-
}
|
|
653
|
-
})
|
|
654
|
-
return rows;
|
|
655
|
-
}
|
|
656
|
-
render() {
|
|
657
|
-
return (
|
|
658
|
-
<DataGrid
|
|
659
|
-
createRows={this.getRows()}
|
|
660
|
-
columns={this.createColumns()}
|
|
661
|
-
actions={this.getActions()}
|
|
662
|
-
rowHeight=90
|
|
663
|
-
hasExcelExport={true}
|
|
664
|
-
excelOption="all"
|
|
665
|
-
/>
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
*/
|
|
569
|
+
// };
|