@digigov/ui 0.24.0 → 0.24.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/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Change Log - @digigov/ui
2
2
 
3
- This log was last generated on Wed, 03 Aug 2022 10:06:10 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 03 Aug 2022 12:52:06 GMT and should not be manually modified.
4
+
5
+ ## 0.24.1
6
+ Wed, 03 Aug 2022 12:52:06 GMT
7
+
8
+ ### Patches
9
+
10
+ - Fix Dropdown styles when a floating Table scrolls left or right
4
11
 
5
12
  ## 0.24.0
6
13
  Wed, 03 Aug 2022 10:06:10 GMT
@@ -76,19 +76,30 @@ var Dropdown = function Dropdown(_ref) {
76
76
  }
77
77
 
78
78
  var toggleFloat = function toggleFloat() {
79
+ var _innerRef$current;
80
+
81
+ var tbody = innerRef.current.closest('tbody');
82
+ var parentElement = (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.parentElement;
83
+
79
84
  if (innerRef.current.open) {
80
- var rect = innerRef.current.getBoundingClientRect();
81
- innerRef.current.style.position = 'static';
82
- var top = rect.top + window.pageYOffset;
85
+ tbody.style.position = 'static';
86
+ var rect = parentElement.getBoundingClientRect();
87
+ innerRef.current.style.position = 'static'; // arbitrary spacing of 12 pixels because CSS
88
+
89
+ var top = rect.top + window.pageYOffset + 12;
83
90
  var left = rect.left + window.pageXOffset;
84
- innerRef.current.style.top = "".concat(top, "px");
85
- innerRef.current.style.left = "".concat(left, "px");
86
- innerRef.current.style.position = "absolute";
87
- innerRef.current.style.display = "block";
91
+ parentElement.style.top = "".concat(top, "px");
92
+ parentElement.style.left = "".concat(left, "px");
93
+ parentElement.style.position = "absolute";
94
+ parentElement.style.display = "block";
95
+ parentElement.style.background = 'white';
88
96
  } else {
89
- innerRef.current.style.top = "0";
90
- innerRef.current.style.left = "0";
91
- innerRef.current.style.position = "relative";
97
+ tbody.style.position = 'relative';
98
+ parentElement.style.top = "0";
99
+ parentElement.style.left = "0";
100
+ parentElement.style.position = "relative";
101
+ parentElement.style.display = "table-cell";
102
+ parentElement.style.background = 'transparent';
92
103
  }
93
104
  };
94
105
 
@@ -16,3 +16,4 @@ export * from "./__stories__/WithLoader";
16
16
  export * from "./__stories__/DefinedWidth";
17
17
  export * from "./__stories__/Densed";
18
18
  export * from "./__stories__/MultipleProps";
19
+ export * from "./__stories__/WithFloatingScroll";
@@ -192,6 +192,20 @@ Object.keys(_MultipleProps).forEach(function (key) {
192
192
  });
193
193
  });
194
194
 
195
+ var _WithFloatingScroll = require("./__stories__/WithFloatingScroll");
196
+
197
+ Object.keys(_WithFloatingScroll).forEach(function (key) {
198
+ if (key === "default" || key === "__esModule") return;
199
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
200
+ if (key in exports && exports[key] === _WithFloatingScroll[key]) return;
201
+ Object.defineProperty(exports, key, {
202
+ enumerable: true,
203
+ get: function get() {
204
+ return _WithFloatingScroll[key];
205
+ }
206
+ });
207
+ });
208
+
195
209
  /* eslint-disable digigov/no-relative-imports */
