@banch0u/core-project-test-repository 1.7.0 → 1.7.2

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.
@@ -3,10 +3,9 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { Form, Modal } from "antd";
5
5
  import React, { forwardRef, useCallback, useImperativeHandle, useState } from "react";
6
- import { useDispatch, useSelector } from "react-redux";
7
- import { setCitizenSearchId, setSubtopicSelectDisabled } from "../../store/slices/global";
6
+ import { useSelector } from "react-redux";
8
7
  import style from "./index.module.scss";
9
- import { Button } from "@banch0u/core-project-test-repository";
8
+ import Button from "../Button";
10
9
  var FormModal = function FormModal(_ref, ref) {
11
10
  var okText = _ref.okText,
12
11
  cancelText = _ref.cancelText,
@@ -32,7 +31,6 @@ var FormModal = function FormModal(_ref, ref) {
32
31
  var _useForm = useForm(),
33
32
  _useForm2 = _slicedToArray(_useForm, 1),
34
33
  form = _useForm2[0];
35
- var dispatch = useDispatch();
36
34
  if (customForm) {
37
35
  customForm(form);
38
36
  }
@@ -96,12 +94,13 @@ var FormModal = function FormModal(_ref, ref) {
96
94
  case 9:
97
95
  form.resetFields();
98
96
  setIsVisible(false);
99
- _context.next = 15;
97
+ _context.next = 16;
100
98
  break;
101
99
  case 13:
102
100
  _context.prev = 13;
103
101
  _context.t0 = _context["catch"](0);
104
- case 15:
102
+ console.log(_context.t0);
103
+ case 16:
105
104
  case "end":
106
105
  return _context.stop();
107
106
  }
@@ -1,6 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import React, { useRef, useState } from "react";
3
+ import React, { useRef } from "react";
4
4
  import { useDispatch, useSelector } from "react-redux";
5
5
  import { readNotification, readNotificationAll } from "../../store/slices/notification";
6
6
  import { Button, List, Tooltip, Typography } from "antd";
@@ -11,7 +11,6 @@ import FormModal from "../FormModal";
11
11
  var NotificationDropdown = function NotificationDropdown(_ref) {
12
12
  var _notifications$notifi;
13
13
  var size = _ref.size,
14
- page = _ref.page,
15
14
  setSize = _ref.setSize,
16
15
  setPage = _ref.setPage;
17
16
  var dispatch = useDispatch();
@@ -157,7 +157,7 @@ var NotificationSettingsContent = /*#__PURE__*/React.forwardRef(function (props,
157
157
  var _props$onClose;
158
158
  dispatch(editNotificationSettings(data));
159
159
  props === null || props === void 0 || (_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props);
160
- }, [dispatch]);
160
+ }, [dispatch, props]);
161
161
  return /*#__PURE__*/React.createElement("div", {
162
162
  className: style.settingsWrapper
163
163
  }, /*#__PURE__*/React.createElement(Title, {
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
3
3
  import { Badge, Dropdown, Menu, Tooltip } from "antd";
4
4
  import { SunOutlined, MoonOutlined } from "@ant-design/icons";
5
5
  import style from "./index.module.scss";
6
- import { BellOutlined, BellFilled, NotificationOutlined } from "@ant-design/icons";
6
+ import { BellOutlined } from "@ant-design/icons";
7
7
  import { useDispatch, useSelector } from "react-redux";
8
8
  import { Link } from "react-router-dom";
9
9
  import { getProfileInfo, scopes } from "../../store/slices/auth";
@@ -0,0 +1,204 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import React, { useState, useEffect } from "react";
8
+ import style from "./index.module.scss";
9
+ import { Table as AntTable } from "antd";
10
+ import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
11
+ import Cookies from "js-cookie";
12
+ var Table = function Table(_ref) {
13
+ var tableId = _ref.tableId,
14
+ columns = _ref.columns,
15
+ dataSource = _ref.dataSource,
16
+ selectedColumns = _ref.selectedColumns,
17
+ innerW = _ref.innerW,
18
+ disableDrag = _ref.disableDrag;
19
+ var getSavedOrder = function getSavedOrder(id) {
20
+ var savedOrder = Cookies.get("columnOrder_".concat(id));
21
+ return savedOrder ? savedOrder.split(",") : null;
22
+ };
23
+ var sortColumns = function sortColumns(cols, order) {
24
+ if (!order) return cols;
25
+ var orderedCols = cols.filter(function (col) {
26
+ return order.includes(col.dataIndex);
27
+ });
28
+ var unorderedCols = cols.filter(function (col) {
29
+ return !order.includes(col.dataIndex);
30
+ });
31
+ return [].concat(_toConsumableArray(orderedCols.sort(function (a, b) {
32
+ return order.indexOf(a.dataIndex) - order.indexOf(b.dataIndex);
33
+ })), _toConsumableArray(unorderedCols));
34
+ };
35
+
36
+ // Get initial saved order only if disableDrag is false
37
+ var savedOrder = disableDrag ? null : getSavedOrder(tableId);
38
+ var initialOrderedColumns = sortColumns(columns.filter(function (col) {
39
+ return !col.fixed;
40
+ }), savedOrder);
41
+ var _useState = useState(initialOrderedColumns),
42
+ _useState2 = _slicedToArray(_useState, 2),
43
+ orderedColumns = _useState2[0],
44
+ setOrderedColumns = _useState2[1];
45
+ useEffect(function () {
46
+ if (!disableDrag) {
47
+ var _savedOrder = getSavedOrder(tableId);
48
+ setOrderedColumns(sortColumns(columns.filter(function (col) {
49
+ return !col.fixed;
50
+ }), _savedOrder));
51
+ } else {
52
+ setOrderedColumns(columns.filter(function (col) {
53
+ return !col.fixed;
54
+ }));
55
+ }
56
+ }, [tableId, columns, disableDrag]);
57
+ var handleDragEnd = function handleDragEnd(result) {
58
+ if (!result.destination) return;
59
+ var reorderedColumns = Array.from(orderedColumns);
60
+ var _reorderedColumns$spl = reorderedColumns.splice(result.source.index, 1),
61
+ _reorderedColumns$spl2 = _slicedToArray(_reorderedColumns$spl, 1),
62
+ removed = _reorderedColumns$spl2[0];
63
+ reorderedColumns.splice(result.destination.index, 0, removed);
64
+ setOrderedColumns(reorderedColumns);
65
+ if (!disableDrag) {
66
+ Cookies.set("columnOrder_".concat(tableId), reorderedColumns.map(function (col) {
67
+ return col.dataIndex;
68
+ }).join(","), {
69
+ expires: 7
70
+ });
71
+ }
72
+ };
73
+ var calculateLeft = function calculateLeft(index) {
74
+ return fixedLeftColumns.slice(0, index).reduce(function (total, col) {
75
+ return total + col.width;
76
+ }, 0);
77
+ };
78
+ var calculateRight = function calculateRight(index) {
79
+ return fixedRightColumns.slice(0, index).reduce(function (total, col) {
80
+ return total + col.width;
81
+ }, 0);
82
+ };
83
+ var filteredColumns = function filteredColumns(cols) {
84
+ return cols.filter(function (col) {
85
+ return !selectedColumns || selectedColumns.includes(col.dataIndex);
86
+ });
87
+ };
88
+ var fixedLeftColumns = filteredColumns(columns.filter(function (col) {
89
+ return col.fixed === "left";
90
+ }));
91
+ var fixedRightColumns = filteredColumns(columns.filter(function (col) {
92
+ return col.fixed === "right";
93
+ }));
94
+ var draggableColumns = filteredColumns(orderedColumns);
95
+ var DraggableHeader = function DraggableHeader() {
96
+ return /*#__PURE__*/React.createElement("tr", null, fixedLeftColumns.map(function (col, index) {
97
+ return /*#__PURE__*/React.createElement("th", {
98
+ key: col.dataIndex,
99
+ className: style.draggableHeader,
100
+ style: {
101
+ position: "sticky",
102
+ left: calculateLeft(index),
103
+ zIndex: 99999,
104
+ background: "white"
105
+ }
106
+ }, col.title);
107
+ }), draggableColumns.map(function (col) {
108
+ return /*#__PURE__*/React.createElement("th", {
109
+ key: col.dataIndex,
110
+ className: style.draggableHeader,
111
+ style: {
112
+ cursor: disableDrag ? "default" : "move"
113
+ }
114
+ }, col.title);
115
+ }), fixedRightColumns.map(function (col, index) {
116
+ return /*#__PURE__*/React.createElement("th", {
117
+ key: col.dataIndex,
118
+ className: style.draggableHeader,
119
+ style: {
120
+ position: "sticky",
121
+ right: calculateRight(index),
122
+ zIndex: 99999,
123
+ background: "white"
124
+ }
125
+ }, col.title);
126
+ }));
127
+ };
128
+ var DraggableWrapper = function DraggableWrapper() {
129
+ return /*#__PURE__*/React.createElement(DragDropContext, {
130
+ onDragEnd: handleDragEnd
131
+ }, /*#__PURE__*/React.createElement(Droppable, {
132
+ droppableId: "droppable_".concat(tableId),
133
+ direction: "horizontal"
134
+ }, function (provided) {
135
+ return /*#__PURE__*/React.createElement("tr", _extends({
136
+ ref: provided.innerRef
137
+ }, provided.droppableProps), fixedLeftColumns.map(function (col, index) {
138
+ return /*#__PURE__*/React.createElement("th", {
139
+ key: col.dataIndex,
140
+ className: style.draggableHeader,
141
+ style: {
142
+ position: "sticky",
143
+ left: calculateLeft(index),
144
+ zIndex: 99,
145
+ background: "white"
146
+ }
147
+ }, col.title);
148
+ }), draggableColumns.map(function (col, index) {
149
+ return /*#__PURE__*/React.createElement(Draggable, {
150
+ key: col.dataIndex,
151
+ draggableId: "".concat(col.dataIndex, "_").concat(tableId),
152
+ index: index
153
+ }, function (provided) {
154
+ return /*#__PURE__*/React.createElement("th", _extends({
155
+ ref: provided.innerRef
156
+ }, provided.draggableProps, provided.dragHandleProps, {
157
+ className: style.draggableHeader,
158
+ style: _objectSpread(_objectSpread({}, provided.draggableProps.style), {}, {
159
+ cursor: "move"
160
+ })
161
+ }), col.title);
162
+ });
163
+ }), fixedRightColumns.map(function (col, index) {
164
+ return /*#__PURE__*/React.createElement("th", {
165
+ key: col.dataIndex,
166
+ className: style.draggableHeader,
167
+ style: {
168
+ position: "sticky",
169
+ right: calculateRight(index),
170
+ zIndex: 99,
171
+ background: "white"
172
+ }
173
+ }, col.title);
174
+ }), provided.placeholder);
175
+ }));
176
+ };
177
+ var components = {
178
+ header: {
179
+ row: function row(props) {
180
+ return disableDrag ? /*#__PURE__*/React.createElement(DraggableHeader, _extends({}, props, {
181
+ columns: columns
182
+ })) : /*#__PURE__*/React.createElement(DraggableWrapper, _extends({}, props, {
183
+ columns: columns
184
+ }));
185
+ }
186
+ }
187
+ };
188
+ return /*#__PURE__*/React.createElement("div", {
189
+ className: style.table_container
190
+ }, /*#__PURE__*/React.createElement(AntTable, {
191
+ rowClassName: function rowClassName(record) {
192
+ return record.className;
193
+ },
194
+ columns: [].concat(_toConsumableArray(fixedLeftColumns), _toConsumableArray(draggableColumns), _toConsumableArray(fixedRightColumns)),
195
+ dataSource: dataSource,
196
+ pagination: false,
197
+ components: components,
198
+ scroll: {
199
+ x: innerW * (Array.isArray(selectedColumns) ? selectedColumns.length - 1 : 0),
200
+ y: "calc(88vh - ".concat(window.innerWidth > 1537 ? "260px" : "280px", ")")
201
+ }
202
+ }));
203
+ };
204
+ export default Table;
@@ -0,0 +1,76 @@
1
+ .table_container {
2
+ table {
3
+ tr {
4
+ th:first-child {
5
+ font-family: Inter !important;
6
+ font-size: 18px !important;
7
+ font-weight: 400 !important;
8
+ line-height: 21.78px !important;
9
+ text-align: center !important;
10
+ color: #000000 !important;
11
+ }
12
+ th {
13
+ background: #fff !important;
14
+ text-align: center !important;
15
+
16
+ padding: 5px !important;
17
+ font-family: Inter !important;
18
+ font-size: 16px !important;
19
+ font-weight: 400 !important;
20
+ line-height: 19.36px !important;
21
+
22
+ border-color: #bebebe !important;
23
+ border-top: 1px solid #bebebe !important;
24
+ border-start-start-radius: 0px !important;
25
+ border-start-end-radius: 0px !important;
26
+ color: #646464 !important;
27
+ }
28
+ td {
29
+ padding: 0px !important;
30
+ font-size: 16px !important;
31
+ font-weight: 400 !important;
32
+ line-height: 24px !important;
33
+ text-align: center !important;
34
+ border-color: #fff !important;
35
+ color: #343434 !important;
36
+ }
37
+ // th:first-child {
38
+ // border-right: 1px solid #BEBEBE !important;
39
+ // }
40
+ // td:first-child {
41
+ // border-right: 1px solid #BEBEBE !important;
42
+ // }
43
+
44
+ // th:last-child {
45
+ // border-right: none !important;
46
+ // }
47
+ }
48
+ tr:first-child {
49
+ td {
50
+ padding: 0 !important;
51
+ }
52
+ }
53
+ }
54
+ // @media screen and (max-width: 1537px) {
55
+ // table {
56
+ // tr {
57
+ // th {
58
+ // font-size: 12px !important;
59
+ // font-weight: 600 !important;
60
+ // line-height: 18px !important;
61
+ // }
62
+ // td {
63
+ // font-size: 12px !important;
64
+ // font-weight: 500 !important;
65
+ // line-height: 18px !important;
66
+ // text-align: center;
67
+ // }
68
+ // }
69
+ // }
70
+ // }
71
+ }
72
+ .draggableHeader {
73
+ background: #fff;
74
+ z-index: 2;
75
+ white-space: nowrap;
76
+ }
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { default as Pagination } from "./components/Pagination";
7
7
  export { default as FormModal } from "./components/FormModal";
8
8
  export { default as useNotification } from "./hooks/useNotification";
9
9
  export { default as message } from "./utils/message";
10
+ export { default as Table } from "./components/Table";
10
11
  import LoginPage from "./pages/Login";
11
12
  import PlatformPage from "./pages/Platform";
12
13
  import HeaderLayout from "./layout/Header";
@@ -23,7 +23,7 @@ var Platform = function Platform() {
23
23
  useEffect(function () {
24
24
  dispatch(scopes());
25
25
  dispatch(getProfileInfo());
26
- }, []);
26
+ }, [dispatch]);
27
27
  return /*#__PURE__*/React.createElement("div", {
28
28
  className: style.platform
29
29
  }, /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banch0u/core-project-test-repository",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Shared core features for all projects",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -24,11 +24,15 @@
24
24
  "publish:major": "npm run build && npm version major && npm publish"
25
25
  },
26
26
  "dependencies": {
27
+ "@ant-design/icons": "^6.0.0",
27
28
  "@microsoft/signalr": "^8.0.7",
28
29
  "@pdftron/webviewer": "^11.2.0",
29
30
  "@reduxjs/toolkit": "^2.6.1",
30
31
  "antd": "^5.16.0",
31
- "axios": "^1.8.4"
32
+ "axios": "^1.8.4",
33
+ "js-cookie": "^3.0.5",
34
+ "react-beautiful-dnd": "^13.1.1",
35
+ "react-redux": "^9.2.0"
32
36
  },
33
37
  "peerDependencies": {
34
38
  "react": "^18.0.0 || ^19.0.0",