blixify-ui-web 1.2.94 → 1.2.95
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/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +149 -40
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/display/filePreview/index.d.ts +10 -0
- package/lib/components/display/filePreview/index.d.ts.map +1 -1
- package/lib/components/display/filePreview/index.js +53 -2
- package/lib/components/display/filePreview/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAwD1B,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAwD1B,eAAO,MAAM,YAAY,mFAwlZvB,CAAC"}
|
|
@@ -1344,6 +1344,40 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
1344
1344
|
(_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.groupBy,
|
|
1345
1345
|
resolvedType,
|
|
1346
1346
|
]);
|
|
1347
|
+
/**
|
|
1348
|
+
* INFO: a list tab is a different list. Switching from a file view to the
|
|
1349
|
+
* table used to carry two things across: the PAGE, so a second page reached
|
|
1350
|
+
* on five files opened the next tab past its two and showed nothing; and
|
|
1351
|
+
* the ROWS, so the table rendered the unwound files — three rows sharing
|
|
1352
|
+
* one record id — for the moment before its own fetch landed, and React,
|
|
1353
|
+
* reconciling children with duplicate keys, left a stale row behind:
|
|
1354
|
+
* three records showed as four. The page resets and the rows clear the
|
|
1355
|
+
* instant the tab changes, and the fetch that follows starts clean.
|
|
1356
|
+
*
|
|
1357
|
+
* Only while a list is showing. Opening a record and coming back changes
|
|
1358
|
+
* the view type on the way out and in, and that must not lose the page.
|
|
1359
|
+
*/
|
|
1360
|
+
var previousListViewRef = (0, react_1.useRef)(null);
|
|
1361
|
+
(0, react_1.useEffect)(function () {
|
|
1362
|
+
var _a, _b;
|
|
1363
|
+
if (resolvedType !== "list")
|
|
1364
|
+
return;
|
|
1365
|
+
if (previousListViewRef.current === null) {
|
|
1366
|
+
previousListViewRef.current = viewType;
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
if (previousListViewRef.current === viewType)
|
|
1370
|
+
return;
|
|
1371
|
+
previousListViewRef.current = viewType;
|
|
1372
|
+
if (pageIndex !== 0)
|
|
1373
|
+
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onChangePagination) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
|
|
1374
|
+
setPageIndex(0);
|
|
1375
|
+
setCursor("");
|
|
1376
|
+
setLastCursor("");
|
|
1377
|
+
setTableLoading(true);
|
|
1378
|
+
handleSetListData([], []);
|
|
1379
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1380
|
+
}, [viewType, resolvedType]);
|
|
1347
1381
|
(0, react_1.useEffect)(function () {
|
|
1348
1382
|
if (props.devSettings.schemaReference)
|
|
1349
1383
|
setReferenceSchema(props.devSettings.schemaReference);
|
|
@@ -2219,11 +2253,27 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2219
2253
|
}
|
|
2220
2254
|
_m.label = 5;
|
|
2221
2255
|
case 5:
|
|
2222
|
-
(_g = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _g === void 0 ? void 0 : _g.map(function (eachData) {
|
|
2256
|
+
(_g = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _g === void 0 ? void 0 : _g.map(function (eachData, eachIndex) {
|
|
2223
2257
|
if (eachData["_id"]) {
|
|
2224
2258
|
eachData["id"] = eachData["_id"];
|
|
2225
2259
|
delete eachData["_id"];
|
|
2226
2260
|
}
|
|
2261
|
+
/**
|
|
2262
|
+
* INFO: an unwound row is a FILE, and three files of one record
|
|
2263
|
+
* share its id. Rows are keyed by id wherever they are rendered,
|
|
2264
|
+
* and React reconciling children with duplicate keys leaves stale
|
|
2265
|
+
* rows behind when the list changes under it — three records read
|
|
2266
|
+
* as four after a visit to the file view. So a file row gets an id
|
|
2267
|
+
* of its own, unique across pages, and keeps the record's id
|
|
2268
|
+
* beside it for the tile to open.
|
|
2269
|
+
*/
|
|
2270
|
+
if (fileViewColumnId && eachData["id"] !== undefined) {
|
|
2271
|
+
eachData["recordId"] = eachData["id"];
|
|
2272
|
+
// INFO: limit is dropped for a grouped list, and every row then
|
|
2273
|
+
// arrives at once — the index alone keeps the id unique
|
|
2274
|
+
eachData["id"] =
|
|
2275
|
+
"".concat(eachData["id"], "#").concat((pageIndex !== null && pageIndex !== void 0 ? pageIndex : 0) * (limit !== null && limit !== void 0 ? limit : 0) + eachIndex);
|
|
2276
|
+
}
|
|
2227
2277
|
return null;
|
|
2228
2278
|
});
|
|
2229
2279
|
dataList = responseData.data;
|
|
@@ -7957,7 +8007,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
7957
8007
|
if (((_a = props.organise) === null || _a === void 0 ? void 0 : _a.extendedTabs) &&
|
|
7958
8008
|
((_b = props.organise.extendedTabs) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
7959
8009
|
(_c = props.organise) === null || _c === void 0 ? void 0 : _c.extendedTabs.map(function (eachTab) {
|
|
7960
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8010
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7961
8011
|
var hrefPoint = "".concat(props.localURLEndpoint, "?type=").concat(resolvedType, "&collection=").concat(props.collectionId);
|
|
7962
8012
|
if (props.id)
|
|
7963
8013
|
hrefPoint += "&data=".concat(props.id);
|
|
@@ -7973,6 +8023,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
7973
8023
|
calendarSettings: (_b = eachTab.calendarSettings) !== null && _b !== void 0 ? _b : undefined,
|
|
7974
8024
|
feedsSettings: (_c = eachTab.feedsSettings) !== null && _c !== void 0 ? _c : undefined,
|
|
7975
8025
|
mapSettings: (_d = eachTab.mapSettings) !== null && _d !== void 0 ? _d : undefined,
|
|
8026
|
+
// INFO: the file view reads its column from the tab it renders, so
|
|
8027
|
+
// the settings have to survive this copy. Without them the query
|
|
8028
|
+
// still unwound the column (it reads the raw extendedTabs) while
|
|
8029
|
+
// the tile had no column to read and every file said "Attachment".
|
|
8030
|
+
fileSettings: (_e = eachTab.fileSettings) !== null && _e !== void 0 ? _e : undefined,
|
|
7976
8031
|
};
|
|
7977
8032
|
if (eachTab.viewType === "iframe") {
|
|
7978
8033
|
if (typeof eachTab.src === "string") {
|
|
@@ -7987,7 +8042,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
7987
8042
|
}
|
|
7988
8043
|
if (eachTab.type === resolvedType) {
|
|
7989
8044
|
tabs.push(__assign(__assign(__assign({}, tabData), (isEditor &&
|
|
7990
|
-
((
|
|
8045
|
+
((_f = props.organise) === null || _f === void 0 ? void 0 : _f.onChangeTabs) && {
|
|
7991
8046
|
action: (react_1.default.createElement("span", { role: "button", "data-testid": "tab-default-".concat(tabData.id), "aria-label": eachTab.defaultTab
|
|
7992
8047
|
? "Opens by default"
|
|
7993
8048
|
: "Open this tab by default", className: "ml-2 self-center ".concat(eachTab.defaultTab
|
|
@@ -7997,7 +8052,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
7997
8052
|
e.preventDefault();
|
|
7998
8053
|
handleToggleDefaultTab(eachTab.name);
|
|
7999
8054
|
} }, eachTab.defaultTab ? (react_1.default.createElement(HeroIcons.BookmarkIcon, { className: "h-4 w-4" })) : (react_1.default.createElement(BookmarkIcon_1.default, { className: "h-4 w-4" })))),
|
|
8000
|
-
})), (!((
|
|
8055
|
+
})), (!((_g = props.edit) === null || _g === void 0 ? void 0 : _g.disabledTabsDeleteBtn) && {
|
|
8001
8056
|
del: (react_1.default.createElement(outline_1.XMarkIcon, { className: "h-4 w-4 ml-2 self-center text-red-600 hover:text-red-400 ", onClick: function (e) {
|
|
8002
8057
|
e.stopPropagation();
|
|
8003
8058
|
e.preventDefault();
|
|
@@ -8463,7 +8518,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8463
8518
|
}
|
|
8464
8519
|
};
|
|
8465
8520
|
var renderTabContent = function (tabs, dataType, requestedViewType) {
|
|
8466
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59;
|
|
8521
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60;
|
|
8467
8522
|
var matchedTab = tabs.find(function (eachTab) { return eachTab.id === requestedViewType; });
|
|
8468
8523
|
/**
|
|
8469
8524
|
* INFO: a list tab must not supply the content of a read view. The selected
|
|
@@ -8701,7 +8756,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8701
8756
|
handlePagination(value);
|
|
8702
8757
|
}, className: "mt-5", hidePagination: (_20 = props.organise) === null || _20 === void 0 ? void 0 : _20.hidePagination, customPaginationSize: customPaginationSize })));
|
|
8703
8758
|
}
|
|
8704
|
-
else if (selectedTabData.viewType === "file" &&
|
|
8759
|
+
else if (selectedTabData.viewType === "file" &&
|
|
8760
|
+
resolvedType === "list") {
|
|
8705
8761
|
/**
|
|
8706
8762
|
* INFO: the rows are already files — the server unwound the column, so
|
|
8707
8763
|
* each row is one element with its record's fields alongside it. The
|
|
@@ -8714,46 +8770,99 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8714
8770
|
* still a direct link for when the file itself is the point.
|
|
8715
8771
|
*/
|
|
8716
8772
|
var columnId_2 = (_22 = (_21 = selectedTabData.fileSettings) === null || _21 === void 0 ? void 0 : _21.columnId) !== null && _22 !== void 0 ? _22 : "";
|
|
8773
|
+
var fileColumn_1 = structure.find(function (eachModel) { return eachModel.id === columnId_2; });
|
|
8774
|
+
var fileImageEndpoint_1 = ((_23 = props.devSettings) === null || _23 === void 0 ? void 0 : _23.imageEndpoint) || devSettings.imageEndpoint;
|
|
8775
|
+
/**
|
|
8776
|
+
* INFO: a stored file is not a url. A single file/image column holds
|
|
8777
|
+
* the download TOKEN — the file's name lives on the column
|
|
8778
|
+
* (imageFileName) and its folder on imageCollectionName + row id — and
|
|
8779
|
+
* a multiple entry is { token, fileName } with the storage object
|
|
8780
|
+
* name. Handed raw, FilePreview had nothing to draw and nothing to
|
|
8781
|
+
* name, so every tile read "Attachment". The grid and read views
|
|
8782
|
+
* rebuild the url with renderImageUrlFromPath; the tile does the same.
|
|
8783
|
+
*/
|
|
8784
|
+
/**
|
|
8785
|
+
* INFO: the type from the NAME we know, not from the url we build —
|
|
8786
|
+
* handleGuessMimeType, beside FilePreview, so the type decision stays
|
|
8787
|
+
* in one place. A storage url can end in something other than the
|
|
8788
|
+
* object name; the column's file name and a multiple entry's stored
|
|
8789
|
+
* name are the honest source.
|
|
8790
|
+
*/
|
|
8791
|
+
var handleResolveTileFile_1 = function (eachRow) {
|
|
8792
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8793
|
+
var value = eachRow === null || eachRow === void 0 ? void 0 : eachRow[columnId_2];
|
|
8794
|
+
var rowId = String((_c = (_b = (_a = eachRow === null || eachRow === void 0 ? void 0 : eachRow.recordId) !== null && _a !== void 0 ? _a : eachRow === null || eachRow === void 0 ? void 0 : eachRow.id) !== null && _b !== void 0 ? _b : eachRow === null || eachRow === void 0 ? void 0 : eachRow._id) !== null && _c !== void 0 ? _c : "");
|
|
8795
|
+
var folder = (_d = fileColumn_1 === null || fileColumn_1 === void 0 ? void 0 : fileColumn_1.imageCollectionName) !== null && _d !== void 0 ? _d : props.collectionId;
|
|
8796
|
+
var isUrl = function (text) {
|
|
8797
|
+
return typeof text === "string" && /^https?:\/\//i.test(text);
|
|
8798
|
+
};
|
|
8799
|
+
if (isUrl(value))
|
|
8800
|
+
return { fileName: value };
|
|
8801
|
+
if (typeof value === "string" && value) {
|
|
8802
|
+
var name_1 = (_e = fileColumn_1 === null || fileColumn_1 === void 0 ? void 0 : fileColumn_1.imageFileName) !== null && _e !== void 0 ? _e : "";
|
|
8803
|
+
return {
|
|
8804
|
+
fileName: (0, blobModule_1.renderImageUrlFromPath)(fileImageEndpoint_1, folder, rowId, name_1, value, devSettings.bucketName),
|
|
8805
|
+
label: name_1 || undefined,
|
|
8806
|
+
mimeType: (0, filePreview_1.handleGuessMimeType)(name_1),
|
|
8807
|
+
token: value,
|
|
8808
|
+
};
|
|
8809
|
+
}
|
|
8810
|
+
if (value && typeof value === "object") {
|
|
8811
|
+
var name_2 = (_f = value.fileName) !== null && _f !== void 0 ? _f : "";
|
|
8812
|
+
if (isUrl(name_2))
|
|
8813
|
+
return { fileName: name_2, label: value.label };
|
|
8814
|
+
return {
|
|
8815
|
+
fileName: name_2
|
|
8816
|
+
? (0, blobModule_1.renderImageUrlFromPath)(fileImageEndpoint_1, folder, rowId, name_2, (_g = value.token) !== null && _g !== void 0 ? _g : "", devSettings.bucketName)
|
|
8817
|
+
: "",
|
|
8818
|
+
// INFO: a multiple entry is stored as <uuid>-<name> or
|
|
8819
|
+
// <uuid><imageFileName> so entries never collide — the uuid is
|
|
8820
|
+
// not something a person recognises
|
|
8821
|
+
label: name_2.replace(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-?/i, "") || undefined,
|
|
8822
|
+
mimeType: (_h = value.mimeType) !== null && _h !== void 0 ? _h : (0, filePreview_1.handleGuessMimeType)(name_2),
|
|
8823
|
+
token: value.token,
|
|
8824
|
+
};
|
|
8825
|
+
}
|
|
8826
|
+
return { fileName: "" };
|
|
8827
|
+
};
|
|
8717
8828
|
return (react_1.default.createElement("div", { className: "mt-4" },
|
|
8718
8829
|
tableLoading ? (react_1.default.createElement("div", { className: "flex flex-col items-center py-10" },
|
|
8719
8830
|
react_1.default.createElement(loading_1.Loading, null))) : tableData.length === 0 ? (react_1.default.createElement(emptyState_1.EmptyState, { text: "No files here yet", icon: react_1.default.createElement(HeroIcons.PaperClipIcon, { className: "h-10 w-10 text-gray-400" }) })) : (
|
|
8720
8831
|
// INFO: the same surface the other list views sit on, so
|
|
8721
8832
|
// switching tabs does not change the shape of the page around
|
|
8722
8833
|
// the content.
|
|
8723
|
-
react_1.default.createElement("div", { className: "grid grid-cols-2 gap-4 rounded-lg p-4 sm:grid-cols-3 lg:grid-cols-4 ".concat(((
|
|
8724
|
-
var _a, _b
|
|
8725
|
-
return (react_1.default.createElement(filePreview_1.FilePreview, { key: "".concat((_b = (_a = eachRow === null || eachRow === void 0 ? void 0 : eachRow.id) !== null && _a !== void 0 ? _a : eachRow === null || eachRow === void 0 ? void 0 : eachRow._id) !== null && _b !== void 0 ? _b : eachIndex, "-").concat(eachIndex), variant: "tile", file:
|
|
8726
|
-
|
|
8727
|
-
: ((_c = eachRow === null || eachRow === void 0 ? void 0 : eachRow[columnId_2]) !== null && _c !== void 0 ? _c : { fileName: "" }), onClick: function () {
|
|
8728
|
-
var _a, _b, _c;
|
|
8834
|
+
react_1.default.createElement("div", { className: "grid grid-cols-2 gap-4 rounded-lg p-4 sm:grid-cols-3 lg:grid-cols-4 ".concat(((_24 = props.organise) === null || _24 === void 0 ? void 0 : _24.darkMode) ? "bg-white/5" : "bg-white") }, tableData.map(function (eachRow, eachIndex) {
|
|
8835
|
+
var _a, _b;
|
|
8836
|
+
return (react_1.default.createElement(filePreview_1.FilePreview, { key: "".concat((_b = (_a = eachRow === null || eachRow === void 0 ? void 0 : eachRow.id) !== null && _a !== void 0 ? _a : eachRow === null || eachRow === void 0 ? void 0 : eachRow._id) !== null && _b !== void 0 ? _b : eachIndex, "-").concat(eachIndex), variant: "tile", file: handleResolveTileFile_1(eachRow), onClick: function () {
|
|
8837
|
+
var _a, _b, _c, _d;
|
|
8729
8838
|
// INFO: `id`, not `_id`. handleGetListData renames
|
|
8730
8839
|
// every row's _id to id on the way in, the same as the
|
|
8731
8840
|
// other views navigate with — reading _id here handed
|
|
8732
8841
|
// the read view no id at all, so General Details was
|
|
8733
8842
|
// empty.
|
|
8734
|
-
return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", (_c = eachRow === null || eachRow === void 0 ? void 0 : eachRow.
|
|
8843
|
+
return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", (_d = (_c = eachRow === null || eachRow === void 0 ? void 0 : eachRow.recordId) !== null && _c !== void 0 ? _c : eachRow === null || eachRow === void 0 ? void 0 : eachRow.id) !== null && _d !== void 0 ? _d : eachRow === null || eachRow === void 0 ? void 0 : eachRow._id, "general");
|
|
8735
8844
|
} }));
|
|
8736
8845
|
}))),
|
|
8737
8846
|
react_1.default.createElement(pagination_1.Pagination, { data: tableData, size: size, limit: limit, cursor: cursor, pageIndex: pageIndex, paginationType: renderResolvedPaginationType(), handleUpdatePageIndex: function (value) {
|
|
8738
8847
|
handlePagination(value);
|
|
8739
|
-
}, darkMode: (
|
|
8848
|
+
}, darkMode: (_25 = props.organise) === null || _25 === void 0 ? void 0 : _25.darkMode, customPaginationSize: customPaginationSize })));
|
|
8740
8849
|
}
|
|
8741
8850
|
else if (selectedTabData.viewType === "grid") {
|
|
8742
8851
|
var isScrollMode = renderCheckScrollMode();
|
|
8743
8852
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
8744
|
-
react_1.default.createElement(grid_1.Grid, { darkMode: (
|
|
8853
|
+
react_1.default.createElement(grid_1.Grid, { darkMode: (_26 = props.organise) === null || _26 === void 0 ? void 0 : _26.darkMode, darkModeBg: (_27 = props.organise) === null || _27 === void 0 ? void 0 : _27.darkModeBg, paginationType: renderResolvedPaginationType(), data: renderGridAndListData(selectedTabData.viewImage, "grid"), size: size, limit: limit, cursor: cursor, loading: tableLoading, horizontalScroll: isScrollMode, pageIndex: pageIndex, onClickData: function (id) {
|
|
8745
8854
|
var _a, _b;
|
|
8746
8855
|
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", id, "general");
|
|
8747
|
-
}, linkType: props.linkType, custom: props.custom, newTabUrl: (
|
|
8856
|
+
}, linkType: props.linkType, custom: props.custom, newTabUrl: (_29 = (_28 = props.newTabUrl) === null || _28 === void 0 ? void 0 : _28.default) !== null && _29 !== void 0 ? _29 : "".concat(props.localURLEndpoint, "?data="), addNewTabUrl: (_31 = (_30 = props.newTabUrl) === null || _30 === void 0 ? void 0 : _30.addons) !== null && _31 !== void 0 ? _31 : "&type=read&collection=".concat(props.collectionId, "&view=general"), handleUpdatePageIndex: function (value) {
|
|
8748
8857
|
handlePagination(value);
|
|
8749
|
-
}, imgContain: selectedTabData === null || selectedTabData === void 0 ? void 0 : selectedTabData.gridContain, gridColClassName: (
|
|
8858
|
+
}, imgContain: selectedTabData === null || selectedTabData === void 0 ? void 0 : selectedTabData.gridContain, gridColClassName: (_32 = props.bareSettings) === null || _32 === void 0 ? void 0 : _32.bareListGridColClassName, className: "mt-5",
|
|
8750
8859
|
// INFO: under the new DTW the grid keeps the same footer as the
|
|
8751
8860
|
// table and list views instead of its own legacy page buttons
|
|
8752
|
-
hidePagination: ((
|
|
8753
|
-
!!((
|
|
8754
|
-
((
|
|
8755
|
-
!((
|
|
8756
|
-
.length, customPaginationSize: customPaginationSize, darkMode: (
|
|
8861
|
+
hidePagination: ((_33 = props.organise) === null || _33 === void 0 ? void 0 : _33.hidePagination) ||
|
|
8862
|
+
!!((_34 = props.bareSettings) === null || _34 === void 0 ? void 0 : _34.bareNewDTW), customPaginationSize: customPaginationSize }),
|
|
8863
|
+
((_35 = props.bareSettings) === null || _35 === void 0 ? void 0 : _35.bareNewDTW) &&
|
|
8864
|
+
!((_36 = props.organise) === null || _36 === void 0 ? void 0 : _36.hidePagination) && (react_1.default.createElement(newPagination_1.NewPagination, { paginationType: renderResolvedPaginationType(), pageIndex: pageIndex, limit: limit, size: size, cursor: cursor, resultCount: renderGridAndListData(selectedTabData.viewImage, "grid")
|
|
8865
|
+
.length, customPaginationSize: customPaginationSize, darkMode: (_37 = props.organise) === null || _37 === void 0 ? void 0 : _37.darkMode, darkModeBg: (_38 = props.organise) === null || _38 === void 0 ? void 0 : _38.darkModeBg, handleUpdatePageIndex: function (value) {
|
|
8757
8866
|
handlePagination(value);
|
|
8758
8867
|
} }))));
|
|
8759
8868
|
}
|
|
@@ -8855,7 +8964,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8855
8964
|
return eventAvailabilities;
|
|
8856
8965
|
};
|
|
8857
8966
|
// INFO: when bareNewDTW is enabled, render NewCalendar instead of legacy Calendar
|
|
8858
|
-
if ((
|
|
8967
|
+
if ((_39 = props.bareSettings) === null || _39 === void 0 ? void 0 : _39.bareNewDTW) {
|
|
8859
8968
|
var newCalendarEvents = renderEventAvailabilities().map(function (ev) {
|
|
8860
8969
|
var _a, _b, _c, _d;
|
|
8861
8970
|
return ({
|
|
@@ -8875,13 +8984,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8875
8984
|
// INFO: viewSwitch — optional Month/Week/Agenda toggle. The range
|
|
8876
8985
|
// query follows via calendarView ("dayGridMonth" ↔ "timeGridWeek");
|
|
8877
8986
|
// agenda lists the fetched month chronologically.
|
|
8878
|
-
var viewSwitchOptions = (
|
|
8987
|
+
var viewSwitchOptions = (_40 = calendarSettings_1 === null || calendarSettings_1 === void 0 ? void 0 : calendarSettings_1.viewSwitch) !== null && _40 !== void 0 ? _40 : [];
|
|
8879
8988
|
var VIEW_VARIANT_MAP = {
|
|
8880
8989
|
month: "fullMonth",
|
|
8881
8990
|
week: "weekTimeGrid",
|
|
8882
8991
|
agenda: "agenda",
|
|
8883
8992
|
};
|
|
8884
|
-
var activeVariant = (
|
|
8993
|
+
var activeVariant = (_41 = VIEW_VARIANT_MAP[newCalendarViewMode]) !== null && _41 !== void 0 ? _41 : "fullMonth";
|
|
8885
8994
|
return (react_1.default.createElement("div", { className: "mt-4" },
|
|
8886
8995
|
viewSwitchOptions.length > 1 && (react_1.default.createElement("div", { className: "mb-2 flex justify-end" },
|
|
8887
8996
|
react_1.default.createElement("div", { className: "inline-flex rounded-lg border border-gray-200 bg-white p-0.5" }, viewSwitchOptions.map(function (view) { return (react_1.default.createElement("button", { key: view, type: "button", onClick: function () {
|
|
@@ -8923,9 +9032,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8923
9032
|
var _a, _b;
|
|
8924
9033
|
if (event.id)
|
|
8925
9034
|
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", event.id, "general");
|
|
8926
|
-
}, darkMode: (
|
|
9035
|
+
}, darkMode: (_42 = props.organise) === null || _42 === void 0 ? void 0 : _42.darkMode, className: "w-full" }))));
|
|
8927
9036
|
}
|
|
8928
|
-
return (react_1.default.createElement("div", { className: "mt-4" }, tableLoading ? (react_1.default.createElement(loading_1.Loading, null)) : (react_1.default.createElement(calendar_1.Calendar, { currentDate: calendarTabMonth, calendarView: (
|
|
9037
|
+
return (react_1.default.createElement("div", { className: "mt-4" }, tableLoading ? (react_1.default.createElement(loading_1.Loading, null)) : (react_1.default.createElement(calendar_1.Calendar, { currentDate: calendarTabMonth, calendarView: (_43 = calendarSettings_1 === null || calendarSettings_1 === void 0 ? void 0 : calendarSettings_1.defaultView) !== null && _43 !== void 0 ? _43 : calendarView, handleMonthChange: function (date) {
|
|
8929
9038
|
var startOfMonth = (0, dayjs_1.default)(calendarTabMonth).startOf("month");
|
|
8930
9039
|
var endOfMonth = (0, dayjs_1.default)(calendarTabMonth).endOf("month");
|
|
8931
9040
|
if (!(0, dayjs_1.default)(date).isBetween(startOfMonth, endOfMonth)) {
|
|
@@ -8943,7 +9052,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8943
9052
|
else if (selectedTabData.viewType === "feeds") {
|
|
8944
9053
|
var contentList_1 = [];
|
|
8945
9054
|
var feedsSettings_1 = selectedTabData.feedsSettings;
|
|
8946
|
-
var customFeedsData = (
|
|
9055
|
+
var customFeedsData = (_44 = feedsSettings_1 === null || feedsSettings_1 === void 0 ? void 0 : feedsSettings_1.customFeedsData) === null || _44 === void 0 ? void 0 : _44.call(feedsSettings_1, tableData, spaceTableData);
|
|
8947
9056
|
if (customFeedsData && customFeedsData.length > 0) {
|
|
8948
9057
|
customFeedsData.map(function (eachData) {
|
|
8949
9058
|
var _a, _b, _c, _d;
|
|
@@ -8988,21 +9097,21 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
8988
9097
|
return (react_1.default.createElement("div", { className: "mt-4" }, tableLoading ? (react_1.default.createElement(loading_1.Loading, null)) : (react_1.default.createElement("div", {
|
|
8989
9098
|
// INFO: NewFeeds is already a card like the table and list, so the new
|
|
8990
9099
|
// DTW renders it bare; the legacy feed still needs its own surface
|
|
8991
|
-
className: ((
|
|
9100
|
+
className: ((_45 = props.bareSettings) === null || _45 === void 0 ? void 0 : _45.bareNewDTW)
|
|
8992
9101
|
? ""
|
|
8993
|
-
: "p-4 rounded-lg ".concat(((
|
|
8994
|
-
((
|
|
9102
|
+
: "p-4 rounded-lg ".concat(((_46 = props.organise) === null || _46 === void 0 ? void 0 : _46.darkMode) ? "bg-white/5" : "bg-white") },
|
|
9103
|
+
((_47 = props.bareSettings) === null || _47 === void 0 ? void 0 : _47.bareNewDTW) ? (react_1.default.createElement(newFeeds_1.NewFeeds, { bold: true, content: contentList_1, darkMode: (_48 = props.organise) === null || _48 === void 0 ? void 0 : _48.darkMode, onClickItem: function (id) { var _a, _b; return (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", id, "general"); } })) : (react_1.default.createElement(feeds_1.Feeds, { bold: true, content: contentList_1, darkMode: (_49 = props.organise) === null || _49 === void 0 ? void 0 : _49.darkMode })),
|
|
8995
9104
|
react_1.default.createElement("div", { className: "my-10" }),
|
|
8996
9105
|
contentList_1.length > 0 &&
|
|
8997
|
-
!((
|
|
8998
|
-
((
|
|
9106
|
+
!((_50 = props.organise) === null || _50 === void 0 ? void 0 : _50.hidePagination) &&
|
|
9107
|
+
((_51 = props.bareSettings) === null || _51 === void 0 ? void 0 : _51.bareNewDTW) && (react_1.default.createElement(newPagination_1.NewPagination, { paginationType: renderResolvedPaginationType(), pageIndex: pageIndex, limit: limit, size: size, cursor: cursor, resultCount: tableData.length, customPaginationSize: customPaginationSize, darkMode: (_52 = props.organise) === null || _52 === void 0 ? void 0 : _52.darkMode, darkModeBg: (_53 = props.organise) === null || _53 === void 0 ? void 0 : _53.darkModeBg, handleUpdatePageIndex: function (value) {
|
|
8999
9108
|
handlePagination(value);
|
|
9000
9109
|
} })),
|
|
9001
9110
|
contentList_1.length > 0 &&
|
|
9002
|
-
!((
|
|
9003
|
-
!((
|
|
9111
|
+
!((_54 = props.organise) === null || _54 === void 0 ? void 0 : _54.hidePagination) &&
|
|
9112
|
+
!((_55 = props.bareSettings) === null || _55 === void 0 ? void 0 : _55.bareNewDTW) && (react_1.default.createElement(pagination_1.Pagination, { data: tableData, size: size, limit: limit, cursor: cursor, pageIndex: pageIndex, paginationType: renderResolvedPaginationType(), handleUpdatePageIndex: function (value) {
|
|
9004
9113
|
handlePagination(value);
|
|
9005
|
-
}, darkMode: (
|
|
9114
|
+
}, darkMode: (_56 = props.organise) === null || _56 === void 0 ? void 0 : _56.darkMode, customPaginationSize: customPaginationSize }))))));
|
|
9006
9115
|
}
|
|
9007
9116
|
else if (selectedTabData.viewType === "map") {
|
|
9008
9117
|
var mapSettings_1 = selectedTabData.mapSettings;
|
|
@@ -9101,7 +9210,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
9101
9210
|
}
|
|
9102
9211
|
else if (selectedTabData.viewType === "kanban") {
|
|
9103
9212
|
var kanbanSettings = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.kanbanSettings;
|
|
9104
|
-
var kanbanTitle_2 = (
|
|
9213
|
+
var kanbanTitle_2 = (_57 = kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.title) !== null && _57 !== void 0 ? _57 : "";
|
|
9105
9214
|
var nullColumn_1 = false;
|
|
9106
9215
|
var groupBy_1 = [];
|
|
9107
9216
|
var groupLabel_1 = [];
|
|
@@ -9122,10 +9231,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
9122
9231
|
});
|
|
9123
9232
|
var kanbanData = renderGridAndListData("", "kanban", kanbanTitle_2, kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.useColumnName);
|
|
9124
9233
|
// INFO: when bareNewDTW is enabled, render NewKanban instead of legacy Kanban
|
|
9125
|
-
if ((
|
|
9234
|
+
if ((_58 = props.bareSettings) === null || _58 === void 0 ? void 0 : _58.bareNewDTW) {
|
|
9126
9235
|
return (react_1.default.createElement(newKanban_1.NewKanban, { className: "inline-flex", data: kanbanData, loading: tableLoading, groupBy: groupBy_1, groupId: kanbanTitle_2 !== null && kanbanTitle_2 !== void 0 ? kanbanTitle_2 : "", groupLabel: groupLabel_1.length > 0 ? groupLabel_1 : undefined, nullColumn: nullColumn_1, alertMessage: kanbanData.length === limit
|
|
9127
9236
|
? "Data has exceeded limit, please apply filters"
|
|
9128
|
-
: "", groupCluster: kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.groupCluster, draggable: true, droppable: kanbanDroppable, mobileView: (
|
|
9237
|
+
: "", groupCluster: kanbanSettings === null || kanbanSettings === void 0 ? void 0 : kanbanSettings.groupCluster, draggable: true, droppable: kanbanDroppable, mobileView: (_59 = props.bareSettings) === null || _59 === void 0 ? void 0 : _59.bareListMobileView, onUpdateData: function (cardId, _fromCol, toCol) {
|
|
9129
9238
|
var _a;
|
|
9130
9239
|
setKanbanDroppable(false);
|
|
9131
9240
|
handleSubmitData("update", cardId, kanbanTitle_2, (_a = {},
|
|
@@ -9134,7 +9243,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
9134
9243
|
}, onClickData: function (id) {
|
|
9135
9244
|
var _a, _b;
|
|
9136
9245
|
(_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.handleNavigate) === null || _b === void 0 ? void 0 : _b.call(_a, "read", id, "general");
|
|
9137
|
-
}, darkMode: (
|
|
9246
|
+
}, darkMode: (_60 = props.organise) === null || _60 === void 0 ? void 0 : _60.darkMode }));
|
|
9138
9247
|
}
|
|
9139
9248
|
return (react_1.default.createElement(kanban_1.Kanban, { className: "inline-flex", data: kanbanData, loading: tableLoading, groupBy: groupBy_1, groupId: kanbanTitle_2 !== null && kanbanTitle_2 !== void 0 ? kanbanTitle_2 : "", groupLabel: groupLabel_1.length > 0 ? groupLabel_1 : undefined, nullColumn: nullColumn_1, alertMessage: kanbanData.length === limit
|
|
9140
9249
|
? "Data has exceeded limit, please apply filters"
|