196
210
  var _default = {
197
211
  title: 'Digigov UI/core/Table',
@@ -48,11 +48,13 @@ function TableFloatingScroll(props) {
48
48
  var elementOffset = contentRef.current.offsetTop + contentRef.current.offsetHeight;
49
49
 
50
50
  function onBodyScroll() {
51
- var currentScroll = window.pageYOffset + window.innerHeight; // @ts-ignore
51
+ var currentScroll = window.pageYOffset + window.innerHeight;
52
52
 
53
- if (currentScroll < elementOffset && currentScroll > contentRef.current.offsetTop) {
54
- setPosition('fixed'); // @ts-ignore
55
- } else if (currentScroll >= elementOffset || currentScroll <= contentRef.current.offsetTop) {
53
+ if (currentScroll < elementOffset && // @ts-ignore
54
+ currentScroll > contentRef.current.offsetTop) {
55
+ setPosition('fixed');
56
+ } else if (currentScroll >= elementOffset || // @ts-ignore
57
+ currentScroll <= contentRef.current.offsetTop) {
56
58
  setPosition('relative');
57
59
  }
58
60
  }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const WithFloatingScroll: () => JSX.Element;
3
+ export default WithFloatingScroll;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = exports.WithFloatingScroll = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _reactCore = require("@digigov/react-core");
13
+
14
+ var _admin = require("@digigov/ui/admin");
15
+
16
+ var _TableFloatingScroll = _interopRequireDefault(require("@digigov/ui/core/Table/TableFloatingScroll"));
17
+
18
+ var labels = {
19
+ name: 'Ονοματεπώνυμο',
20
+ email: 'Email',
21
+ phone: 'Τηλέφωνο',
22
+ role: 'Ρόλος',
23
+ status: 'Κατάσταση',
24
+ actions: 'Ενέργειες',
25
+ at: 'Αριθμός Ταυτότητας',
26
+ zip: 'Ταχυδρομικός Κώδικας',
27
+ address: 'Διεύθυνση',
28
+ city: 'Πόλη',
29
+ country: 'Χώρα',
30
+ active: 'Ενεργός',
31
+ last_login: 'Τελευταία Σύνδεση',
32
+ last_login_agent: 'Τελευταία Σύνδεση Αξεσουάρ',
33
+ last_login_ip: 'Τελευταία Σύνδεση IP',
34
+ afm: 'ΑΦΜ'
35
+ };
36
+ var data = new Array(20).fill({
37
+ name: 'Τάκης Τσούκαλος',
38
+ afm: '1111111114',
39
+ role: 'Χειριστής',
40
+ at: '1212121',
41
+ email: 'myhomeemail@gov.gr',
42
+ phone: '22222222',
43
+ address: 'Αγία Παρασκευής',
44
+ city: 'Αγία Παρασκευή',
45
+ country: 'Ελλάδα',
46
+ zip: '222233',
47
+ active: 'Ναι',
48
+ last_login: '12/12/12',
49
+ last_login_ip: '0.0.0.0',
50
+ last_login_agent: 'Firefox'
51
+ });
52
+
53
+ var _ref = /*#__PURE__*/_react["default"].createElement(_reactCore.TableHeadCell, null, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
54
+
55
+ var _ref2 = /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, null, /*#__PURE__*/_react["default"].createElement(_admin.Dropdown, {
56
+ "float": true,
57
+ align: "left",
58
+ placement: "bottom"
59
+ }, /*#__PURE__*/_react["default"].createElement(_admin.DropdownButton, {
60
+ variant: "link"
61
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2"), /*#__PURE__*/_react["default"].createElement(_admin.DropdownContent, null, /*#__PURE__*/_react["default"].createElement(_reactCore.NavVertical, null, /*#__PURE__*/_react["default"].createElement(_reactCore.NavVerticalItem, {
62
+ href: "#"
63
+ }, "Accept"), /*#__PURE__*/_react["default"].createElement(_reactCore.NavVerticalItem, {
64
+ href: "#"
65
+ }, "Dismiss")))));
66
+
67
+ var _ref3 = /*#__PURE__*/_react["default"].createElement(_reactCore.TableHeadCell, null, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
68
+
69
+ var _ref4 = /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, null, /*#__PURE__*/_react["default"].createElement(_admin.Dropdown, {
70
+ "float": true,
71
+ align: "left",
72
+ placement: "bottom"
73
+ }, /*#__PURE__*/_react["default"].createElement(_admin.DropdownButton, {
74
+ variant: "link"
75
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2"), /*#__PURE__*/_react["default"].createElement(_admin.DropdownContent, null, /*#__PURE__*/_react["default"].createElement(_reactCore.NavVertical, null, /*#__PURE__*/_react["default"].createElement(_reactCore.NavVerticalItem, {
76
+ href: "#"
77
+ }, "Accept"), /*#__PURE__*/_react["default"].createElement(_reactCore.NavVerticalItem, {
78
+ href: "#"
79
+ }, "Dismiss")))));
80
+
81
+ var WithFloatingScroll = function WithFloatingScroll() {
82
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_TableFloatingScroll["default"], null, /*#__PURE__*/_react["default"].createElement(_reactCore.Table, null, /*#__PURE__*/_react["default"].createElement(_reactCore.TableHead, null, /*#__PURE__*/_react["default"].createElement(_reactCore.TableRow, null, Object.keys(data[0]).map(function (key) {
83
+ return /*#__PURE__*/_react["default"].createElement(_reactCore.TableHeadCell, {
84
+ key: key
85
+ }, labels[key]);
86
+ }), _ref)), /*#__PURE__*/_react["default"].createElement(_reactCore.TableBody, null, data && data.map(function (dt, index) {
87
+ return /*#__PURE__*/_react["default"].createElement(_reactCore.TableRow, {
88
+ key: index
89
+ }, Object.keys(dt).map(function (key) {
90
+ return /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, {
91
+ key: key
92
+ }, dt[key]);
93
+ }), _ref2);
94
+ })))), /*#__PURE__*/_react["default"].createElement(_reactCore.Table, null, /*#__PURE__*/_react["default"].createElement(_reactCore.TableHead, null, /*#__PURE__*/_react["default"].createElement(_reactCore.TableRow, null, Object.keys(data[0]).map(function (key) {
95
+ return /*#__PURE__*/_react["default"].createElement(_reactCore.TableHeadCell, {
96
+ key: key
97
+ }, labels[key]);
98
+ }), _ref3)), /*#__PURE__*/_react["default"].createElement(_reactCore.TableBody, null, data && data.map(function (dt, index) {
99
+ return /*#__PURE__*/_react["default"].createElement(_reactCore.TableRow, {
100
+ key: index
101
+ }, Object.keys(dt).map(function (key) {
102
+ return /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, {
103
+ key: key
104
+ }, dt[key]);
105
+ }), _ref4);
106
+ }))));
107
+ };
108
+
109
+ exports.WithFloatingScroll = WithFloatingScroll;
110
+ var _default = WithFloatingScroll;
111
+ exports["default"] = _default;
@@ -85,7 +85,7 @@ var WithLoader = function WithLoader() {
85
85
 
86
86
  setTimeout(function () {
87
87
  setTableData(data);
88
- }, 8000);
88
+ }, 2000);
89
89
  return /*#__PURE__*/_react["default"].createElement("div", {
90
90
  className: "example"
91
91
  }, /*#__PURE__*/_react["default"].createElement(_reactCore.TableContainer, null, !tableData ? _ref : /*#__PURE__*/_react["default"].createElement(_reactCore.Table, null, _ref2, _ref3, /*#__PURE__*/_react["default"].createElement(_reactCore.TableBody, null, loading === true && _ref4, tableData && tableData.length > 0 ? tableData.map(function (d, index) {
@@ -94,12 +94,9 @@ var WithLoader = function WithLoader() {
94
94
  }, /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, null, d.name), /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, null, d.job), /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, null, d.year), /*#__PURE__*/_react["default"].createElement(_reactCore.TableDataCell, null, d.salary));
95
95
  }) : _ref5))), /*#__PURE__*/_react["default"].createElement(_reactCore.Button, {
96
96
  onClick: function onClick() {
97
- setLoading(true);
98
- /* setTimeout(() => {
99
- setLoading(false);
100
- }, 7000); */
97
+ setLoading(!loading);
101
98
  }
102
- }, "\u03A0\u03C1\u03BF\u03C3\u03B8\u03B7\u03BA\u03B7"));
99
+ }, "Toggle Loading"));
103
100
  };
