qbs-react-grid 2.1.0 → 2.2.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/dist/css/qbs-react-grid.css +1 -1
- package/dist/css/qbs-react-grid.min.css +1 -1
- package/dist/css/qbs-react-grid.min.css.map +1 -1
- package/es/Cell.js +2 -1
- package/es/Pagination.d.ts +3 -0
- package/es/Pagination.js +8 -3
- package/es/index.d.ts +1 -1
- package/es/less/qbs-table.less +148 -4
- package/es/qbsTable/QbsTable.js +56 -34
- package/es/qbsTable/TableCardList.js +47 -31
- package/es/qbsTable/Toolbar.js +15 -11
- package/es/qbsTable/commontypes.d.ts +5 -1
- package/es/qbsTable/labels.d.ts +48 -0
- package/es/qbsTable/labels.js +34 -0
- package/es/qbsTable/utilities/CardComponent.d.ts +2 -0
- package/es/qbsTable/utilities/CardComponent.js +7 -3
- package/es/qbsTable/utilities/CardMenuDropdown.d.ts +2 -0
- package/es/qbsTable/utilities/CardMenuDropdown.js +5 -2
- package/es/qbsTable/utilities/ColumShowHide.d.ts +2 -0
- package/es/qbsTable/utilities/ColumShowHide.js +9 -6
- package/es/qbsTable/utilities/SearchInput.d.ts +1 -0
- package/es/qbsTable/utilities/SearchInput.js +3 -1
- package/es/qbsTable/utilities/tablecalc.d.ts +1 -1
- package/es/qbsTable/utilities/tablecalc.js +7 -2
- package/lib/Cell.js +2 -1
- package/lib/Pagination.d.ts +3 -0
- package/lib/Pagination.js +8 -3
- package/lib/index.d.ts +1 -1
- package/lib/less/qbs-table.less +148 -4
- package/lib/qbsTable/QbsTable.js +56 -34
- package/lib/qbsTable/TableCardList.js +47 -31
- package/lib/qbsTable/Toolbar.js +15 -11
- package/lib/qbsTable/commontypes.d.ts +5 -1
- package/lib/qbsTable/labels.d.ts +48 -0
- package/lib/qbsTable/labels.js +42 -0
- package/lib/qbsTable/utilities/CardComponent.d.ts +2 -0
- package/lib/qbsTable/utilities/CardComponent.js +7 -3
- package/lib/qbsTable/utilities/CardMenuDropdown.d.ts +2 -0
- package/lib/qbsTable/utilities/CardMenuDropdown.js +5 -2
- package/lib/qbsTable/utilities/ColumShowHide.d.ts +2 -0
- package/lib/qbsTable/utilities/ColumShowHide.js +9 -6
- package/lib/qbsTable/utilities/SearchInput.d.ts +1 -0
- package/lib/qbsTable/utilities/SearchInput.js +3 -1
- package/lib/qbsTable/utilities/tablecalc.d.ts +1 -1
- package/lib/qbsTable/utilities/tablecalc.js +7 -2
- package/package.json +1 -1
- package/src/Cell.tsx +3 -1
- package/src/Pagination.tsx +10 -3
- package/src/index.ts +1 -1
- package/src/less/qbs-table.less +148 -4
- package/src/qbsTable/QbsTable.tsx +42 -9
- package/src/qbsTable/TableCardList.tsx +31 -7
- package/src/qbsTable/Toolbar.tsx +17 -10
- package/src/qbsTable/commontypes.ts +7 -0
- package/src/qbsTable/labels.ts +58 -0
- package/src/qbsTable/utilities/CardComponent.tsx +7 -2
- package/src/qbsTable/utilities/CardMenuDropdown.tsx +10 -2
- package/src/qbsTable/utilities/ColumShowHide.tsx +10 -6
- package/src/qbsTable/utilities/SearchInput.tsx +3 -1
- package/src/qbsTable/utilities/tablecalc.ts +8 -2
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
6
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
var _labels = require("../labels");
|
|
7
8
|
var _icons = require("./icons");
|
|
8
9
|
var _ToolTip = _interopRequireDefault(require("./ToolTip"));
|
|
9
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -11,7 +12,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
11
12
|
var CardMenuDropdown = function CardMenuDropdown(_ref) {
|
|
12
13
|
var actionDropDown = _ref.actionDropDown,
|
|
13
14
|
handleMenuActions = _ref.handleMenuActions,
|
|
14
|
-
rowData = _ref.rowData
|
|
15
|
+
rowData = _ref.rowData,
|
|
16
|
+
labelsProp = _ref.labels;
|
|
17
|
+
var labels = (0, _labels.mergeLabels)(labelsProp);
|
|
15
18
|
var _useState = (0, _react.useState)(false),
|
|
16
19
|
openMenu = _useState[0],
|
|
17
20
|
setOpenMenu = _useState[1];
|
|
@@ -70,7 +73,7 @@ var CardMenuDropdown = function CardMenuDropdown(_ref) {
|
|
|
70
73
|
onClick: toggleMenu,
|
|
71
74
|
ref: menuButtonRef
|
|
72
75
|
}, /*#__PURE__*/_react["default"].createElement(_ToolTip["default"], {
|
|
73
|
-
title:
|
|
76
|
+
title: labels.actions,
|
|
74
77
|
enabled: false,
|
|
75
78
|
ref: menuButtonRef
|
|
76
79
|
}, /*#__PURE__*/_react["default"].createElement(_icons.ThreeDotIcon, null))), openMenu && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QbsColumnProps } from '../commontypes';
|
|
3
|
+
import { type QbsTableLabels } from '../labels';
|
|
3
4
|
interface ColumnToggleProps {
|
|
4
5
|
columns: QbsColumnProps[];
|
|
5
6
|
onToggle: (columnName: string) => void;
|
|
@@ -11,6 +12,7 @@ interface ColumnToggleProps {
|
|
|
11
12
|
tableHeight?: number;
|
|
12
13
|
viewMode?: string;
|
|
13
14
|
setViewMode?: (value: string) => void;
|
|
15
|
+
labels?: QbsTableLabels;
|
|
14
16
|
}
|
|
15
17
|
declare const ColumnToggle: React.FC<ColumnToggleProps>;
|
|
16
18
|
export default ColumnToggle;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _labels = require("../labels");
|
|
6
7
|
var _icons = require("./icons");
|
|
7
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
8
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -15,7 +16,9 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
15
16
|
handleResetColumns = _ref.handleResetColumns,
|
|
16
17
|
handleColumnToggle = _ref.handleColumnToggle,
|
|
17
18
|
_ref$tableHeight = _ref.tableHeight,
|
|
18
|
-
tableHeight = _ref$tableHeight === void 0 ? 450 : _ref$tableHeight
|
|
19
|
+
tableHeight = _ref$tableHeight === void 0 ? 450 : _ref$tableHeight,
|
|
20
|
+
labelsProp = _ref.labels;
|
|
21
|
+
var labels = (0, _labels.mergeLabels)(labelsProp);
|
|
19
22
|
var _useState = (0, _react.useState)(null),
|
|
20
23
|
draggedItem = _useState[0],
|
|
21
24
|
setDraggedItem = _useState[1];
|
|
@@ -170,7 +173,7 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
170
173
|
className: "qbs-table-popup-item"
|
|
171
174
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
175
|
className: "qbs-table-popup-label"
|
|
173
|
-
},
|
|
176
|
+
}, labels.fixedColumns), /*#__PURE__*/_react["default"].createElement("div", {
|
|
174
177
|
className: "qbs-table-columns-container"
|
|
175
178
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
179
|
className: "qbs-table-column"
|
|
@@ -182,7 +185,7 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
182
185
|
className: "qbs-table-popup-item"
|
|
183
186
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
184
187
|
className: "qbs-table-popup-label"
|
|
185
|
-
},
|
|
188
|
+
}, labels.visibleColumns), /*#__PURE__*/_react["default"].createElement("div", {
|
|
186
189
|
className: "qbs-table-columns-container"
|
|
187
190
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
188
191
|
className: "qbs-table-column"
|
|
@@ -194,7 +197,7 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
194
197
|
className: "qbs-table-popup-item"
|
|
195
198
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
196
199
|
className: "qbs-table-popup-label"
|
|
197
|
-
},
|
|
200
|
+
}, labels.availableColumns), /*#__PURE__*/_react["default"].createElement("div", {
|
|
198
201
|
className: "qbs-table-columns-container"
|
|
199
202
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
200
203
|
className: "qbs-table-column"
|
|
@@ -215,13 +218,13 @@ var ColumnToggle = function ColumnToggle(_ref) {
|
|
|
215
218
|
onClick: function onClick() {
|
|
216
219
|
return handleResetColumns === null || handleResetColumns === void 0 ? void 0 : handleResetColumns();
|
|
217
220
|
}
|
|
218
|
-
},
|
|
221
|
+
}, labels.resetToDefault), /*#__PURE__*/_react["default"].createElement("a", {
|
|
219
222
|
className: "qbs-table-reset-link",
|
|
220
223
|
href: "#",
|
|
221
224
|
onClick: function onClick() {
|
|
222
225
|
return handleColToggle();
|
|
223
226
|
}
|
|
224
|
-
},
|
|
227
|
+
}, labels.save))))));
|
|
225
228
|
};
|
|
226
229
|
var _default = ColumnToggle;
|
|
227
230
|
exports["default"] = _default;
|
|
@@ -7,6 +7,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
7
7
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
8
|
var SearchInput = function SearchInput(_ref) {
|
|
9
9
|
var placeholder = _ref.placeholder,
|
|
10
|
+
_ref$searchAriaLabel = _ref.searchAriaLabel,
|
|
11
|
+
searchAriaLabel = _ref$searchAriaLabel === void 0 ? 'Search' : _ref$searchAriaLabel,
|
|
10
12
|
handleChange = _ref.handleChange,
|
|
11
13
|
searchValue = _ref.searchValue,
|
|
12
14
|
handleSearch = _ref.handleSearch;
|
|
@@ -30,7 +32,7 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
30
32
|
placeholder: placeholder,
|
|
31
33
|
value: searchValue != null ? searchValue : '',
|
|
32
34
|
onChange: handleInputChange,
|
|
33
|
-
"aria-label":
|
|
35
|
+
"aria-label": searchAriaLabel
|
|
34
36
|
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
35
37
|
className: "search-button absolute left-1 bottom-1.5 bg-white text-grey-dark",
|
|
36
38
|
onClick: function onClick() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getRowDisplayRange(totalRows: number, rowsPerPage: number, pageNumber: number): string;
|
|
1
|
+
export declare function getRowDisplayRange(totalRows: number, rowsPerPage: number, pageNumber: number, formatRange?: (start: number, end: number, total: number) => string): string;
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.getRowDisplayRange = getRowDisplayRange;
|
|
5
|
-
function getRowDisplayRange(totalRows, rowsPerPage, pageNumber) {
|
|
5
|
+
function getRowDisplayRange(totalRows, rowsPerPage, pageNumber, formatRange) {
|
|
6
|
+
if (formatRange === void 0) {
|
|
7
|
+
formatRange = function formatRange(start, end, total) {
|
|
8
|
+
return "Showing " + start + " to " + end + " of " + total;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
6
11
|
var start = (pageNumber - 1) * rowsPerPage + 1;
|
|
7
12
|
var end = Math.min(pageNumber * rowsPerPage, totalRows);
|
|
8
|
-
return
|
|
13
|
+
return formatRange(start != null ? start : 0, end != null ? end : 0, totalRows != null ? totalRows : 0);
|
|
9
14
|
}
|
package/package.json
CHANGED
package/src/Cell.tsx
CHANGED
|
@@ -144,11 +144,13 @@ const Cell = React.forwardRef((props: InnerCellProps, ref: React.Ref<HTMLDivElem
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
const paddingKey = rtl ? 'paddingRight' : 'paddingLeft';
|
|
147
|
+
const resolvedAlign =
|
|
148
|
+
rtl && align === 'left' ? 'right' : rtl && align === 'right' ? 'left' : align;
|
|
147
149
|
const contentStyles: React.CSSProperties = {
|
|
148
150
|
...style,
|
|
149
151
|
width: fullText ? width - 1 : width,
|
|
150
152
|
height: nextHeight,
|
|
151
|
-
textAlign:
|
|
153
|
+
textAlign: resolvedAlign,
|
|
152
154
|
[paddingKey]: isTreeCol ? depth * LAYER_WIDTH + 10 : style?.[paddingKey] || style?.padding
|
|
153
155
|
};
|
|
154
156
|
|
package/src/Pagination.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { FC, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import CustomSelect from './customSelect';
|
|
4
|
+
import { mergeLabels, type QbsTableLabels } from './qbsTable/labels';
|
|
4
5
|
import { getRowDisplayRange } from './qbsTable/utilities/tablecalc';
|
|
5
6
|
|
|
6
7
|
// Import the custom select component
|
|
@@ -15,6 +16,8 @@ type PageProps = {
|
|
|
15
16
|
onRowsPerPage?: (row: number, page: number) => void;
|
|
16
17
|
onPagination?: (row: number, page: number) => void;
|
|
17
18
|
};
|
|
19
|
+
labels?: QbsTableLabels;
|
|
20
|
+
dataTheme?: string;
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
const PageIndex = ({ currentPage, handleFirst, pageCount }) => {
|
|
@@ -52,7 +55,8 @@ const PageIndex = ({ currentPage, handleFirst, pageCount }) => {
|
|
|
52
55
|
return <>{renderPageNumbers()}</>;
|
|
53
56
|
};
|
|
54
57
|
|
|
55
|
-
const Pagination: FC<PageProps> = ({ paginationProps }) => {
|
|
58
|
+
const Pagination: FC<PageProps> = ({ paginationProps, labels: labelsProp, dataTheme }) => {
|
|
59
|
+
const labels = mergeLabels(labelsProp);
|
|
56
60
|
const {
|
|
57
61
|
dropOptions = [10, 20, 50, 100, 200],
|
|
58
62
|
currentPage = 1,
|
|
@@ -96,9 +100,12 @@ const Pagination: FC<PageProps> = ({ paginationProps }) => {
|
|
|
96
100
|
return (
|
|
97
101
|
<div
|
|
98
102
|
className="qbs-table-custom-pagination"
|
|
103
|
+
data-theme={dataTheme}
|
|
99
104
|
style={{ display: 'flex', justifyContent: 'space-between' }}
|
|
100
105
|
>
|
|
101
|
-
<div className="rows-count">
|
|
106
|
+
<div className="rows-count">
|
|
107
|
+
{getRowDisplayRange(total, rowsPerPageState, currentPage, labels.showingRange)}
|
|
108
|
+
</div>
|
|
102
109
|
<div className="qbs-table-pagination-right-block">
|
|
103
110
|
<button
|
|
104
111
|
className="qbs-table-icon-container"
|
|
@@ -194,7 +201,7 @@ const Pagination: FC<PageProps> = ({ paginationProps }) => {
|
|
|
194
201
|
</button>
|
|
195
202
|
</div>
|
|
196
203
|
<div className="qbs-table-pagination-flexBox">
|
|
197
|
-
<span className="qbs-table-pagination-text">
|
|
204
|
+
<span className="qbs-table-pagination-text">{labels.itemsPerPage}</span>
|
|
198
205
|
<CustomSelect
|
|
199
206
|
options={dropData}
|
|
200
207
|
selectedValue={rowsPerPageState}
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { ColumnProps } from './Column';
|
|
|
11
11
|
export type { CellProps } from './Cell';
|
|
12
12
|
export type { HeaderCellProps } from './HeaderCell';
|
|
13
13
|
export type { ColumnGroupProps } from './ColumnGroup';
|
|
14
|
-
export type { QbsTableProps } from './qbsTable/commontypes';
|
|
14
|
+
export type { QbsTableProps, QbsTableLabels } from './qbsTable/commontypes';
|
|
15
15
|
export type {
|
|
16
16
|
StandardProps,
|
|
17
17
|
SortType,
|
package/src/less/qbs-table.less
CHANGED
|
@@ -104,12 +104,156 @@
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
.qbs-table[data-theme='dark'] {
|
|
107
|
-
background-color: #
|
|
108
|
-
color: #
|
|
107
|
+
background-color: #1f1f1f;
|
|
108
|
+
color: #f5f5f5;
|
|
109
|
+
|
|
110
|
+
.qbs-table-border-wrap {
|
|
111
|
+
border-color: #3d3d3d;
|
|
112
|
+
background: #262626;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.qbs-table-toolbar-container,
|
|
116
|
+
.qbs-table-toolbar,
|
|
117
|
+
.qbs-table-toolbar-sub-container,
|
|
118
|
+
.sub-qbs-table-toolbar {
|
|
119
|
+
color: #f5f5f5;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.qbs-table-search-container {
|
|
123
|
+
.input {
|
|
124
|
+
border-color: #4a4a4a;
|
|
125
|
+
background: #2d2d2d;
|
|
126
|
+
color: #f5f5f5;
|
|
127
|
+
|
|
128
|
+
&:hover,
|
|
129
|
+
&:focus {
|
|
130
|
+
border-color: #6b6b6b;
|
|
131
|
+
background: #2d2d2d;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.search-button,
|
|
136
|
+
.close-button {
|
|
137
|
+
color: #d1d1d1;
|
|
138
|
+
background-color: transparent;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.qbs-table-column-popup,
|
|
143
|
+
.qbs-table-popup-container {
|
|
144
|
+
background: #2d2d2d;
|
|
145
|
+
color: #f5f5f5;
|
|
146
|
+
border-color: #4a4a4a;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.qbs-table-popup-label,
|
|
150
|
+
.qbs-table-popup-value,
|
|
151
|
+
.qbs-table-reset-link {
|
|
152
|
+
color: #f5f5f5;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.qbs-table-custom-pagination,
|
|
156
|
+
.qbs-table-pagination-text,
|
|
157
|
+
.rows-count {
|
|
158
|
+
color: #f5f5f5;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.qbs-table-icon-container svg path {
|
|
162
|
+
stroke: #e5e5e5;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.custom-select-trigger,
|
|
166
|
+
.custom-select-options {
|
|
167
|
+
background: #2d2d2d;
|
|
168
|
+
color: #f5f5f5;
|
|
169
|
+
border-color: #4a4a4a;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.qbs-card-container {
|
|
173
|
+
border-color: #4a4a4a;
|
|
174
|
+
background: #262626;
|
|
175
|
+
color: #f5f5f5;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.nodata-title {
|
|
179
|
+
color: #f5f5f5;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.tooltiptext {
|
|
183
|
+
background-color: #3d3d3d;
|
|
184
|
+
color: #fff;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.qbs-table-custom-pagination[data-theme='dark'] {
|
|
189
|
+
color: #f5f5f5;
|
|
190
|
+
|
|
191
|
+
.rows-count,
|
|
192
|
+
.qbs-table-pagination-text {
|
|
193
|
+
color: #f5f5f5;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.qbs-table-icon-container svg path {
|
|
197
|
+
stroke: #e5e5e5;
|
|
198
|
+
}
|
|
109
199
|
}
|
|
200
|
+
|
|
110
201
|
.rs-table-cell-content[data-theme='dark'] {
|
|
111
|
-
background-color: #
|
|
112
|
-
color: #
|
|
202
|
+
background-color: #262626;
|
|
203
|
+
color: #f5f5f5;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.qbs-table[data-theme='dark'] {
|
|
207
|
+
.rs-table,
|
|
208
|
+
.rs-table-body-row-wrapper,
|
|
209
|
+
.rs-table-row,
|
|
210
|
+
.rs-table-cell,
|
|
211
|
+
.rs-table-cell-group,
|
|
212
|
+
.rs-table-row-header,
|
|
213
|
+
.rs-table-row-header .rs-table-cell {
|
|
214
|
+
background-color: #262626;
|
|
215
|
+
color: #f5f5f5;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.rs-table-cell-content {
|
|
219
|
+
background-color: #262626;
|
|
220
|
+
color: #f5f5f5;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.rs-table-row-header .rs-table-cell-content,
|
|
224
|
+
.rs-table-cell-header .rs-table-cell-content {
|
|
225
|
+
background-color: #1b2028;
|
|
226
|
+
color: #f5f5f5;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover,
|
|
230
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell,
|
|
231
|
+
.rs-table-hover .rs-table-body-row-wrapper .rs-table-row:hover .rs-table-cell-content {
|
|
232
|
+
background-color: #1d2633;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.rs-table-cell {
|
|
236
|
+
border-color: #3d3d3d;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.rs-table-scrollbar {
|
|
240
|
+
background-color: #2d2d2d;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.rs-table-scrollbar-handle {
|
|
244
|
+
background-color: #5a5a5a;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.qbs-table[dir='rtl'] {
|
|
249
|
+
.rs-table-cell-header .rs-table-cell-content {
|
|
250
|
+
text-align: right;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.rs-table-cell-wrap {
|
|
254
|
+
justify-content: flex-start;
|
|
255
|
+
width: 100%;
|
|
256
|
+
}
|
|
113
257
|
}
|
|
114
258
|
/* Dropdown container */
|
|
115
259
|
.qbs-table-menu-dropdown {
|
|
@@ -6,8 +6,10 @@ import ColumnGroup from '../ColumnGroup';
|
|
|
6
6
|
import HeaderCell from '../HeaderCell';
|
|
7
7
|
import Pagination from '../Pagination';
|
|
8
8
|
import Table from '../Table';
|
|
9
|
+
import isRTL from '../utils/isRTL';
|
|
9
10
|
import useResponsiveStore from '../utils/useResponsiveStore';
|
|
10
11
|
import { QbsColumnProps, QbsTableProps } from './commontypes';
|
|
12
|
+
import { mergeLabels } from './labels';
|
|
11
13
|
import {
|
|
12
14
|
ActionCell,
|
|
13
15
|
CheckCell,
|
|
@@ -60,6 +62,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
60
62
|
rowExpand = false,
|
|
61
63
|
actionProps = [],
|
|
62
64
|
theme,
|
|
65
|
+
rtl: rtlProp,
|
|
63
66
|
handleMenuActions,
|
|
64
67
|
onRowClick,
|
|
65
68
|
expandedRowKeys,
|
|
@@ -106,12 +109,18 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
106
109
|
dropType = 'horizondal',
|
|
107
110
|
rowHeight,
|
|
108
111
|
isFullScreen,
|
|
109
|
-
showHeader = true
|
|
112
|
+
showHeader = true,
|
|
113
|
+
labels: labelsProp
|
|
110
114
|
}) => {
|
|
115
|
+
const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
|
|
111
116
|
const [loading, setLoading] = useState(false);
|
|
112
117
|
const [columns, setColumns] = useState(propColumn);
|
|
113
118
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
114
|
-
const dataTheme = useMemo(
|
|
119
|
+
const dataTheme = useMemo(
|
|
120
|
+
() => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
|
|
121
|
+
[theme]
|
|
122
|
+
);
|
|
123
|
+
const rtl = rtlProp ?? isRTL();
|
|
115
124
|
const [isOpen, setIsOpen] = useState(false);
|
|
116
125
|
const prevColumns = useRef<any | null>(null);
|
|
117
126
|
const [tableViewToggle, setTableViewToggle] = useState(tableView);
|
|
@@ -273,11 +282,25 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
273
282
|
fullWidthView: fullWidthView,
|
|
274
283
|
setTableFullView: setTableFullView,
|
|
275
284
|
setRowViewToggle: setRowViewToggle,
|
|
276
|
-
isFullScreen: isFullScreen
|
|
285
|
+
isFullScreen: isFullScreen,
|
|
286
|
+
labels
|
|
277
287
|
};
|
|
278
|
-
const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
|
|
279
288
|
|
|
280
289
|
useEffect(() => {
|
|
290
|
+
if (!dataTheme || typeof document === 'undefined') return;
|
|
291
|
+
|
|
292
|
+
document.body.setAttribute('data-theme', dataTheme === 'dark' ? 'dark' : 'light');
|
|
293
|
+
document.documentElement.dataset.theme = dataTheme;
|
|
294
|
+
}, [dataTheme]);
|
|
295
|
+
|
|
296
|
+
const themeToggle = useMemo(
|
|
297
|
+
() => (typeof document !== 'undefined' ? document.getElementById('themeToggle') : null),
|
|
298
|
+
[]
|
|
299
|
+
) as HTMLInputElement | null;
|
|
300
|
+
|
|
301
|
+
useEffect(() => {
|
|
302
|
+
if (theme || typeof document === 'undefined') return;
|
|
303
|
+
|
|
281
304
|
const handleThemeToggle = () => {
|
|
282
305
|
if (themeToggle?.checked) {
|
|
283
306
|
document.body.setAttribute('data-theme', 'dark');
|
|
@@ -302,7 +325,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
302
325
|
themeToggle?.removeEventListener('change', handleThemeToggle);
|
|
303
326
|
document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
|
|
304
327
|
};
|
|
305
|
-
}, [themeToggle]);
|
|
328
|
+
}, [theme, themeToggle]);
|
|
306
329
|
|
|
307
330
|
const handleExpanded = useCallback(
|
|
308
331
|
(rowData: any) => {
|
|
@@ -609,7 +632,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
609
632
|
};
|
|
610
633
|
|
|
611
634
|
return (
|
|
612
|
-
<div
|
|
635
|
+
<div
|
|
636
|
+
className={`qbs-table ${classes.tableContainerClass}`}
|
|
637
|
+
data-theme={dataTheme}
|
|
638
|
+
dir={rtl ? 'rtl' : 'ltr'}
|
|
639
|
+
>
|
|
613
640
|
{toolbar && <ToolBar {...toolbarProps} />}
|
|
614
641
|
<div className="qbs-table-border-wrap">
|
|
615
642
|
{tableViewToggle ? (
|
|
@@ -618,6 +645,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
618
645
|
key={tableKey + REFRESH_KEY}
|
|
619
646
|
tableKey={tableKey}
|
|
620
647
|
data={data}
|
|
648
|
+
rtl={rtl}
|
|
621
649
|
tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
|
|
622
650
|
dataTheme={dataTheme}
|
|
623
651
|
wordWrap={wordWrap}
|
|
@@ -638,7 +666,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
638
666
|
renderEmpty ? (
|
|
639
667
|
renderEmpty(info)
|
|
640
668
|
) : (
|
|
641
|
-
<NoData title={emptyTitle ??
|
|
669
|
+
<NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
|
|
642
670
|
)
|
|
643
671
|
}
|
|
644
672
|
columns={columns}
|
|
@@ -760,6 +788,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
760
788
|
setIsOpen={setIsOpen}
|
|
761
789
|
handleResetColumns={handleResetColumns}
|
|
762
790
|
handleColumnToggle={handleColumnToggle}
|
|
791
|
+
labels={labels}
|
|
763
792
|
/>
|
|
764
793
|
</HeaderCell>
|
|
765
794
|
<Cell />
|
|
@@ -787,6 +816,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
787
816
|
setIsOpen={setIsOpen}
|
|
788
817
|
handleResetColumns={handleResetColumns}
|
|
789
818
|
handleColumnToggle={handleColumnToggle}
|
|
819
|
+
labels={labels}
|
|
790
820
|
/>
|
|
791
821
|
)}
|
|
792
822
|
</HeaderCell>
|
|
@@ -819,7 +849,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
819
849
|
>
|
|
820
850
|
{(data?.length === 0 || !data) && !isLoading && (
|
|
821
851
|
<div className="flex flex-col gap-2 p-2 mt-6 card-empty-container">
|
|
822
|
-
<NoData title={emptyTitle ??
|
|
852
|
+
<NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
|
|
823
853
|
</div>
|
|
824
854
|
)}
|
|
825
855
|
{isLoading ? (
|
|
@@ -846,6 +876,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
846
876
|
columns={columns}
|
|
847
877
|
tableBodyRef={tableBodyRef}
|
|
848
878
|
actionProps={actionProps}
|
|
879
|
+
labels={labels}
|
|
849
880
|
/>
|
|
850
881
|
)}
|
|
851
882
|
</div>
|
|
@@ -854,7 +885,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
854
885
|
</div>
|
|
855
886
|
)}
|
|
856
887
|
<div>
|
|
857
|
-
{pagination && data?.length > 0 &&
|
|
888
|
+
{pagination && data?.length > 0 && (
|
|
889
|
+
<Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
|
|
890
|
+
)}
|
|
858
891
|
</div>
|
|
859
892
|
</div>
|
|
860
893
|
</div>
|
|
@@ -7,6 +7,7 @@ import HeaderCell from '../HeaderCell';
|
|
|
7
7
|
import Pagination from '../Pagination';
|
|
8
8
|
import Table from '../Table';
|
|
9
9
|
import { QbsColumnProps, QbsTableProps } from './commontypes';
|
|
10
|
+
import { mergeLabels } from './labels';
|
|
10
11
|
import {
|
|
11
12
|
ActionCell,
|
|
12
13
|
CheckCell,
|
|
@@ -82,12 +83,17 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
82
83
|
autoHeight,
|
|
83
84
|
emptySubTitle,
|
|
84
85
|
emptyTitle,
|
|
85
|
-
dropType = 'horizontal'
|
|
86
|
+
dropType = 'horizontal',
|
|
87
|
+
labels: labelsProp
|
|
86
88
|
}) => {
|
|
89
|
+
const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
|
|
87
90
|
const [loading, setLoading] = useState(false);
|
|
88
91
|
const [columns, setColumns] = useState(propColumn);
|
|
89
92
|
const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
|
|
90
|
-
const dataTheme = useMemo(
|
|
93
|
+
const dataTheme = useMemo(
|
|
94
|
+
() => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
|
|
95
|
+
[theme]
|
|
96
|
+
);
|
|
91
97
|
const [isOpen, setIsOpen] = useState(false);
|
|
92
98
|
const prevColumns = useRef<any | null>(null);
|
|
93
99
|
const tableBodyRef = useRef<HTMLDivElement>(null);
|
|
@@ -228,11 +234,25 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
228
234
|
onSelect: handleClear,
|
|
229
235
|
handleColumnToggle: handleColumnToggle,
|
|
230
236
|
dataLength: data?.length,
|
|
231
|
-
searchPlaceholder: searchPlaceholder
|
|
237
|
+
searchPlaceholder: searchPlaceholder,
|
|
238
|
+
labels
|
|
232
239
|
};
|
|
233
|
-
const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
|
|
234
240
|
|
|
235
241
|
useEffect(() => {
|
|
242
|
+
if (!dataTheme || typeof document === 'undefined') return;
|
|
243
|
+
|
|
244
|
+
document.body.setAttribute('data-theme', dataTheme === 'dark' ? 'dark' : 'light');
|
|
245
|
+
document.documentElement.dataset.theme = dataTheme;
|
|
246
|
+
}, [dataTheme]);
|
|
247
|
+
|
|
248
|
+
const themeToggle = useMemo(
|
|
249
|
+
() => (typeof document !== 'undefined' ? document.getElementById('themeToggle') : null),
|
|
250
|
+
[]
|
|
251
|
+
) as HTMLInputElement | null;
|
|
252
|
+
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
if (theme || typeof document === 'undefined') return;
|
|
255
|
+
|
|
236
256
|
const handleThemeToggle = () => {
|
|
237
257
|
if (themeToggle?.checked) {
|
|
238
258
|
document.body.setAttribute('data-theme', 'dark');
|
|
@@ -257,7 +277,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
257
277
|
themeToggle?.removeEventListener('change', handleThemeToggle);
|
|
258
278
|
document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
|
|
259
279
|
};
|
|
260
|
-
}, [themeToggle]);
|
|
280
|
+
}, [theme, themeToggle]);
|
|
261
281
|
|
|
262
282
|
const handleExpanded = useCallback(
|
|
263
283
|
(rowData: any) => {
|
|
@@ -463,7 +483,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
463
483
|
renderEmpty ? (
|
|
464
484
|
renderEmpty(info)
|
|
465
485
|
) : (
|
|
466
|
-
<NoData title={emptyTitle ??
|
|
486
|
+
<NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
|
|
467
487
|
)
|
|
468
488
|
}
|
|
469
489
|
columns={columns}
|
|
@@ -581,6 +601,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
581
601
|
setIsOpen={setIsOpen}
|
|
582
602
|
handleResetColumns={handleResetColumns}
|
|
583
603
|
handleColumnToggle={handleColumnToggle}
|
|
604
|
+
labels={labels}
|
|
584
605
|
/>
|
|
585
606
|
</HeaderCell>
|
|
586
607
|
<Cell />
|
|
@@ -606,6 +627,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
606
627
|
setIsOpen={setIsOpen}
|
|
607
628
|
handleResetColumns={handleResetColumns}
|
|
608
629
|
handleColumnToggle={handleColumnToggle}
|
|
630
|
+
labels={labels}
|
|
609
631
|
/>
|
|
610
632
|
)}
|
|
611
633
|
</HeaderCell>
|
|
@@ -622,7 +644,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
622
644
|
</Table>
|
|
623
645
|
|
|
624
646
|
<div>
|
|
625
|
-
{pagination && data?.length > 0 &&
|
|
647
|
+
{pagination && data?.length > 0 && (
|
|
648
|
+
<Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
|
|
649
|
+
)}
|
|
626
650
|
</div>
|
|
627
651
|
</div>
|
|
628
652
|
</div>
|