@insticc/react-datagrid-2 1.1.11 → 1.1.12

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.
@@ -0,0 +1,31 @@
1
+ .clearFilter {
2
+ background-color: #ffb66c;
3
+ cursor: pointer;
4
+ display: flex;
5
+ align-items: center;
6
+ padding: 5px;
7
+ border-radius: .28571429rem;
8
+ transition: opacity 0.2s ease;
9
+ /* box-shadow: 0 0 0 1px rgb(253, 175, 27); */
10
+ }
11
+
12
+ .clearFilter:hover {
13
+ background-color: #ff8c18;
14
+ /* box-shadow: 0 0 0 1px rgb(206, 145, 0); */
15
+ }
16
+
17
+ .fixed-position {
18
+ position: fixed !important;
19
+ z-Index: 99 !important;
20
+ width: calc(100% - 50px) !important;
21
+ background-color: white !important;
22
+ top: 0 !important;
23
+ }
24
+
25
+ .fixed-actions {
26
+ position: fixed !important;
27
+ z-Index: 99 !important;
28
+ width: calc(100% - 50px) !important;
29
+ background-color: white !important;
30
+ top: 70px !important;
31
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _semanticUiReact = require("semantic-ui-react");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ var GridHelper = function GridHelper(_ref) {
11
+ var open = _ref.open,
12
+ content = _ref.content,
13
+ onClose = _ref.onClose,
14
+ title = _ref.title;
15
+ return /*#__PURE__*/_react["default"].createElement(_semanticUiReact.Modal, {
16
+ open: open,
17
+ centered: true,
18
+ style: {
19
+ top: 'auto',
20
+ right: 'auto',
21
+ left: 'auto',
22
+ bottom: 'auto',
23
+ height: 'fit-content'
24
+ }
25
+ }, /*#__PURE__*/_react["default"].createElement(_semanticUiReact.Modal.Header, null, title), /*#__PURE__*/_react["default"].createElement(_semanticUiReact.Modal.Content, null, content), /*#__PURE__*/_react["default"].createElement(_semanticUiReact.Modal.Actions, null, /*#__PURE__*/_react["default"].createElement(_semanticUiReact.Button, {
26
+ primary: true,
27
+ onClick: onClose
28
+ }, "Close")));
29
+ };
30
+ var _default = exports["default"] = GridHelper;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.regexFilterTooltip = exports.logicalFilterTooltip = exports.logicalFilter = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _semanticUiReact = require("semantic-ui-react");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ var logicalFilter = exports.logicalFilter = function logicalFilter(row, id, filterValue) {
11
+ var rowValue = row.getValue(id).toLowerCase();
12
+ var contains = function contains(value, term) {
13
+ return value.includes(term.toLowerCase());
14
+ };
15
+ var parseFilter = function parseFilter(filter) {
16
+ var regex = /(\w+|\&\&|\|\||\~)/g;
17
+ return filter.match(regex);
18
+ };
19
+ var analyseParts = function analyseParts(parts) {
20
+ var result = null;
21
+ var currentOperator = null;
22
+ if (parts.includes('&&') || parts.includes('||') || parts.includes('~')) {
23
+ parts.forEach(function (p) {
24
+ if (p === '&&' || p === '||' || p === '~') {
25
+ currentOperator = p;
26
+ } else {
27
+ if (currentOperator === '&&') {
28
+ result = result && contains(rowValue, p);
29
+ currentOperator = null;
30
+ } else if (currentOperator === '||') {
31
+ result = result || contains(rowValue, p);
32
+ currentOperator = null;
33
+ } else if (currentOperator === '~') {
34
+ result = result ? result && !contains(rowValue, p) : !contains(rowValue, p);
35
+ currentOperator = null;
36
+ } else {
37
+ result = contains(rowValue, p);
38
+ }
39
+ }
40
+ });
41
+ } else {
42
+ result = rowValue.includes(filterValue.toLowerCase());
43
+ }
44
+ return result;
45
+ };
46
+ var parts = parseFilter(filterValue);
47
+ if (!parts) return false;
48
+ return analyseParts(parts);
49
+ };
50
+ var logicalFilterTooltip = exports.logicalFilterTooltip = /*#__PURE__*/_react["default"].createElement("div", {
51
+ style: {
52
+ display: 'flex',
53
+ flexDirection: 'column',
54
+ textAlign: 'start'
55
+ }
56
+ }, "This filter admits logical operators such as:", /*#__PURE__*/_react["default"].createElement("ul", null, /*#__PURE__*/_react["default"].createElement("li", null, "'&&' (AND) "), /*#__PURE__*/_react["default"].createElement("li", null, "'||' (OR) "), /*#__PURE__*/_react["default"].createElement("li", null, "'~' (NOT) ")), /*#__PURE__*/_react["default"].createElement("br", null), "These operators can be combined.", /*#__PURE__*/_react["default"].createElement("br", null), "For example, 'John Doe && Smith || James' will return rows that have both 'John Doe' and 'Smith', or 'James'.");
57
+ var regexFilterTooltip = exports.regexFilterTooltip = /*#__PURE__*/_react["default"].createElement("div", {
58
+ style: {
59
+ display: 'flex',
60
+ flexDirection: 'column',
61
+ textAlign: 'start'
62
+ }
63
+ }, "This filter enables the use of regular expression to search for patterns in the row data.", /*#__PURE__*/_react["default"].createElement("br", null), "For example, '^[A-Z]' will find entries that start with a capital letter.");
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = gridFixedHeader;
7
+ /**
8
+ * Makes a MUI-DataGrid header – and optionally its toolbar – stick to the top
9
+ * once the page is scrolled past a given point.
10
+ *
11
+ * @param {string|null} referenceDiv – id of a wrapper element whose top edge defines the sticky offset.
12
+ * @param {boolean} fixedGridActions – if true, also pin the toolbar (class "Mui-ToolbarDropZone").
13
+ *
14
+ * @returns {Function} cleanup – call if you need to remove the scroll listener.
15
+ */
16
+ function gridFixedHeader(referenceDiv) {
17
+ var fixedGridActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
18
+ var cssClassName = 'fixed-position';
19
+ var gridHeaderRowClassName = 'grid-sticky-header';
20
+ var cssActionsClassName = 'fixed-actions';
21
+ var gridToolbarClassName = 'grid-sticky-actions';
22
+ var handleScroll = function handleScroll() {
23
+ var _refEl$getBoundingCli;
24
+ var refEl = referenceDiv ? document.getElementById(referenceDiv) : null;
25
+ var headerEl = (refEl !== null && refEl !== void 0 ? refEl : document).getElementsByClassName(gridHeaderRowClassName)[0];
26
+ var toolbarEl = fixedGridActions ? (refEl !== null && refEl !== void 0 ? refEl : document).getElementsByClassName(gridToolbarClassName)[0] : null;
27
+ if (!headerEl) return;
28
+ var offset = referenceDiv ? window.scrollY + ((_refEl$getBoundingCli = refEl === null || refEl === void 0 ? void 0 : refEl.getBoundingClientRect().top) !== null && _refEl$getBoundingCli !== void 0 ? _refEl$getBoundingCli : 0) : 270;
29
+ if (window.scrollY > offset) {
30
+ headerEl.classList.add(cssClassName);
31
+ toolbarEl === null || toolbarEl === void 0 || toolbarEl.classList.add(cssActionsClassName);
32
+ var spacer = ((toolbarEl === null || toolbarEl === void 0 ? void 0 : toolbarEl.offsetHeight) || 0) + ((headerEl === null || headerEl === void 0 ? void 0 : headerEl.offsetHeight) || 0);
33
+ (refEl !== null && refEl !== void 0 ? refEl : document.body).style.paddingTop = "".concat(spacer, "px");
34
+ } else {
35
+ headerEl.classList.remove(cssClassName);
36
+ toolbarEl === null || toolbarEl === void 0 || toolbarEl.classList.remove(cssActionsClassName);
37
+ (refEl !== null && refEl !== void 0 ? refEl : document.body).style.paddingTop = '';
38
+ }
39
+ };
40
+ window.addEventListener('scroll', handleScroll, {
41
+ passive: true
42
+ });
43
+ handleScroll();
44
+ return function () {
45
+ return window.removeEventListener('scroll', handleScroll);
46
+ };
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insticc/react-datagrid-2",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -35,6 +35,7 @@
35
35
  "@mui/styled-engine-sc": "^6.0.0-alpha.18",
36
36
  "@mui/x-data-grid": "^7.1.0",
37
37
  "@mui/x-date-pickers": "^7.1.0",
38
+ "babel": "^6.23.0",
38
39
  "bootstrap": "^5.3.3",
39
40
  "date-fns": "^2.29.3",
40
41
  "jspdf": "^2.5.1",