104
101
 
105
102
  exports.WithLoader = WithLoader;
@@ -29,19 +29,30 @@ export var Dropdown = function Dropdown(_ref) {
29
29
  }
30
30
 
31
31
  var toggleFloat = function toggleFloat() {
32
+ var _innerRef$current;
33
+
34
+ var tbody = innerRef.current.closest('tbody');
35
+ var parentElement = (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.parentElement;
36
+
32
37
  if (innerRef.current.open) {
33
- var rect = innerRef.current.getBoundingClientRect();
34
- innerRef.current.style.position = 'static';
35
- var top = rect.top + window.pageYOffset;
38
+ tbody.style.position = 'static';
39
+ var rect = parentElement.getBoundingClientRect();
40
+ innerRef.current.style.position = 'static'; // arbitrary spacing of 12 pixels because CSS
41
+
42
+ var top = rect.top + window.pageYOffset + 12;
36
43
  var left = rect.left + window.pageXOffset;
37
- innerRef.current.style.top = "".concat(top, "px");
38
- innerRef.current.style.left = "".concat(left, "px");
39
- innerRef.current.style.position = "absolute";
40
- innerRef.current.style.display = "block";
44
+ parentElement.style.top = "".concat(top, "px");
45
+ parentElement.style.left = "".concat(left, "px");
46
+ parentElement.style.position = "absolute";
47
+ parentElement.style.display = "block";
48
+ parentElement.style.background = 'white';
41
49
  } else {
42
- innerRef.current.style.top = "0";
43
- innerRef.current.style.left = "0";
44
- innerRef.current.style.position = "relative";
50
+ tbody.style.position = 'relative';
51
+ parentElement.style.top = "0";
52
+ parentElement.style.left = "0";
53
+ parentElement.style.position = "relative";
54
+ parentElement.style.display = "table-cell";
55
+ parentElement.style.background = 'transparent';
45
56
  }
46
57
  };
47
58
 
@@ -16,4 +16,5 @@ export * from './__stories__/DarkVariantWithVerticalHeaders';
16
16
  export * from './__stories__/WithLoader';
17
17
  export * from './__stories__/DefinedWidth';
18
18
  export * from './__stories__/Densed';
19
- export * from './__stories__/MultipleProps';
19
+ export * from './__stories__/MultipleProps';
20
+ export * from './__stories__/WithFloatingScroll';
@@ -30,11 +30,13 @@ export function TableFloatingScroll(props) {
30
30
  var elementOffset = contentRef.current.offsetTop + contentRef.current.offsetHeight;
31
31
 
32
32
  function onBodyScroll() {
33
- var currentScroll = window.pageYOffset + window.innerHeight; // @ts-ignore
33
+ var currentScroll = window.pageYOffset + window.innerHeight;
34
34
 
35
- if (currentScroll < elementOffset && currentScroll > contentRef.current.offsetTop) {
36
- setPosition('fixed'); // @ts-ignore
37
- } else if (currentScroll >= elementOffset || currentScroll <= contentRef.current.offsetTop) {
35
+ if (currentScroll < elementOffset && // @ts-ignore
36
+ currentScroll > contentRef.current.offsetTop) {
37
+ setPosition('fixed');
38
+ } else if (currentScroll >= elementOffset || // @ts-ignore
39
+ currentScroll <= contentRef.current.offsetTop) {
38
40
  setPosition('relative');
39
41
  }
40
42
  }
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { Table, TableHead, TableRow, TableBody, TableHeadCell, TableDataCell, NavVertical, NavVerticalItem } from '@digigov/react-core';
3
+ import { Dropdown, DropdownButton, DropdownContent } from '@digigov/ui/admin';
4
+ import TableFloatingScroll from '@digigov/ui/core/Table/TableFloatingScroll';
5
+ var labels = {
6
+ name: 'Ονοματεπώνυμο',
7
+ email: 'Email',
8
+ phone: 'Τηλέφωνο',
9
+ role: 'Ρόλος',
10
+ status: 'Κατάσταση',
11
+ actions: 'Ενέργειες',
12
+ at: 'Αριθμός Ταυτότητας',
13
+ zip: 'Ταχυδρομικός Κώδικας',
14
+ address: 'Διεύθυνση',
15
+ city: 'Πόλη',
16
+ country: 'Χώρα',
17
+ active: 'Ενεργός',
18
+ last_login: 'Τελευταία Σύνδεση',
19
+ last_login_agent: 'Τελευταία Σύνδεση Αξεσουάρ',
20
+ last_login_ip: 'Τελευταία Σύνδεση IP',
21
+ afm: 'ΑΦΜ'
22
+ };
23
+ var data = new Array(20).fill({
24
+ name: 'Τάκης Τσούκαλος',
25
+ afm: '1111111114',
26
+ role: 'Χειριστής',
27
+ at: '1212121',
28
+ email: 'myhomeemail@gov.gr',
29
+ phone: '22222222',
30
+ address: 'Αγία Παρασκευής',
31
+ city: 'Αγία Παρασκευή',
32
+ country: 'Ελλάδα',
33
+ zip: '222233',
34
+ active: 'Ναι',
35
+ last_login: '12/12/12',
36
+ last_login_ip: '0.0.0.0',
37
+ last_login_agent: 'Firefox'
38
+ });
39
+
40
+ var _ref = /*#__PURE__*/React.createElement(TableHeadCell, null, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
41
+
42
+ var _ref2 = /*#__PURE__*/React.createElement(TableDataCell, null, /*#__PURE__*/React.createElement(Dropdown, {
43
+ "float": true,
44
+ align: "left",
45
+ placement: "bottom"
46
+ }, /*#__PURE__*/React.createElement(DropdownButton, {
47
+ variant: "link"
48
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2"), /*#__PURE__*/React.createElement(DropdownContent, null, /*#__PURE__*/React.createElement(NavVertical, null, /*#__PURE__*/React.createElement(NavVerticalItem, {
49
+ href: "#"
50
+ }, "Accept"), /*#__PURE__*/React.createElement(NavVerticalItem, {
51
+ href: "#"
52
+ }, "Dismiss")))));
53
+
54
+ var _ref3 = /*#__PURE__*/React.createElement(TableHeadCell, null, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
55
+
56
+ var _ref4 = /*#__PURE__*/React.createElement(TableDataCell, null, /*#__PURE__*/React.createElement(Dropdown, {
57
+ "float": true,
58
+ align: "left",
59
+ placement: "bottom"
60
+ }, /*#__PURE__*/React.createElement(DropdownButton, {
61
+ variant: "link"
62
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2"), /*#__PURE__*/React.createElement(DropdownContent, null, /*#__PURE__*/React.createElement(NavVertical, null, /*#__PURE__*/React.createElement(NavVerticalItem, {
63
+ href: "#"
64
+ }, "Accept"), /*#__PURE__*/React.createElement(NavVerticalItem, {
65
+ href: "#"
66
+ }, "Dismiss")))));
67
+
68
+ export var WithFloatingScroll = function WithFloatingScroll() {
69
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableFloatingScroll, null, /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, Object.keys(data[0]).map(function (key) {
70
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
71
+ key: key
72
+ }, labels[key]);
73
+ }), _ref)), /*#__PURE__*/React.createElement(TableBody, null, data && data.map(function (dt, index) {
74
+ return /*#__PURE__*/React.createElement(TableRow, {
75
+ key: index
76
+ }, Object.keys(dt).map(function (key) {
77
+ return /*#__PURE__*/React.createElement(TableDataCell, {
78
+ key: key
79
+ }, dt[key]);
80
+ }), _ref2);
81
+ })))), /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, Object.keys(data[0]).map(function (key) {
82
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
83
+ key: key
84
+ }, labels[key]);
85
+ }), _ref3)), /*#__PURE__*/React.createElement(TableBody, null, data && data.map(function (dt, index) {
86
+ return /*#__PURE__*/React.createElement(TableRow, {
87
+ key: index
88
+ }, Object.keys(dt).map(function (key) {
89
+ return /*#__PURE__*/React.createElement(TableDataCell, {
90
+ key: key
91
+ }, dt[key]);
92
+ }), _ref4);
93
+ }))));
94
+ };
95
+ export default WithFloatingScroll;
@@ -64,7 +64,7 @@ export var WithLoader = function WithLoader() {
64
64
 
65
65
  setTimeout(function () {
66
66
  setTableData(data);
67
- }, 8000);
67
+ }, 2000);
68
68
  return /*#__PURE__*/React.createElement("div", {
69
69
  className: "example"
70
70
  }, /*#__PURE__*/React.createElement(TableContainer, null, !tableData ? _ref : /*#__PURE__*/React.createElement(Table, null, _ref2, _ref3, /*#__PURE__*/React.createElement(TableBody, null, loading === true && _ref4, tableData && tableData.length > 0 ? tableData.map(function (d, index) {
@@ -73,11 +73,8 @@ export var WithLoader = function WithLoader() {
73
73
  }, /*#__PURE__*/React.createElement(TableDataCell, null, d.name), /*#__PURE__*/React.createElement(TableDataCell, null, d.job), /*#__PURE__*/React.createElement(TableDataCell, null, d.year), /*#__PURE__*/React.createElement(TableDataCell, null, d.salary));
74
74
  }) : _ref5))), /*#__PURE__*/React.createElement(Button, {
75
75
  onClick: function onClick() {
76
- setLoading(true);
77
- /* setTimeout(() => {
78
- setLoading(false);
79
- }, 7000); */
76
+ setLoading(!loading);
80
77
  }
81
- }, "\u03A0\u03C1\u03BF\u03C3\u03B8\u03B7\u03BA\u03B7"));
78
+ }, "Toggle Loading"));
82
79
  };
