qbs-react-grid 1.1.10 → 1.1.11
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/es/qbsTable/QbsTable.js +25 -9
- package/lib/qbsTable/QbsTable.js +25 -9
- package/package.json +1 -1
- package/src/qbsTable/QbsTable.tsx +33 -8
package/es/qbsTable/QbsTable.js
CHANGED
|
@@ -129,17 +129,33 @@ var QbsTable = function QbsTable(_ref) {
|
|
|
129
129
|
}
|
|
130
130
|
}, [checkedKeys]);
|
|
131
131
|
var handleToggle = useCallback(function (columnName) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
var lastVisibleColumn = null;
|
|
133
|
+
var visibleCount = 0;
|
|
134
|
+
var updatedColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (col) {
|
|
135
|
+
// Toggle visibility for the matched column
|
|
136
|
+
if (col.title === columnName) {
|
|
137
|
+
col = _extends({}, col, {
|
|
135
138
|
isVisible: !col.isVisible
|
|
136
|
-
})
|
|
137
|
-
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (col.isVisible) {
|
|
142
|
+
lastVisibleColumn = col;
|
|
143
|
+
visibleCount++;
|
|
144
|
+
}
|
|
145
|
+
return col;
|
|
138
146
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
if (visibleCount > 0 && lastVisibleColumn) {
|
|
148
|
+
updatedColumns.forEach(function (col) {
|
|
149
|
+
var _lastVisibleColumn;
|
|
150
|
+
if (col.field === ((_lastVisibleColumn = lastVisibleColumn) === null || _lastVisibleColumn === void 0 ? void 0 : _lastVisibleColumn.field)) {
|
|
151
|
+
col.resizable = false;
|
|
152
|
+
} else {
|
|
153
|
+
col.resizable = true;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
setColumns(updatedColumns);
|
|
158
|
+
}, [columns]);
|
|
143
159
|
var handleColumnWidth = useCallback(function (newWidth, dataKey) {
|
|
144
160
|
if (newWidth === undefined || dataKey === undefined) return;
|
|
145
161
|
setColumns(function (prevColumns) {
|
package/lib/qbsTable/QbsTable.js
CHANGED
|
@@ -136,17 +136,33 @@ var QbsTable = function QbsTable(_ref) {
|
|
|
136
136
|
}
|
|
137
137
|
}, [checkedKeys]);
|
|
138
138
|
var handleToggle = (0, _react.useCallback)(function (columnName) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
var lastVisibleColumn = null;
|
|
140
|
+
var visibleCount = 0;
|
|
141
|
+
var updatedColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (col) {
|
|
142
|
+
// Toggle visibility for the matched column
|
|
143
|
+
if (col.title === columnName) {
|
|
144
|
+
col = (0, _extends2["default"])({}, col, {
|
|
142
145
|
isVisible: !col.isVisible
|
|
143
|
-
})
|
|
144
|
-
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
if (col.isVisible) {
|
|
149
|
+
lastVisibleColumn = col;
|
|
150
|
+
visibleCount++;
|
|
151
|
+
}
|
|
152
|
+
return col;
|
|
145
153
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
if (visibleCount > 0 && lastVisibleColumn) {
|
|
155
|
+
updatedColumns.forEach(function (col) {
|
|
156
|
+
var _lastVisibleColumn;
|
|
157
|
+
if (col.field === ((_lastVisibleColumn = lastVisibleColumn) === null || _lastVisibleColumn === void 0 ? void 0 : _lastVisibleColumn.field)) {
|
|
158
|
+
col.resizable = false;
|
|
159
|
+
} else {
|
|
160
|
+
col.resizable = true;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
setColumns(updatedColumns);
|
|
165
|
+
}, [columns]);
|
|
150
166
|
var handleColumnWidth = (0, _react.useCallback)(function (newWidth, dataKey) {
|
|
151
167
|
if (newWidth === undefined || dataKey === undefined) return;
|
|
152
168
|
setColumns(function (prevColumns) {
|
package/package.json
CHANGED
|
@@ -118,14 +118,39 @@ const QbsTable: React.FC<QbsTableProps> = ({
|
|
|
118
118
|
|
|
119
119
|
[checkedKeys]
|
|
120
120
|
);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
121
|
+
|
|
122
|
+
const handleToggle = useCallback(
|
|
123
|
+
(columnName: string) => {
|
|
124
|
+
let lastVisibleColumn: any = null;
|
|
125
|
+
let visibleCount = 0;
|
|
126
|
+
|
|
127
|
+
const updatedColumns = columns?.map(col => {
|
|
128
|
+
// Toggle visibility for the matched column
|
|
129
|
+
if (col.title === columnName) {
|
|
130
|
+
col = { ...col, isVisible: !col.isVisible };
|
|
131
|
+
}
|
|
132
|
+
if (col.isVisible) {
|
|
133
|
+
lastVisibleColumn = col;
|
|
134
|
+
visibleCount++;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return col;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (visibleCount > 0 && lastVisibleColumn) {
|
|
141
|
+
updatedColumns.forEach(col => {
|
|
142
|
+
if (col.field === lastVisibleColumn?.field) {
|
|
143
|
+
col.resizable = false;
|
|
144
|
+
} else {
|
|
145
|
+
col.resizable = true;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
setColumns(updatedColumns);
|
|
151
|
+
},
|
|
152
|
+
[columns]
|
|
153
|
+
);
|
|
129
154
|
|
|
130
155
|
const handleColumnWidth = useCallback((newWidth?: number, dataKey?: any) => {
|
|
131
156
|
if (newWidth === undefined || dataKey === undefined) return;
|