akeyless-client-commons 1.0.227 → 1.0.229
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/components/index.css.map +1 -1
- package/dist/components/index.js +280 -9
- package/dist/components/index.mjs +280 -9
- package/dist/helpers/index.d.mts +34 -2
- package/dist/helpers/index.d.ts +34 -2
- package/dist/helpers/index.js +295 -0
- package/dist/helpers/index.mjs +292 -1
- package/dist/hooks/index.d.mts +5 -1
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +374 -1
- package/dist/hooks/index.mjs +370 -1
- package/package.json +4 -2
package/dist/components/index.js
CHANGED
|
@@ -1155,6 +1155,278 @@ var biDomain = isLocal ? "http://localhost:9002/api/bi" : baseDomain + "/bi";
|
|
|
1155
1155
|
var notificationsDomain = isLocal ? "http://localhost:9006/api/notifications" : baseDomain + "/notifications";
|
|
1156
1156
|
var callCenterGeoDomain = isLocal ? "http://localhost:9007/api/call-center/geo" : baseDomain + "/call-center/geo";
|
|
1157
1157
|
var callCenterEventsDomain = isLocal ? "http://localhost:9008/api/call-center/events" : baseDomain + "/call-center/events";
|
|
1158
|
+
// src/helpers/socket.ts
|
|
1159
|
+
var import_socket = require("socket.io-client");
|
|
1160
|
+
var SocketService = /*#__PURE__*/ function() {
|
|
1161
|
+
"use strict";
|
|
1162
|
+
function _SocketService() {
|
|
1163
|
+
_class_call_check(this, _SocketService);
|
|
1164
|
+
this.socket = null;
|
|
1165
|
+
this.connectCallbacks = [];
|
|
1166
|
+
this.disconnectCallbacks = [];
|
|
1167
|
+
this.initSocket();
|
|
1168
|
+
}
|
|
1169
|
+
_create_class(_SocketService, [
|
|
1170
|
+
{
|
|
1171
|
+
/// Initialize the socket connection
|
|
1172
|
+
key: "initSocket",
|
|
1173
|
+
value: function initSocket() {
|
|
1174
|
+
var _this = this;
|
|
1175
|
+
if (!this.socket) {
|
|
1176
|
+
var SOCKET_SERVER_URL = "http://localhost:9009";
|
|
1177
|
+
var SOCKET_PATH = "/api/data-socket/connect";
|
|
1178
|
+
this.socket = (0, import_socket.io)(SOCKET_SERVER_URL, {
|
|
1179
|
+
path: SOCKET_PATH,
|
|
1180
|
+
transports: [
|
|
1181
|
+
"websocket"
|
|
1182
|
+
]
|
|
1183
|
+
});
|
|
1184
|
+
this.socket.on("connect", function() {
|
|
1185
|
+
var _this_socket;
|
|
1186
|
+
console.log("Socket connected:", (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id);
|
|
1187
|
+
_this.connectCallbacks.forEach(function(cb) {
|
|
1188
|
+
return cb();
|
|
1189
|
+
});
|
|
1190
|
+
});
|
|
1191
|
+
this.socket.on("disconnect", function(reason) {
|
|
1192
|
+
console.log("Socket disconnected:", reason);
|
|
1193
|
+
_this.disconnectCallbacks.forEach(function(cb) {
|
|
1194
|
+
return cb();
|
|
1195
|
+
});
|
|
1196
|
+
});
|
|
1197
|
+
this.socket.on("connect_error", function(error) {
|
|
1198
|
+
console.error("Socket connection error:", error);
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
/// get socket instance
|
|
1205
|
+
key: "getSocketInstance",
|
|
1206
|
+
value: function getSocketInstance() {
|
|
1207
|
+
if (!this.socket) {
|
|
1208
|
+
this.initSocket();
|
|
1209
|
+
}
|
|
1210
|
+
if (!this.socket) {
|
|
1211
|
+
throw new Error("Socket not initialized");
|
|
1212
|
+
}
|
|
1213
|
+
if (!this.socket.connected) {
|
|
1214
|
+
this.socket.connect();
|
|
1215
|
+
}
|
|
1216
|
+
return this.socket;
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
/// subscribe to collections
|
|
1221
|
+
key: "subscribeToCollections",
|
|
1222
|
+
value: function subscribeToCollections(config) {
|
|
1223
|
+
var s = this.getSocketInstance();
|
|
1224
|
+
var collectionsNames = config.map(function(c) {
|
|
1225
|
+
return c.collectionName;
|
|
1226
|
+
});
|
|
1227
|
+
var eventHandlers = [];
|
|
1228
|
+
config.forEach(function(configuration) {
|
|
1229
|
+
var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
|
|
1230
|
+
s.on("initial:".concat(collectionName), onFirstTime);
|
|
1231
|
+
eventHandlers.push({
|
|
1232
|
+
eventName: "initial:".concat(collectionName),
|
|
1233
|
+
handler: onFirstTime
|
|
1234
|
+
});
|
|
1235
|
+
s.on("add:".concat(collectionName), onAdd);
|
|
1236
|
+
eventHandlers.push({
|
|
1237
|
+
eventName: "add:".concat(collectionName),
|
|
1238
|
+
handler: onAdd
|
|
1239
|
+
});
|
|
1240
|
+
s.on("update:".concat(collectionName), onModify);
|
|
1241
|
+
eventHandlers.push({
|
|
1242
|
+
eventName: "update:".concat(collectionName),
|
|
1243
|
+
handler: onModify
|
|
1244
|
+
});
|
|
1245
|
+
s.on("delete:".concat(collectionName), onRemove);
|
|
1246
|
+
eventHandlers.push({
|
|
1247
|
+
eventName: "delete:".concat(collectionName),
|
|
1248
|
+
handler: onRemove
|
|
1249
|
+
});
|
|
1250
|
+
extraParsers === null || extraParsers === void 0 ? void 0 : extraParsers.forEach(function(parsers) {
|
|
1251
|
+
var extraOnAdd = parsers.onAdd, extraOnFirstTime = parsers.onFirstTime, extraOnModify = parsers.onModify, extraOnRemove = parsers.onRemove;
|
|
1252
|
+
s.on("initial:".concat(collectionName), extraOnFirstTime);
|
|
1253
|
+
eventHandlers.push({
|
|
1254
|
+
eventName: "initial:".concat(collectionName),
|
|
1255
|
+
handler: extraOnFirstTime
|
|
1256
|
+
});
|
|
1257
|
+
s.on("add:".concat(collectionName), extraOnAdd);
|
|
1258
|
+
eventHandlers.push({
|
|
1259
|
+
eventName: "add:".concat(collectionName),
|
|
1260
|
+
handler: extraOnAdd
|
|
1261
|
+
});
|
|
1262
|
+
s.on("update:".concat(collectionName), extraOnModify);
|
|
1263
|
+
eventHandlers.push({
|
|
1264
|
+
eventName: "update:".concat(collectionName),
|
|
1265
|
+
handler: extraOnModify
|
|
1266
|
+
});
|
|
1267
|
+
s.on("delete:".concat(collectionName), extraOnRemove);
|
|
1268
|
+
eventHandlers.push({
|
|
1269
|
+
eventName: "delete:".concat(collectionName),
|
|
1270
|
+
handler: extraOnRemove
|
|
1271
|
+
});
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1274
|
+
s.emit("subscribe_collections", collectionsNames, function(callback) {
|
|
1275
|
+
if (callback.success) {
|
|
1276
|
+
console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
|
|
1277
|
+
} else {
|
|
1278
|
+
console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
return function() {
|
|
1282
|
+
console.log("Cleaning up subscriptions for: ".concat(collectionsNames.join(", ")));
|
|
1283
|
+
s.emit("unsubscribe_collections", collectionsNames);
|
|
1284
|
+
eventHandlers.forEach(function(eh) {
|
|
1285
|
+
s.off(eh.eventName, eh.handler);
|
|
1286
|
+
});
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
/// set data
|
|
1292
|
+
key: "setData",
|
|
1293
|
+
value: function setData(payload) {
|
|
1294
|
+
var s = this.getSocketInstance();
|
|
1295
|
+
return new Promise(function(resolve, reject) {
|
|
1296
|
+
s.emit("set_data", payload, function(callback) {
|
|
1297
|
+
if (callback.success) {
|
|
1298
|
+
console.log("Data saved successfully:", payload);
|
|
1299
|
+
console.log("ack", callback);
|
|
1300
|
+
resolve(callback);
|
|
1301
|
+
} else {
|
|
1302
|
+
reject(new Error(callback.message || "Save operation failed"));
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
/// get data
|
|
1310
|
+
key: "getCollectionData",
|
|
1311
|
+
value: function getCollectionData(payload) {
|
|
1312
|
+
var s = this.getSocketInstance();
|
|
1313
|
+
s.emit("get_data", {
|
|
1314
|
+
collection_name: payload.collection_name
|
|
1315
|
+
}, function(socketCallback) {
|
|
1316
|
+
if (socketCallback.success && socketCallback.data) {
|
|
1317
|
+
payload.callback(socketCallback.data);
|
|
1318
|
+
} else {
|
|
1319
|
+
payload.callback(payload.defaultValue);
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
key: "getDocumentData",
|
|
1326
|
+
value: function getDocumentData(payload) {
|
|
1327
|
+
var s = this.getSocketInstance();
|
|
1328
|
+
s.emit("get_data", {
|
|
1329
|
+
collection_name: payload.collection_name,
|
|
1330
|
+
key: payload.key
|
|
1331
|
+
}, function(socketCallback) {
|
|
1332
|
+
if (socketCallback.success && socketCallback.data) {
|
|
1333
|
+
payload.callback(socketCallback.data);
|
|
1334
|
+
} else {
|
|
1335
|
+
payload.callback(payload.defaultValue);
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
/// delete data
|
|
1342
|
+
key: "deleteData",
|
|
1343
|
+
value: function deleteData(payload) {
|
|
1344
|
+
var s = this.getSocketInstance();
|
|
1345
|
+
return new Promise(function(resolve, reject) {
|
|
1346
|
+
s.emit("delete_data", payload, function(callback) {
|
|
1347
|
+
if (callback.success) {
|
|
1348
|
+
console.log("Data deleted successfully:", payload);
|
|
1349
|
+
console.log("delete ack", callback);
|
|
1350
|
+
resolve(callback);
|
|
1351
|
+
} else {
|
|
1352
|
+
reject(new Error(callback.message || "Delete operation failed"));
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
key: "clearAllRedisData",
|
|
1360
|
+
value: function clearAllRedisData() {
|
|
1361
|
+
var s = this.getSocketInstance();
|
|
1362
|
+
return new Promise(function(resolve, reject) {
|
|
1363
|
+
s.emit("clear_all_redis_data", function(ack) {
|
|
1364
|
+
if (ack.success) {
|
|
1365
|
+
resolve(ack);
|
|
1366
|
+
} else {
|
|
1367
|
+
reject(new Error(ack.message || "Clear all Redis data operation failed"));
|
|
1368
|
+
}
|
|
1369
|
+
});
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
/// connection management methods
|
|
1375
|
+
key: "onConnect",
|
|
1376
|
+
value: function onConnect(callback) {
|
|
1377
|
+
var _this_socket;
|
|
1378
|
+
this.connectCallbacks.push(callback);
|
|
1379
|
+
if ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) {
|
|
1380
|
+
callback();
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
key: "offConnect",
|
|
1386
|
+
value: function offConnect(callback) {
|
|
1387
|
+
this.connectCallbacks = this.connectCallbacks.filter(function(cb) {
|
|
1388
|
+
return cb !== callback;
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
key: "onDisconnect",
|
|
1394
|
+
value: function onDisconnect(callback) {
|
|
1395
|
+
this.disconnectCallbacks.push(callback);
|
|
1396
|
+
if (this.socket && !this.socket.connected) {
|
|
1397
|
+
callback();
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
key: "offDisconnect",
|
|
1403
|
+
value: function offDisconnect(callback) {
|
|
1404
|
+
this.disconnectCallbacks = this.disconnectCallbacks.filter(function(cb) {
|
|
1405
|
+
return cb !== callback;
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
key: "isConnected",
|
|
1411
|
+
value: function isConnected() {
|
|
1412
|
+
var _this_socket;
|
|
1413
|
+
return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
], [
|
|
1417
|
+
{
|
|
1418
|
+
key: "getInstance",
|
|
1419
|
+
value: function getInstance() {
|
|
1420
|
+
if (!_SocketService.instance) {
|
|
1421
|
+
_SocketService.instance = new _SocketService();
|
|
1422
|
+
}
|
|
1423
|
+
return _SocketService.instance;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
]);
|
|
1427
|
+
return _SocketService;
|
|
1428
|
+
}();
|
|
1429
|
+
var socketServiceInstance = SocketService.getInstance();
|
|
1158
1430
|
// src/components/utils/Checkboxes.tsx
|
|
1159
1431
|
var import_react2 = require("react");
|
|
1160
1432
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1699,7 +1971,6 @@ var TableProvider = function(props) {
|
|
|
1699
1971
|
exportToExcelKeys = props.exportToExcelKeys, dataToAddToExcelTable = props.dataToAddToExcelTable, _props_exportExcelTitle = props.exportExcelTitle, exportExcelTitle = _props_exportExcelTitle === void 0 ? "Export to excel" : _props_exportExcelTitle, excelFileName = props.excelFileName, // summary
|
|
1700
1972
|
sumColumns = props.sumColumns, _props_summaryLabel = props.summaryLabel, summaryLabel = _props_summaryLabel === void 0 ? "" : _props_summaryLabel, _props_summaryContainerStyle = props.summaryContainerStyle, summaryContainerStyle = _props_summaryContainerStyle === void 0 ? {} : _props_summaryContainerStyle, _props_summaryLabelStyle = props.summaryLabelStyle, summaryLabelStyle = _props_summaryLabelStyle === void 0 ? {} : _props_summaryLabelStyle, _props_summaryRowStyle = props.summaryRowStyle, summaryRowStyle = _props_summaryRowStyle === void 0 ? {} : _props_summaryRowStyle, _props_maxRows = props.// max rows
|
|
1701
1973
|
maxRows, maxRows = _props_maxRows === void 0 ? data.length : _props_maxRows, _props_noneSearchKeys = props.noneSearchKeys, noneSearchKeys = _props_noneSearchKeys === void 0 ? [] : _props_noneSearchKeys, showDisplayAllRowsButton = props.showDisplayAllRowsButton;
|
|
1702
|
-
var normalizedNoneSearchKeys = noneSearchKeys || [];
|
|
1703
1974
|
var _useSort = useSort(), sortColumn = _useSort.sortColumn, sortOrder = _useSort.sortOrder, handleSort = _useSort.handleSort, clearSort = _useSort.clearSort;
|
|
1704
1975
|
var _useDisplayToggle = useDisplayToggle(), displayAllRows = _useDisplayToggle.displayAllRows, setDisplayAllRows = _useDisplayToggle.setDisplayAllRows;
|
|
1705
1976
|
var _useSearch = useSearch(), searchQuery = _useSearch.searchQuery, handleSearch = _useSearch.handleSearch, debouncedSearchQuery = _useSearch.debouncedSearchQuery;
|
|
@@ -1725,7 +1996,7 @@ var TableProvider = function(props) {
|
|
|
1725
1996
|
};
|
|
1726
1997
|
var normalizedSearchQuery = cleanString(debouncedSearchQuery);
|
|
1727
1998
|
var keys = allKeys.filter(function(val) {
|
|
1728
|
-
return !
|
|
1999
|
+
return !noneSearchKeys.includes(val);
|
|
1729
2000
|
});
|
|
1730
2001
|
filtered = data.filter(function(item) {
|
|
1731
2002
|
return keys.some(function(key) {
|
|
@@ -1766,7 +2037,7 @@ var TableProvider = function(props) {
|
|
|
1766
2037
|
filters,
|
|
1767
2038
|
data,
|
|
1768
2039
|
displayAllRows,
|
|
1769
|
-
|
|
2040
|
+
noneSearchKeys,
|
|
1770
2041
|
filterableColumns,
|
|
1771
2042
|
filterPopupsDisplay
|
|
1772
2043
|
]);
|
|
@@ -3698,14 +3969,14 @@ function rectsAreEqual(a, b) {
|
|
|
3698
3969
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3699
3970
|
}
|
|
3700
3971
|
function observeMove(element, onMove) {
|
|
3701
|
-
var
|
|
3972
|
+
var io2 = null;
|
|
3702
3973
|
var timeoutId;
|
|
3703
3974
|
var root = getDocumentElement(element);
|
|
3704
3975
|
function cleanup() {
|
|
3705
3976
|
var _io;
|
|
3706
3977
|
clearTimeout(timeoutId);
|
|
3707
|
-
(_io =
|
|
3708
|
-
|
|
3978
|
+
(_io = io2) == null || _io.disconnect();
|
|
3979
|
+
io2 = null;
|
|
3709
3980
|
}
|
|
3710
3981
|
function refresh(skip, threshold) {
|
|
3711
3982
|
if (skip === void 0) {
|
|
@@ -3753,14 +4024,14 @@ function observeMove(element, onMove) {
|
|
|
3753
4024
|
isFirstUpdate = false;
|
|
3754
4025
|
}
|
|
3755
4026
|
try {
|
|
3756
|
-
|
|
4027
|
+
io2 = new IntersectionObserver(handleObserve, _object_spread_props(_object_spread({}, options), {
|
|
3757
4028
|
// Handle <iframe>s
|
|
3758
4029
|
root: root.ownerDocument
|
|
3759
4030
|
}));
|
|
3760
4031
|
} catch (e) {
|
|
3761
|
-
|
|
4032
|
+
io2 = new IntersectionObserver(handleObserve, options);
|
|
3762
4033
|
}
|
|
3763
|
-
|
|
4034
|
+
io2.observe(element);
|
|
3764
4035
|
}
|
|
3765
4036
|
refresh(true);
|
|
3766
4037
|
return cleanup;
|
|
@@ -939,6 +939,278 @@ var biDomain = isLocal ? "http://localhost:9002/api/bi" : baseDomain + "/bi";
|
|
|
939
939
|
var notificationsDomain = isLocal ? "http://localhost:9006/api/notifications" : baseDomain + "/notifications";
|
|
940
940
|
var callCenterGeoDomain = isLocal ? "http://localhost:9007/api/call-center/geo" : baseDomain + "/call-center/geo";
|
|
941
941
|
var callCenterEventsDomain = isLocal ? "http://localhost:9008/api/call-center/events" : baseDomain + "/call-center/events";
|
|
942
|
+
// src/helpers/socket.ts
|
|
943
|
+
import { io } from "socket.io-client";
|
|
944
|
+
var SocketService = /*#__PURE__*/ function() {
|
|
945
|
+
"use strict";
|
|
946
|
+
function _SocketService() {
|
|
947
|
+
_class_call_check(this, _SocketService);
|
|
948
|
+
this.socket = null;
|
|
949
|
+
this.connectCallbacks = [];
|
|
950
|
+
this.disconnectCallbacks = [];
|
|
951
|
+
this.initSocket();
|
|
952
|
+
}
|
|
953
|
+
_create_class(_SocketService, [
|
|
954
|
+
{
|
|
955
|
+
/// Initialize the socket connection
|
|
956
|
+
key: "initSocket",
|
|
957
|
+
value: function initSocket() {
|
|
958
|
+
var _this = this;
|
|
959
|
+
if (!this.socket) {
|
|
960
|
+
var SOCKET_SERVER_URL = "http://localhost:9009";
|
|
961
|
+
var SOCKET_PATH = "/api/data-socket/connect";
|
|
962
|
+
this.socket = io(SOCKET_SERVER_URL, {
|
|
963
|
+
path: SOCKET_PATH,
|
|
964
|
+
transports: [
|
|
965
|
+
"websocket"
|
|
966
|
+
]
|
|
967
|
+
});
|
|
968
|
+
this.socket.on("connect", function() {
|
|
969
|
+
var _this_socket;
|
|
970
|
+
console.log("Socket connected:", (_this_socket = _this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.id);
|
|
971
|
+
_this.connectCallbacks.forEach(function(cb) {
|
|
972
|
+
return cb();
|
|
973
|
+
});
|
|
974
|
+
});
|
|
975
|
+
this.socket.on("disconnect", function(reason) {
|
|
976
|
+
console.log("Socket disconnected:", reason);
|
|
977
|
+
_this.disconnectCallbacks.forEach(function(cb) {
|
|
978
|
+
return cb();
|
|
979
|
+
});
|
|
980
|
+
});
|
|
981
|
+
this.socket.on("connect_error", function(error) {
|
|
982
|
+
console.error("Socket connection error:", error);
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
/// get socket instance
|
|
989
|
+
key: "getSocketInstance",
|
|
990
|
+
value: function getSocketInstance() {
|
|
991
|
+
if (!this.socket) {
|
|
992
|
+
this.initSocket();
|
|
993
|
+
}
|
|
994
|
+
if (!this.socket) {
|
|
995
|
+
throw new Error("Socket not initialized");
|
|
996
|
+
}
|
|
997
|
+
if (!this.socket.connected) {
|
|
998
|
+
this.socket.connect();
|
|
999
|
+
}
|
|
1000
|
+
return this.socket;
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
/// subscribe to collections
|
|
1005
|
+
key: "subscribeToCollections",
|
|
1006
|
+
value: function subscribeToCollections(config) {
|
|
1007
|
+
var s = this.getSocketInstance();
|
|
1008
|
+
var collectionsNames = config.map(function(c) {
|
|
1009
|
+
return c.collectionName;
|
|
1010
|
+
});
|
|
1011
|
+
var eventHandlers = [];
|
|
1012
|
+
config.forEach(function(configuration) {
|
|
1013
|
+
var collectionName = configuration.collectionName, onAdd = configuration.onAdd, onFirstTime = configuration.onFirstTime, onModify = configuration.onModify, onRemove = configuration.onRemove, extraParsers = configuration.extraParsers, conditions = configuration.conditions, orderBy2 = configuration.orderBy;
|
|
1014
|
+
s.on("initial:".concat(collectionName), onFirstTime);
|
|
1015
|
+
eventHandlers.push({
|
|
1016
|
+
eventName: "initial:".concat(collectionName),
|
|
1017
|
+
handler: onFirstTime
|
|
1018
|
+
});
|
|
1019
|
+
s.on("add:".concat(collectionName), onAdd);
|
|
1020
|
+
eventHandlers.push({
|
|
1021
|
+
eventName: "add:".concat(collectionName),
|
|
1022
|
+
handler: onAdd
|
|
1023
|
+
});
|
|
1024
|
+
s.on("update:".concat(collectionName), onModify);
|
|
1025
|
+
eventHandlers.push({
|
|
1026
|
+
eventName: "update:".concat(collectionName),
|
|
1027
|
+
handler: onModify
|
|
1028
|
+
});
|
|
1029
|
+
s.on("delete:".concat(collectionName), onRemove);
|
|
1030
|
+
eventHandlers.push({
|
|
1031
|
+
eventName: "delete:".concat(collectionName),
|
|
1032
|
+
handler: onRemove
|
|
1033
|
+
});
|
|
1034
|
+
extraParsers === null || extraParsers === void 0 ? void 0 : extraParsers.forEach(function(parsers) {
|
|
1035
|
+
var extraOnAdd = parsers.onAdd, extraOnFirstTime = parsers.onFirstTime, extraOnModify = parsers.onModify, extraOnRemove = parsers.onRemove;
|
|
1036
|
+
s.on("initial:".concat(collectionName), extraOnFirstTime);
|
|
1037
|
+
eventHandlers.push({
|
|
1038
|
+
eventName: "initial:".concat(collectionName),
|
|
1039
|
+
handler: extraOnFirstTime
|
|
1040
|
+
});
|
|
1041
|
+
s.on("add:".concat(collectionName), extraOnAdd);
|
|
1042
|
+
eventHandlers.push({
|
|
1043
|
+
eventName: "add:".concat(collectionName),
|
|
1044
|
+
handler: extraOnAdd
|
|
1045
|
+
});
|
|
1046
|
+
s.on("update:".concat(collectionName), extraOnModify);
|
|
1047
|
+
eventHandlers.push({
|
|
1048
|
+
eventName: "update:".concat(collectionName),
|
|
1049
|
+
handler: extraOnModify
|
|
1050
|
+
});
|
|
1051
|
+
s.on("delete:".concat(collectionName), extraOnRemove);
|
|
1052
|
+
eventHandlers.push({
|
|
1053
|
+
eventName: "delete:".concat(collectionName),
|
|
1054
|
+
handler: extraOnRemove
|
|
1055
|
+
});
|
|
1056
|
+
});
|
|
1057
|
+
});
|
|
1058
|
+
s.emit("subscribe_collections", collectionsNames, function(callback) {
|
|
1059
|
+
if (callback.success) {
|
|
1060
|
+
console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
|
|
1061
|
+
} else {
|
|
1062
|
+
console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
return function() {
|
|
1066
|
+
console.log("Cleaning up subscriptions for: ".concat(collectionsNames.join(", ")));
|
|
1067
|
+
s.emit("unsubscribe_collections", collectionsNames);
|
|
1068
|
+
eventHandlers.forEach(function(eh) {
|
|
1069
|
+
s.off(eh.eventName, eh.handler);
|
|
1070
|
+
});
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
/// set data
|
|
1076
|
+
key: "setData",
|
|
1077
|
+
value: function setData(payload) {
|
|
1078
|
+
var s = this.getSocketInstance();
|
|
1079
|
+
return new Promise(function(resolve, reject) {
|
|
1080
|
+
s.emit("set_data", payload, function(callback) {
|
|
1081
|
+
if (callback.success) {
|
|
1082
|
+
console.log("Data saved successfully:", payload);
|
|
1083
|
+
console.log("ack", callback);
|
|
1084
|
+
resolve(callback);
|
|
1085
|
+
} else {
|
|
1086
|
+
reject(new Error(callback.message || "Save operation failed"));
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
/// get data
|
|
1094
|
+
key: "getCollectionData",
|
|
1095
|
+
value: function getCollectionData(payload) {
|
|
1096
|
+
var s = this.getSocketInstance();
|
|
1097
|
+
s.emit("get_data", {
|
|
1098
|
+
collection_name: payload.collection_name
|
|
1099
|
+
}, function(socketCallback) {
|
|
1100
|
+
if (socketCallback.success && socketCallback.data) {
|
|
1101
|
+
payload.callback(socketCallback.data);
|
|
1102
|
+
} else {
|
|
1103
|
+
payload.callback(payload.defaultValue);
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
{
|
|
1109
|
+
key: "getDocumentData",
|
|
1110
|
+
value: function getDocumentData(payload) {
|
|
1111
|
+
var s = this.getSocketInstance();
|
|
1112
|
+
s.emit("get_data", {
|
|
1113
|
+
collection_name: payload.collection_name,
|
|
1114
|
+
key: payload.key
|
|
1115
|
+
}, function(socketCallback) {
|
|
1116
|
+
if (socketCallback.success && socketCallback.data) {
|
|
1117
|
+
payload.callback(socketCallback.data);
|
|
1118
|
+
} else {
|
|
1119
|
+
payload.callback(payload.defaultValue);
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
/// delete data
|
|
1126
|
+
key: "deleteData",
|
|
1127
|
+
value: function deleteData(payload) {
|
|
1128
|
+
var s = this.getSocketInstance();
|
|
1129
|
+
return new Promise(function(resolve, reject) {
|
|
1130
|
+
s.emit("delete_data", payload, function(callback) {
|
|
1131
|
+
if (callback.success) {
|
|
1132
|
+
console.log("Data deleted successfully:", payload);
|
|
1133
|
+
console.log("delete ack", callback);
|
|
1134
|
+
resolve(callback);
|
|
1135
|
+
} else {
|
|
1136
|
+
reject(new Error(callback.message || "Delete operation failed"));
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
key: "clearAllRedisData",
|
|
1144
|
+
value: function clearAllRedisData() {
|
|
1145
|
+
var s = this.getSocketInstance();
|
|
1146
|
+
return new Promise(function(resolve, reject) {
|
|
1147
|
+
s.emit("clear_all_redis_data", function(ack) {
|
|
1148
|
+
if (ack.success) {
|
|
1149
|
+
resolve(ack);
|
|
1150
|
+
} else {
|
|
1151
|
+
reject(new Error(ack.message || "Clear all Redis data operation failed"));
|
|
1152
|
+
}
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
/// connection management methods
|
|
1159
|
+
key: "onConnect",
|
|
1160
|
+
value: function onConnect(callback) {
|
|
1161
|
+
var _this_socket;
|
|
1162
|
+
this.connectCallbacks.push(callback);
|
|
1163
|
+
if ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) {
|
|
1164
|
+
callback();
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
key: "offConnect",
|
|
1170
|
+
value: function offConnect(callback) {
|
|
1171
|
+
this.connectCallbacks = this.connectCallbacks.filter(function(cb) {
|
|
1172
|
+
return cb !== callback;
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
key: "onDisconnect",
|
|
1178
|
+
value: function onDisconnect(callback) {
|
|
1179
|
+
this.disconnectCallbacks.push(callback);
|
|
1180
|
+
if (this.socket && !this.socket.connected) {
|
|
1181
|
+
callback();
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
key: "offDisconnect",
|
|
1187
|
+
value: function offDisconnect(callback) {
|
|
1188
|
+
this.disconnectCallbacks = this.disconnectCallbacks.filter(function(cb) {
|
|
1189
|
+
return cb !== callback;
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
key: "isConnected",
|
|
1195
|
+
value: function isConnected() {
|
|
1196
|
+
var _this_socket;
|
|
1197
|
+
return ((_this_socket = this.socket) === null || _this_socket === void 0 ? void 0 : _this_socket.connected) || false;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
], [
|
|
1201
|
+
{
|
|
1202
|
+
key: "getInstance",
|
|
1203
|
+
value: function getInstance() {
|
|
1204
|
+
if (!_SocketService.instance) {
|
|
1205
|
+
_SocketService.instance = new _SocketService();
|
|
1206
|
+
}
|
|
1207
|
+
return _SocketService.instance;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
]);
|
|
1211
|
+
return _SocketService;
|
|
1212
|
+
}();
|
|
1213
|
+
var socketServiceInstance = SocketService.getInstance();
|
|
942
1214
|
// src/components/utils/Checkboxes.tsx
|
|
943
1215
|
import { useEffect, useState } from "react";
|
|
944
1216
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1483,7 +1755,6 @@ var TableProvider = function(props) {
|
|
|
1483
1755
|
exportToExcelKeys = props.exportToExcelKeys, dataToAddToExcelTable = props.dataToAddToExcelTable, _props_exportExcelTitle = props.exportExcelTitle, exportExcelTitle = _props_exportExcelTitle === void 0 ? "Export to excel" : _props_exportExcelTitle, excelFileName = props.excelFileName, // summary
|
|
1484
1756
|
sumColumns = props.sumColumns, _props_summaryLabel = props.summaryLabel, summaryLabel = _props_summaryLabel === void 0 ? "" : _props_summaryLabel, _props_summaryContainerStyle = props.summaryContainerStyle, summaryContainerStyle = _props_summaryContainerStyle === void 0 ? {} : _props_summaryContainerStyle, _props_summaryLabelStyle = props.summaryLabelStyle, summaryLabelStyle = _props_summaryLabelStyle === void 0 ? {} : _props_summaryLabelStyle, _props_summaryRowStyle = props.summaryRowStyle, summaryRowStyle = _props_summaryRowStyle === void 0 ? {} : _props_summaryRowStyle, _props_maxRows = props.// max rows
|
|
1485
1757
|
maxRows, maxRows = _props_maxRows === void 0 ? data.length : _props_maxRows, _props_noneSearchKeys = props.noneSearchKeys, noneSearchKeys = _props_noneSearchKeys === void 0 ? [] : _props_noneSearchKeys, showDisplayAllRowsButton = props.showDisplayAllRowsButton;
|
|
1486
|
-
var normalizedNoneSearchKeys = noneSearchKeys || [];
|
|
1487
1758
|
var _useSort = useSort(), sortColumn = _useSort.sortColumn, sortOrder = _useSort.sortOrder, handleSort = _useSort.handleSort, clearSort = _useSort.clearSort;
|
|
1488
1759
|
var _useDisplayToggle = useDisplayToggle(), displayAllRows = _useDisplayToggle.displayAllRows, setDisplayAllRows = _useDisplayToggle.setDisplayAllRows;
|
|
1489
1760
|
var _useSearch = useSearch(), searchQuery = _useSearch.searchQuery, handleSearch = _useSearch.handleSearch, debouncedSearchQuery = _useSearch.debouncedSearchQuery;
|
|
@@ -1509,7 +1780,7 @@ var TableProvider = function(props) {
|
|
|
1509
1780
|
};
|
|
1510
1781
|
var normalizedSearchQuery = cleanString(debouncedSearchQuery);
|
|
1511
1782
|
var keys = allKeys.filter(function(val) {
|
|
1512
|
-
return !
|
|
1783
|
+
return !noneSearchKeys.includes(val);
|
|
1513
1784
|
});
|
|
1514
1785
|
filtered = data.filter(function(item) {
|
|
1515
1786
|
return keys.some(function(key) {
|
|
@@ -1550,7 +1821,7 @@ var TableProvider = function(props) {
|
|
|
1550
1821
|
filters,
|
|
1551
1822
|
data,
|
|
1552
1823
|
displayAllRows,
|
|
1553
|
-
|
|
1824
|
+
noneSearchKeys,
|
|
1554
1825
|
filterableColumns,
|
|
1555
1826
|
filterPopupsDisplay
|
|
1556
1827
|
]);
|
|
@@ -3482,14 +3753,14 @@ function rectsAreEqual(a, b) {
|
|
|
3482
3753
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3483
3754
|
}
|
|
3484
3755
|
function observeMove(element, onMove) {
|
|
3485
|
-
var
|
|
3756
|
+
var io2 = null;
|
|
3486
3757
|
var timeoutId;
|
|
3487
3758
|
var root = getDocumentElement(element);
|
|
3488
3759
|
function cleanup() {
|
|
3489
3760
|
var _io;
|
|
3490
3761
|
clearTimeout(timeoutId);
|
|
3491
|
-
(_io =
|
|
3492
|
-
|
|
3762
|
+
(_io = io2) == null || _io.disconnect();
|
|
3763
|
+
io2 = null;
|
|
3493
3764
|
}
|
|
3494
3765
|
function refresh(skip, threshold) {
|
|
3495
3766
|
if (skip === void 0) {
|
|
@@ -3537,14 +3808,14 @@ function observeMove(element, onMove) {
|
|
|
3537
3808
|
isFirstUpdate = false;
|
|
3538
3809
|
}
|
|
3539
3810
|
try {
|
|
3540
|
-
|
|
3811
|
+
io2 = new IntersectionObserver(handleObserve, _object_spread_props(_object_spread({}, options), {
|
|
3541
3812
|
// Handle <iframe>s
|
|
3542
3813
|
root: root.ownerDocument
|
|
3543
3814
|
}));
|
|
3544
3815
|
} catch (e) {
|
|
3545
|
-
|
|
3816
|
+
io2 = new IntersectionObserver(handleObserve, options);
|
|
3546
3817
|
}
|
|
3547
|
-
|
|
3818
|
+
io2.observe(element);
|
|
3548
3819
|
}
|
|
3549
3820
|
refresh(true);
|
|
3550
3821
|
return cleanup;
|