blixify-ui-web 0.2.3 → 0.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAON,MAAM,OAAO,CAAC;AAoDf,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAO1B,eAAO,MAAM,YAAY,mFAg0IvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAON,MAAM,OAAO,CAAC;AAoDf,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAQ1B,eAAO,MAAM,YAAY,mFA45IvB,CAAC"}
@@ -128,6 +128,7 @@ var dataStateModel_1 = require("./dataStateModel");
128
128
  var indexedDb_1 = require("./indexedDb");
129
129
  var pagination_1 = require("./pagination");
130
130
  var settingsModal_1 = require("./settingsModal");
131
+ var feeds_1 = require("../../display/feeds");
131
132
  exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
132
133
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
133
134
  var formRef = (0, react_1.createRef)();
@@ -293,25 +294,29 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
293
294
  }
294
295
  }, [props.type, props.id]);
295
296
  (0, react_1.useEffect)(function () {
296
- var _a, _b, _c;
297
+ var _a, _b, _c, _d;
297
298
  if (!selectedTab) {
298
299
  var currentTab = (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs) === null || _b === void 0 ? void 0 : _b.find(function (eachTab) { var _a; return (0, utils_1.lowercaseTextToId)(eachTab.name) === ((_a = props.organise) === null || _a === void 0 ? void 0 : _a.viewId); });
299
- if (currentTab && currentTab.viewType === "calendar") {
300
- var hrefPoint = "".concat(props.localURLEndpoint, "?type=").concat(props.type, "&collection=").concat(props.collectionId);
301
- if (props.id)
302
- hrefPoint += "&data=".concat(props.id);
303
- var id = (0, utils_1.lowercaseTextToId)(currentTab.name);
304
- setSelectedTab({
305
- id: id,
306
- name: currentTab.name,
307
- href: hrefPoint + "&view=".concat(id),
308
- type: currentTab.type,
309
- viewType: currentTab.viewType,
310
- viewImage: currentTab.viewImage,
311
- calendarSettings: (_c = currentTab.calendarSettings) !== null && _c !== void 0 ? _c : undefined,
312
- });
313
- if (listRQueryHocRef.current)
314
- listRQueryHocRef.current.handleRefresh();
300
+ if (currentTab) {
301
+ if (currentTab.viewType === "calendar" ||
302
+ currentTab.viewType === "feeds") {
303
+ var hrefPoint = "".concat(props.localURLEndpoint, "?type=").concat(props.type, "&collection=").concat(props.collectionId);
304
+ if (props.id)
305
+ hrefPoint += "&data=".concat(props.id);
306
+ var id = (0, utils_1.lowercaseTextToId)(currentTab.name);
307
+ setSelectedTab({
308
+ id: id,
309
+ name: currentTab.name,
310
+ href: hrefPoint + "&view=".concat(id),
311
+ type: currentTab.type,
312
+ viewType: currentTab.viewType,
313
+ viewImage: currentTab.viewImage,
314
+ calendarSettings: (_c = currentTab.calendarSettings) !== null && _c !== void 0 ? _c : undefined,
315
+ feedsSettings: (_d = currentTab.feedsSettings) !== null && _d !== void 0 ? _d : undefined,
316
+ });
317
+ if (listRQueryHocRef.current)
318
+ listRQueryHocRef.current.handleRefresh();
319
+ }
315
320
  }
316
321
  }
317
322
  }, [
@@ -508,11 +513,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
508
513
  }
509
514
  };
510
515
  var handleSetListData = function (tableData, spaceTableData) {
511
- var _a, _b;
516
+ var _a, _b, _c, _d, _e;
512
517
  setTableData(tableData);
513
518
  setSpaceTableData(spaceTableData);
514
519
  if (tableData.length > 0)
515
520
  (_b = (_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareListHandleData) === null || _b === void 0 ? void 0 : _b.call(_a, tableData, spaceTableData);
521
+ if (((_c = props.organise) === null || _c === void 0 ? void 0 : _c.extendedTabs) &&
522
+ props.organise.extendedTabs.length > 0) {
523
+ var feedsTab = props.organise.extendedTabs.find(function (eachTab) { return eachTab.viewType === "feeds"; });
524
+ if (feedsTab) {
525
+ (_e = (_d = feedsTab.feedsSettings) === null || _d === void 0 ? void 0 : _d.customFeedsData) === null || _e === void 0 ? void 0 : _e.call(_d, tableData, spaceTableData);
526
+ }
527
+ }
516
528
  };
517
529
  var handleGetListData = function (responseData, type, rowId) { return __awaiter(void 0, void 0, void 0, function () {
518
530
  var dataList, prettierDataList, dummyPrettierDataList_1, selectedIndex_1, newTableData, newPrettierTableData, isExists;
@@ -1175,7 +1187,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1175
1187
  })];
1176
1188
  case 4:
1177
1189
  responseData = _f.sent();
1178
- return [4 /*yield*/, handleCheckDeleteReference((_c = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _c !== void 0 ? _c : [])];
1190
+ return [4 /*yield*/, handleCheckDeleteReference((_c = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _c !== void 0 ? _c : [], true)];
1179
1191
  case 5:
1180
1192
  notReferenceId = _f.sent();
1181
1193
  return [4 /*yield*/, writeServerQuery.call("batchDelete", {
@@ -1196,7 +1208,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1196
1208
  })];
1197
1209
  case 8:
1198
1210
  responseData = _f.sent();
1199
- return [4 /*yield*/, handleCheckDeleteReference((_d = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _d !== void 0 ? _d : [])];
1211
+ return [4 /*yield*/, handleCheckDeleteReference((_d = responseData === null || responseData === void 0 ? void 0 : responseData.data) !== null && _d !== void 0 ? _d : [], true)];
1200
1212
  case 9:
1201
1213
  notReferenceId = _f.sent();
1202
1214
  return [4 /*yield*/, writeServerQuery.call("batchDelete", {
@@ -1256,9 +1268,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1256
1268
  return [4 /*yield*/, handleCheckDeleteReference([selectedData])];
1257
1269
  case 1:
1258
1270
  deleteIds = _f.sent();
1259
- if (deleteIds) {
1271
+ if (deleteIds && deleteIds.length <= 0)
1260
1272
  deletable = false;
1261
- }
1262
1273
  if (!(selectedId_1 && deletable)) return [3 /*break*/, 8];
1263
1274
  setLoading(true);
1264
1275
  setModalVisible(true);
@@ -1311,7 +1322,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1311
1322
  }
1312
1323
  });
1313
1324
  }); };
1314
- var handleCheckDeleteReference = function (selectedData) { return __awaiter(void 0, void 0, void 0, function () {
1325
+ var handleCheckDeleteReference = function (selectedData, multipleDelete) { return __awaiter(void 0, void 0, void 0, function () {
1315
1326
  var existDataIds, existsData, handleFindReference_1, collectionIdList_1, columnIdList_1, collectionNameList_1, refStructureList_1, schemaQuery, schemaRes, spaceList, err_8;
1316
1327
  var _a, _b, _c;
1317
1328
  return __generator(this, function (_d) {
@@ -1321,7 +1332,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1321
1332
  existsData = {};
1322
1333
  _d.label = 1;
1323
1334
  case 1:
1324
- _d.trys.push([1, 8, , 9]);
1335
+ _d.trys.push([1, 10, , 11]);
1325
1336
  handleFindReference_1 = function (data, referenceStructure, space, spaceId, spaceName) { return __awaiter(void 0, void 0, void 0, function () {
1326
1337
  var referenceRQ, currentReferenceSelectedList;
1327
1338
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -1366,9 +1377,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1366
1377
  }
1367
1378
  });
1368
1379
  }); };
1369
- if (!!schemaPresent) return [3 /*break*/, 4];
1380
+ if (!!schemaPresent) return [3 /*break*/, 6];
1370
1381
  if (!(((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareReferenceDel) &&
1371
- props.bareSettings.bareReferenceDel.length > 0)) return [3 /*break*/, 3];
1382
+ props.bareSettings.bareReferenceDel.length > 0)) return [3 /*break*/, 4];
1372
1383
  collectionIdList_1 = [];
1373
1384
  columnIdList_1 = [];
1374
1385
  collectionNameList_1 = [];
@@ -1411,8 +1422,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1411
1422
  case 2:
1412
1423
  _d.sent();
1413
1424
  _d.label = 3;
1414
- case 3: return [3 /*break*/, 7];
1425
+ case 3: return [3 /*break*/, 5];
1415
1426
  case 4:
1427
+ if (multipleDelete) {
1428
+ return [2 /*return*/, selectedData
1429
+ .filter(function (eachData) {
1430
+ return !existDataIds.includes(eachData[serverId]);
1431
+ })
1432
+ .map(function (eachData) { return eachData[serverId]; })];
1433
+ }
1434
+ else
1435
+ return [2 /*return*/, selectedData];
1436
+ _d.label = 5;
1437
+ case 5: return [3 /*break*/, 9];
1438
+ case 6:
1416
1439
  schemaQuery = new readQuery_1.ReadQuery({
1417
1440
  dbModule: dbModule,
1418
1441
  dbType: (_b = props.devSettings.server) !== null && _b !== void 0 ? _b : "mongoServer",
@@ -1434,7 +1457,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1434
1457
  ],
1435
1458
  type: "list",
1436
1459
  })];
1437
- case 5:
1460
+ case 7:
1438
1461
  schemaRes = _d.sent();
1439
1462
  spaceList = schemaRes === null || schemaRes === void 0 ? void 0 : schemaRes.data;
1440
1463
  return [4 /*yield*/, Promise.all(spaceList.map(function (eachSpace) { return __awaiter(void 0, void 0, void 0, function () {
@@ -1502,14 +1525,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
1502
1525
  }
1503
1526
  });
1504
1527
  }); }))];
1505
- case 6:
1506
- _d.sent();
1507
- _d.label = 7;
1508
- case 7: return [3 /*break*/, 9];
1509
1528
  case 8:
1529
+ _d.sent();
1530
+ _d.label = 9;
1531
+ case 9: return [3 /*break*/, 11];
1532
+ case 10:
1510
1533
  err_8 = _d.sent();
1511
- return [3 /*break*/, 9];
1512
- case 9:
1534
+ return [3 /*break*/, 11];
1535
+ case 11:
1513
1536
  setReferenceDeleteTableData(existsData);
1514
1537
  return [2 /*return*/, selectedData
1515
1538
  .filter(function (eachData) {
@@ -2815,7 +2838,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2815
2838
  if (((_d = props.organise) === null || _d === void 0 ? void 0 : _d.extendedTabs) &&
2816
2839
  ((_e = props.organise.extendedTabs) === null || _e === void 0 ? void 0 : _e.length) > 0) {
2817
2840
  (_f = props.organise) === null || _f === void 0 ? void 0 : _f.extendedTabs.map(function (eachTab) {
2818
- var _a;
2841
+ var _a, _b;
2819
2842
  var hrefPoint = "".concat(props.localURLEndpoint, "?type=").concat(props.type, "&collection=").concat(props.collectionId);
2820
2843
  if (props.id)
2821
2844
  hrefPoint += "&data=".concat(props.id);
@@ -2828,6 +2851,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
2828
2851
  viewType: eachTab.viewType,
2829
2852
  viewImage: eachTab.viewImage,
2830
2853
  calendarSettings: (_a = eachTab.calendarSettings) !== null && _a !== void 0 ? _a : undefined,
2854
+ feedsSettings: (_b = eachTab.feedsSettings) !== null && _b !== void 0 ? _b : undefined,
2831
2855
  };
2832
2856
  if (eachTab.viewType === "iframe")
2833
2857
  tabData["iframeSrc"] = eachTab.src;
@@ -3133,7 +3157,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3133
3157
  return gridData;
3134
3158
  };
3135
3159
  var renderTabContent = function (tabs, dataType, viewType) {
3136
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3160
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
3137
3161
  var selectedTabData = tabs.find(function (eachTab) {
3138
3162
  if (eachTab.id === viewType) {
3139
3163
  return eachTab;
@@ -3330,6 +3354,44 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
3330
3354
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", id, "general");
3331
3355
  }, lib: { moment: moment_1.default } }))));
3332
3356
  }
3357
+ else if (selectedTabData.viewType === "feeds") {
3358
+ var feedsSettings_1 = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.feedsSettings;
3359
+ var contentList_1 = [];
3360
+ var feedsTab = (_m = (_l = props.organise) === null || _l === void 0 ? void 0 : _l.extendedTabs) === null || _m === void 0 ? void 0 : _m.find(function (eachTab) { return eachTab.viewType === "feeds"; });
3361
+ if (feedsTab) {
3362
+ var customFeedsData = (_p = (_o = feedsTab.feedsSettings) === null || _o === void 0 ? void 0 : _o.customFeedsData) === null || _p === void 0 ? void 0 : _p.call(_o, tableData, spaceTableData);
3363
+ if (customFeedsData && customFeedsData.length > 0) {
3364
+ customFeedsData.map(function (eachData) {
3365
+ var _a, _b, _c, _d, _e;
3366
+ var content = {
3367
+ content: (_a = eachData.content) !== null && _a !== void 0 ? _a : "",
3368
+ addContent: (_b = eachData.addContent) !== null && _b !== void 0 ? _b : "",
3369
+ step: (_c = eachData.step) !== null && _c !== void 0 ? _c : "",
3370
+ iconClass: (_d = eachData.iconClass) !== null && _d !== void 0 ? _d : "",
3371
+ iconType: (_e = eachData.iconType) !== null && _e !== void 0 ? _e : (react_1.default.createElement(solid_1.CheckIcon, { className: "h-5 w-5 text-white" })),
3372
+ };
3373
+ contentList_1.push(content);
3374
+ return null;
3375
+ });
3376
+ }
3377
+ else {
3378
+ spaceTableData.map(function (eachData) {
3379
+ var _a, _b, _c, _d, _e;
3380
+ var content = {
3381
+ content: (_a = eachData[feedsSettings_1.title]) !== null && _a !== void 0 ? _a : "",
3382
+ addContent: (react_1.default.createElement("p", { className: "mt-2 text-sm text-gray-500" }, (_b = eachData[feedsSettings_1.content]) !== null && _b !== void 0 ? _b : "")),
3383
+ step: (_c = eachData[feedsSettings_1.step]) !== null && _c !== void 0 ? _c : "",
3384
+ iconClass: (_d = feedsSettings_1.iconClass) !== null && _d !== void 0 ? _d : "bg-primary-500",
3385
+ iconType: (_e = feedsSettings_1.icon) !== null && _e !== void 0 ? _e : (react_1.default.createElement(solid_1.CheckIcon, { className: "h-5 w-5 text-white" })),
3386
+ };
3387
+ contentList_1.push(content);
3388
+ return null;
3389
+ });
3390
+ }
3391
+ }
3392
+ return (react_1.default.createElement("div", { className: "mt-4" }, tableLoading ? (react_1.default.createElement(loading_1.Loading, null)) : (react_1.default.createElement("div", { className: "p-4 bg-white rounded-sm" },
3393
+ react_1.default.createElement(feeds_1.Feeds, { bold: true, content: contentList_1, darkMode: (_q = props.organise) === null || _q === void 0 ? void 0 : _q.darkMode })))));
3394
+ }
3333
3395
  else if (selectedTabData.renderComp) {
3334
3396
  return react_1.default.createElement(react_1.default.Fragment, null, selectedTabData.renderComp());
3335
3397
  }