83
80
  export default WithLoader;
@@ -29,19 +29,30 @@ export var Dropdown = function Dropdown(_ref) {
29
29
  }
30
30
 
31
31
  var toggleFloat = function toggleFloat() {
32
+ var _innerRef$current;
33
+
34
+ var tbody = innerRef.current.closest('tbody');
35
+ var parentElement = (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.parentElement;
36
+
32
37
  if (innerRef.current.open) {
33
- var rect = innerRef.current.getBoundingClientRect();
34
- innerRef.current.style.position = 'static';
35
- var top = rect.top + window.pageYOffset;
38
+ tbody.style.position = 'static';
39
+ var rect = parentElement.getBoundingClientRect();
40
+ innerRef.current.style.position = 'static'; // arbitrary spacing of 12 pixels because CSS
41
+
42
+ var top = rect.top + window.pageYOffset + 12;
36
43
  var left = rect.left + window.pageXOffset;
37
- innerRef.current.style.top = "".concat(top, "px");
38
- innerRef.current.style.left = "".concat(left, "px");
39
- innerRef.current.style.position = "absolute";
40
- innerRef.current.style.display = "block";
44
+ parentElement.style.top = "".concat(top, "px");
45
+ parentElement.style.left = "".concat(left, "px");
46
+ parentElement.style.position = "absolute";
47
+ parentElement.style.display = "block";
48
+ parentElement.style.background = 'white';
41
49
  } else {
42
- innerRef.current.style.top = "0";
43
- innerRef.current.style.left = "0";
44
- innerRef.current.style.position = "relative";
50
+ tbody.style.position = 'relative';
51
+ parentElement.style.top = "0";
52
+ parentElement.style.left = "0";
53
+ parentElement.style.position = "relative";
54
+ parentElement.style.display = "table-cell";
55
+ parentElement.style.background = 'transparent';
45
56
  }
46
57
  };
47
58
 
@@ -16,4 +16,5 @@ export * from './__stories__/DarkVariantWithVerticalHeaders';
16
16
  export * from './__stories__/WithLoader';
17
17
  export * from './__stories__/DefinedWidth';
18
18
  export * from './__stories__/Densed';
19
- export * from './__stories__/MultipleProps';
19
+ export * from './__stories__/MultipleProps';
20
+ export * from './__stories__/WithFloatingScroll';
@@ -30,11 +30,13 @@ export function TableFloatingScroll(props) {
30
30
  var elementOffset = contentRef.current.offsetTop + contentRef.current.offsetHeight;
31
31
 
32
32
  function onBodyScroll() {
33
- var currentScroll = window.pageYOffset + window.innerHeight; // @ts-ignore
33
+ var currentScroll = window.pageYOffset + window.innerHeight;
34
34
 
35
- if (currentScroll < elementOffset && currentScroll > contentRef.current.offsetTop) {
36
- setPosition('fixed'); // @ts-ignore
37
- } else if (currentScroll >= elementOffset || currentScroll <= contentRef.current.offsetTop) {
35
+ if (currentScroll < elementOffset && // @ts-ignore
36
+ currentScroll > contentRef.current.offsetTop) {
37
+ setPosition('fixed');
38
+ } else if (currentScroll >= elementOffset || // @ts-ignore
39
+ currentScroll <= contentRef.current.offsetTop) {
38
40
  setPosition('relative');
39
41
  }
40
42
  }
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { Table, TableHead, TableRow, TableBody, TableHeadCell, TableDataCell, NavVertical, NavVerticalItem } from '@digigov/react-core';
3
+ import { Dropdown, DropdownButton, DropdownContent } from '@digigov/ui/admin';
4
+ import TableFloatingScroll from '@digigov/ui/core/Table/TableFloatingScroll';
5
+ var labels = {
6
+ name: 'Ονοματεπώνυμο',
7
+ email: 'Email',
8
+ phone: 'Τηλέφωνο',
9
+ role: 'Ρόλος',
10
+ status: 'Κατάσταση',
11
+ actions: 'Ενέργειες',
12
+ at: 'Αριθμός Ταυτότητας',
13
+ zip: 'Ταχυδρομικός Κώδικας',
14
+ address: 'Διεύθυνση',
15
+ city: 'Πόλη',
16
+ country: 'Χώρα',
17
+ active: 'Ενεργός',
18
+ last_login: 'Τελευταία Σύνδεση',
19
+ last_login_agent: 'Τελευταία Σύνδεση Αξεσουάρ',
20
+ last_login_ip: 'Τελευταία Σύνδεση IP',
21
+ afm: 'ΑΦΜ'
22
+ };
23
+ var data = new Array(20).fill({
24
+ name: 'Τάκης Τσούκαλος',
25
+ afm: '1111111114',
26
+ role: 'Χειριστής',
27
+ at: '1212121',
28
+ email: 'myhomeemail@gov.gr',
29
+ phone: '22222222',
30
+ address: 'Αγία Παρασκευής',
31
+ city: 'Αγία Παρασκευή',
32
+ country: 'Ελλάδα',
33
+ zip: '222233',
34
+ active: 'Ναι',
35
+ last_login: '12/12/12',
36
+ last_login_ip: '0.0.0.0',
37
+ last_login_agent: 'Firefox'
38
+ });
39
+
40
+ var _ref = /*#__PURE__*/React.createElement(TableHeadCell, null, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
41
+
42
+ var _ref2 = /*#__PURE__*/React.createElement(TableDataCell, null, /*#__PURE__*/React.createElement(Dropdown, {
43
+ "float": true,
44
+ align: "left",
45
+ placement: "bottom"
46
+ }, /*#__PURE__*/React.createElement(DropdownButton, {
47
+ variant: "link"
48
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2"), /*#__PURE__*/React.createElement(DropdownContent, null, /*#__PURE__*/React.createElement(NavVertical, null, /*#__PURE__*/React.createElement(NavVerticalItem, {
49
+ href: "#"
50
+ }, "Accept"), /*#__PURE__*/React.createElement(NavVerticalItem, {
51
+ href: "#"
52
+ }, "Dismiss")))));
53
+
54
+ var _ref3 = /*#__PURE__*/React.createElement(TableHeadCell, null, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2");
55
+
56
+ var _ref4 = /*#__PURE__*/React.createElement(TableDataCell, null, /*#__PURE__*/React.createElement(Dropdown, {
57
+ "float": true,
58
+ align: "left",
59
+ placement: "bottom"
60
+ }, /*#__PURE__*/React.createElement(DropdownButton, {
61
+ variant: "link"
62
+ }, "\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2"), /*#__PURE__*/React.createElement(DropdownContent, null, /*#__PURE__*/React.createElement(NavVertical, null, /*#__PURE__*/React.createElement(NavVerticalItem, {
63
+ href: "#"
64
+ }, "Accept"), /*#__PURE__*/React.createElement(NavVerticalItem, {
65
+ href: "#"
66
+ }, "Dismiss")))));
67
+
68
+ export var WithFloatingScroll = function WithFloatingScroll() {
69
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableFloatingScroll, null, /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, Object.keys(data[0]).map(function (key) {
70
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
71
+ key: key
72
+ }, labels[key]);
73
+ }), _ref)), /*#__PURE__*/React.createElement(TableBody, null, data && data.map(function (dt, index) {
74
+ return /*#__PURE__*/React.createElement(TableRow, {
75
+ key: index
76
+ }, Object.keys(dt).map(function (key) {
77
+ return /*#__PURE__*/React.createElement(TableDataCell, {
78
+ key: key
79
+ }, dt[key]);
80
+ }), _ref2);
81
+ })))), /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, Object.keys(data[0]).map(function (key) {
82
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
83
+ key: key
84
+ }, labels[key]);
85
+ }), _ref3)), /*#__PURE__*/React.createElement(TableBody, null, data && data.map(function (dt, index) {
86
+ return /*#__PURE__*/React.createElement(TableRow, {
87
+ key: index
88
+ }, Object.keys(dt).map(function (key) {
89
+ return /*#__PURE__*/React.createElement(TableDataCell, {
90
+ key: key
91
+ }, dt[key]);
92
+ }), _ref4);
93
+ }))));
94
+ };
95
+ export default WithFloatingScroll;
@@ -64,7 +64,7 @@ export var WithLoader = function WithLoader() {
64
64
 
65
65
  setTimeout(function () {
66
66
  setTableData(data);
67
- }, 8000);
67
+ }, 2000);
68
68
  return /*#__PURE__*/React.createElement("div", {
69
69
  className: "example"
70
70
  }, /*#__PURE__*/React.createElement(TableContainer, null, !tableData ? _ref : /*#__PURE__*/React.createElement(Table, null, _ref2, _ref3, /*#__PURE__*/React.createElement(TableBody, null, loading === true && _ref4, tableData && tableData.length > 0 ? tableData.map(function (d, index) {
@@ -73,11 +73,8 @@ export var WithLoader = function WithLoader() {
73
73
  }, /*#__PURE__*/React.createElement(TableDataCell, null, d.name), /*#__PURE__*/React.createElement(TableDataCell, null, d.job), /*#__PURE__*/React.createElement(TableDataCell, null, d.year), /*#__PURE__*/React.createElement(TableDataCell, null, d.salary));
74
74
  }) : _ref5))), /*#__PURE__*/React.createElement(Button, {
75
75
  onClick: function onClick() {
76
- setLoading(true);
77
- /* setTimeout(() => {
78
- setLoading(false);
79
- }, 7000); */
76
+ setLoading(!loading);
80
77
  }
81
- }, "\u03A0\u03C1\u03BF\u03C3\u03B8\u03B7\u03BA\u03B7"));
78
+ }, "Toggle Loading"));
82
79
  };
83
80
  export default WithLoader;
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Digigov v0.24.0
1
+ /** @license Digigov v0.24.1
2
2
  *
3
3
  * This source code is licensed under the BSD-2-Clause license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/ui",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "@digigov reusable components toolkit",
5
5
  "module": "./esm/index.js",
6
6
  "publishConfig": {