blixify-ui-web 1.2.63 → 1.2.64
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/action/radioList/index.d.ts +1 -0
- package/lib/components/action/radioList/index.d.ts.map +1 -1
- package/lib/components/action/radioList/index.js +15 -7
- package/lib/components/action/radioList/index.js.map +1 -1
- package/lib/components/advanced/popUp/index.d.ts +2 -0
- package/lib/components/advanced/popUp/index.d.ts.map +1 -1
- package/lib/components/advanced/popUp/index.js +1 -1
- package/lib/components/advanced/popUp/index.js.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.d.ts +1 -0
- package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +360 -311
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +3 -2
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/pagination.js +1 -1
- package/lib/components/data/dataTemplate/pagination.js.map +1 -1
- package/lib/components/data/dataWrapper/index.d.ts.map +1 -1
- package/lib/components/data/dataWrapper/index.js +3 -3
- package/lib/components/data/dataWrapper/index.js.map +1 -1
- package/lib/components/data/flexFilter/index.d.ts +6 -2
- package/lib/components/data/flexFilter/index.d.ts.map +1 -1
- package/lib/components/data/flexFilter/index.js +31 -27
- package/lib/components/data/flexFilter/index.js.map +1 -1
- package/lib/components/data/updateModule.d.ts +3 -0
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +41 -30
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/display/detailList/index.d.ts +1 -0
- package/lib/components/display/detailList/index.d.ts.map +1 -1
- package/lib/components/display/detailList/index.js +7 -3
- package/lib/components/display/detailList/index.js.map +1 -1
- package/lib/components/display/drawer/index.d.ts +2 -0
- package/lib/components/display/drawer/index.d.ts.map +1 -1
- package/lib/components/display/drawer/index.js +7 -2
- package/lib/components/display/drawer/index.js.map +1 -1
- package/lib/components/display/modal/index.d.ts +1 -0
- package/lib/components/display/modal/index.d.ts.map +1 -1
- package/lib/components/display/modal/index.js +6 -4
- package/lib/components/display/modal/index.js.map +1 -1
- package/lib/components/display/newCalendar/index.d.ts.map +1 -1
- package/lib/components/display/newCalendar/index.js +61 -27
- package/lib/components/display/newCalendar/index.js.map +1 -1
- package/lib/components/display/newFeeds/index.d.ts +2 -0
- package/lib/components/display/newFeeds/index.d.ts.map +1 -1
- package/lib/components/display/newFeeds/index.js +7 -7
- package/lib/components/display/newFeeds/index.js.map +1 -1
- package/lib/components/display/newKanban/index.d.ts.map +1 -1
- package/lib/components/display/newKanban/index.js +53 -17
- package/lib/components/display/newKanban/index.js.map +1 -1
- package/lib/components/display/newList/index.d.ts.map +1 -1
- package/lib/components/display/newList/index.js +11 -64
- package/lib/components/display/newList/index.js.map +1 -1
- package/lib/components/display/newPagination/index.d.ts +23 -0
- package/lib/components/display/newPagination/index.d.ts.map +1 -0
- package/lib/components/display/newPagination/index.js +69 -0
- package/lib/components/display/newPagination/index.js.map +1 -0
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +46 -190
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +4 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/input/checkbox/index.d.ts.map +1 -1
- package/lib/components/input/checkbox/index.js.map +1 -1
- package/lib/components/input/datePicker/index.d.ts.map +1 -1
- package/lib/components/input/datePicker/index.js +5 -5
- package/lib/components/input/datePicker/index.js.map +1 -1
- package/lib/components/input/select/index.d.ts.map +1 -1
- package/lib/components/input/select/index.js +48 -14
- package/lib/components/input/select/index.js.map +1 -1
- package/lib/components/input/textArea/index.d.ts.map +1 -1
- package/lib/components/input/textArea/index.js +3 -1
- package/lib/components/input/textArea/index.js.map +1 -1
- package/lib/components/input/textInput/index.d.ts.map +1 -1
- package/lib/components/input/textInput/index.js +10 -3
- package/lib/components/input/textInput/index.js.map +1 -1
- package/lib/components/input/uploadInput/index.js +1 -1
- package/lib/components/input/uploadInput/index.js.map +1 -1
- package/lib/components/navigation/tabs/index.js +1 -1
- package/lib/components/navigation/tabs/index.js.map +1 -1
- package/lib/tail.css +2 -2
- package/package.json +1 -1
|
@@ -89,6 +89,7 @@ var solid_3 = require("@heroicons/react/20/solid");
|
|
|
89
89
|
var outline_1 = require("@heroicons/react/24/outline");
|
|
90
90
|
var react_1 = require("@headlessui/react");
|
|
91
91
|
var axios_1 = __importDefault(require("axios"));
|
|
92
|
+
var newPagination_1 = require("../newPagination");
|
|
92
93
|
var react_2 = __importStar(require("react"));
|
|
93
94
|
var collapse_1 = require("../../advanced/collapse");
|
|
94
95
|
var popUp_1 = require("../../advanced/popUp");
|
|
@@ -205,10 +206,9 @@ var handleGetListColour = function (col, value) {
|
|
|
205
206
|
return column.listSelectionColour[index] || undefined;
|
|
206
207
|
};
|
|
207
208
|
var NewTable = function (props) {
|
|
208
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
209
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
209
210
|
var columns = (_b = (_a = props.columns) !== null && _a !== void 0 ? _a : props.header) !== null && _b !== void 0 ? _b : [];
|
|
210
211
|
var defaultLimit = 10;
|
|
211
|
-
var defaultPageSize = 5;
|
|
212
212
|
// INFO: flatten groupData columns so both mobile and desktop share the same
|
|
213
213
|
// resolved column list — groupData parent becomes individual sub-columns.
|
|
214
214
|
// Also filters out id/_id columns unless showId is explicitly enabled.
|
|
@@ -254,19 +254,19 @@ var NewTable = function (props) {
|
|
|
254
254
|
flatColumns.length = 0;
|
|
255
255
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
256
256
|
}
|
|
257
|
-
var
|
|
257
|
+
var _w = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _w[0], setIsFixed = _w[1];
|
|
258
258
|
//=====================================================================================
|
|
259
259
|
// SECTION: Advanced Settings
|
|
260
260
|
//=====================================================================================
|
|
261
|
-
var
|
|
262
|
-
var
|
|
261
|
+
var _x = (0, react_2.useState)(""), filterModal = _x[0], setFilterModal = _x[1];
|
|
262
|
+
var _y = (0, react_2.useState)(""), addColumnModal = _y[0], setAddColumnModal = _y[1];
|
|
263
263
|
//=====================================================================================
|
|
264
264
|
// SECTION: Editable & Addable cells
|
|
265
265
|
//=====================================================================================
|
|
266
|
-
var
|
|
267
|
-
var
|
|
268
|
-
var
|
|
269
|
-
var
|
|
266
|
+
var _z = (0, react_2.useState)(""), editDataRowId = _z[0], setEditDataRowId = _z[1];
|
|
267
|
+
var _0 = (0, react_2.useState)(""), editDataHeaderKey = _0[0], setEditDataHeaderKey = _0[1];
|
|
268
|
+
var _1 = (0, react_2.useState)(false), modalEditVisible = _1[0], setModalEditVisible = _1[1];
|
|
269
|
+
var _2 = (0, react_2.useState)([]), collapsedGroupIds = _2[0], setCollapsedGroupIds = _2[1];
|
|
270
270
|
// INFO: sheet-style row selection — Shift-click extends from the last
|
|
271
271
|
// clicked row, a mouse-down-and-drag down the checkbox column paints a
|
|
272
272
|
// range. The drag applies the start row itself, so the click that lands on
|
|
@@ -274,32 +274,8 @@ var NewTable = function (props) {
|
|
|
274
274
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
275
275
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
276
276
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
277
|
-
var
|
|
278
|
-
var
|
|
279
|
-
// INFO: the open colour palette for a filled list cell — which cell, and
|
|
280
|
-
// where to anchor the popover (viewport coordinates, so it escapes the
|
|
281
|
-
// table's overflow container)
|
|
282
|
-
var _4 = (0, react_2.useState)(null), paletteCell = _4[0], setPaletteCell = _4[1];
|
|
283
|
-
(0, react_2.useEffect)(function () {
|
|
284
|
-
if (!paletteCell)
|
|
285
|
-
return;
|
|
286
|
-
var handleClose = function () { return setPaletteCell(null); };
|
|
287
|
-
var handleKey = function (e) {
|
|
288
|
-
if (e.key === "Escape")
|
|
289
|
-
setPaletteCell(null);
|
|
290
|
-
};
|
|
291
|
-
// INFO: no scroll listener — opening the palette can itself scroll the
|
|
292
|
-
// table (the row switches to edit mode and its first input takes focus),
|
|
293
|
-
// and closing on that scroll would shut the palette as it appears
|
|
294
|
-
document.addEventListener("mousedown", handleClose);
|
|
295
|
-
document.addEventListener("keydown", handleKey);
|
|
296
|
-
window.addEventListener("resize", handleClose);
|
|
297
|
-
return function () {
|
|
298
|
-
document.removeEventListener("mousedown", handleClose);
|
|
299
|
-
document.removeEventListener("keydown", handleKey);
|
|
300
|
-
window.removeEventListener("resize", handleClose);
|
|
301
|
-
};
|
|
302
|
-
}, [paletteCell]);
|
|
277
|
+
var _3 = (0, react_2.useState)(false), isDragSelecting = _3[0], setIsDragSelecting = _3[1];
|
|
278
|
+
var _4 = (0, react_2.useState)(0), copiedCount = _4[0], setCopiedCount = _4[1];
|
|
303
279
|
var _5 = (0, react_2.useState)({}), editDataValue = _5[0], setEditDataValue = _5[1];
|
|
304
280
|
var _6 = (0, react_2.useState)(false), editDataIsLoading = _6[0], setEditDataIsLoading = _6[1];
|
|
305
281
|
var _7 = (0, react_2.useState)(false), addData = _7[0], setAddData = _7[1];
|
|
@@ -331,7 +307,7 @@ var NewTable = function (props) {
|
|
|
331
307
|
: "bg-white";
|
|
332
308
|
var borderRadius = "rounded-2xl";
|
|
333
309
|
var borderColor = props.darkMode ? "border-gray-700" : "border-gray-100";
|
|
334
|
-
var selectedRowBg = props.darkMode ? "bg-
|
|
310
|
+
var selectedRowBg = props.darkMode ? "bg-gray-700" : "bg-primary-50";
|
|
335
311
|
var rowHoverBg = props.darkMode ? "hover:bg-gray-700" : "hover:bg-gray-100";
|
|
336
312
|
var dividerColor = props.darkMode ? "divide-gray-700" : "divide-gray-100";
|
|
337
313
|
var cellFontColor = props.darkMode ? "text-gray-200" : "text-gray-700";
|
|
@@ -445,10 +421,13 @@ var NewTable = function (props) {
|
|
|
445
421
|
return false;
|
|
446
422
|
return filtered.every(function (col) { return !col.type || utils_1.supportedTableAddList.includes(col.type); });
|
|
447
423
|
};
|
|
424
|
+
// INFO: a list column with a palette edits through the ordinary Select, whose
|
|
425
|
+
// options render as the same coloured tags — one dropdown for every cell
|
|
426
|
+
var handleColumnShowsTags = function (col) { var _a; return ((_a = col.type) !== null && _a !== void 0 ? _a : "string") === "list" && !!col.listSelectionColour; };
|
|
448
427
|
var handleConvertColumnToDataStructure = function (cols) {
|
|
449
428
|
return cols.map(function (col) {
|
|
450
429
|
var _a;
|
|
451
|
-
return (__assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string" }));
|
|
430
|
+
return (__assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) }));
|
|
452
431
|
});
|
|
453
432
|
};
|
|
454
433
|
var handleCreateFormInputRefs = function (type) {
|
|
@@ -762,7 +741,7 @@ var NewTable = function (props) {
|
|
|
762
741
|
(0, react_2.useEffect)(function () {
|
|
763
742
|
var _a, _b;
|
|
764
743
|
var hasSelection = props.selectAll || ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
765
|
-
if (!hasSelection
|
|
744
|
+
if (!hasSelection)
|
|
766
745
|
return;
|
|
767
746
|
var handleKey = function (e) {
|
|
768
747
|
var _a, _b;
|
|
@@ -774,7 +753,7 @@ var NewTable = function (props) {
|
|
|
774
753
|
};
|
|
775
754
|
document.addEventListener("keydown", handleKey);
|
|
776
755
|
return function () { return document.removeEventListener("keydown", handleKey); };
|
|
777
|
-
}, [props.selectAll, props.selectedIds
|
|
756
|
+
}, [props.selectAll, props.selectedIds]);
|
|
778
757
|
// INFO: visible columns of the selected rows as TSV — header row first —
|
|
779
758
|
// so a paste into Excel or Sheets lands one value per cell
|
|
780
759
|
var handleCopySelection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1048,7 +1027,7 @@ var NewTable = function (props) {
|
|
|
1048
1027
|
};
|
|
1049
1028
|
var renderEditDataInputs = function (colIndex, col, rowData, rowId, rowBgClass, isHoverable) {
|
|
1050
1029
|
var _a, _b, _c, _d;
|
|
1051
|
-
var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string" });
|
|
1030
|
+
var tempDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_a = col.type) !== null && _a !== void 0 ? _a : "string", showTagSelections: handleColumnShowsTags(col) });
|
|
1052
1031
|
var editingRow = editDataRowId === rowId;
|
|
1053
1032
|
return (react_2.default.createElement("td", { key: col.key + String(colIndex),
|
|
1054
1033
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
@@ -1144,7 +1123,7 @@ var NewTable = function (props) {
|
|
|
1144
1123
|
return react_2.default.createElement(react_2.default.Fragment, null);
|
|
1145
1124
|
return (react_2.default.createElement("div", { className: "flex items-center" },
|
|
1146
1125
|
renderCheckbox(renderCheckAllSelected() || ((_b = props.selectAll) !== null && _b !== void 0 ? _b : false), function () { return handleSelectCurrentPage(renderCheckAllSelected()); }, undefined, "mr-1"),
|
|
1147
|
-
!props.disableSelectFullData && (react_2.default.createElement(popUp_1.PopUp, { anchor: "left", lib: { Transition: react_1.Transition }, ctaComp: react_2.default.createElement(solid_1.ChevronDownIcon, { className: "h-4 w-4 ".concat(cellFontColor, " cursor-pointer"), "aria-hidden": "true" }), renderComp: react_2.default.createElement("div", { className: "border rounded ".concat(borderColor, " ").concat(props.darkMode ? "bg-gray-800" : "bg-white") },
|
|
1126
|
+
!props.disableSelectFullData && (react_2.default.createElement(popUp_1.PopUp, { anchor: "left", darkMode: props.darkMode, darkModeBg: props.darkModeBg, lib: { Transition: react_1.Transition }, ctaComp: react_2.default.createElement(solid_1.ChevronDownIcon, { className: "h-4 w-4 ".concat(cellFontColor, " cursor-pointer"), "aria-hidden": "true" }), renderComp: react_2.default.createElement("div", { className: "border rounded ".concat(borderColor, " ").concat(props.darkMode ? "bg-gray-800" : "bg-white") },
|
|
1148
1127
|
react_2.default.createElement("p", { className: "px-4 py-3 text-xs ".concat(cellFontColor, " text-left whitespace-nowrap font-medium hover:cursor-pointer ").concat(props.darkMode ? "hover:bg-gray-700" : "hover:bg-gray-100"), onClick: function () { return handleSelectAllPages(true); } }, "Select all pages"),
|
|
1149
1128
|
react_2.default.createElement("p", { className: "px-4 py-3 text-xs ".concat(cellFontColor, " text-left whitespace-nowrap font-medium hover:cursor-pointer ").concat(props.darkMode ? "hover:bg-gray-700" : "hover:bg-gray-100"), onClick: function () { return handleSelectAllPages(false); } }, "Unselect all pages")) }))));
|
|
1150
1129
|
};
|
|
@@ -1184,7 +1163,7 @@ var NewTable = function (props) {
|
|
|
1184
1163
|
}, className: "group ".concat(isSelected
|
|
1185
1164
|
? selectedRowBg
|
|
1186
1165
|
: props.onClickRow
|
|
1187
|
-
? "cursor-pointer ".concat(rowHoverBg)
|
|
1166
|
+
? "cursor-pointer ".concat(isSelected ? "" : rowHoverBg)
|
|
1188
1167
|
: editDataIsLoading && editDataRowId === row.id
|
|
1189
1168
|
? "animate-pulse"
|
|
1190
1169
|
: "", " ").concat(groupAccent
|
|
@@ -1202,7 +1181,7 @@ var NewTable = function (props) {
|
|
|
1202
1181
|
? "opacity-50 cursor-not-allowed"
|
|
1203
1182
|
: ""))),
|
|
1204
1183
|
flatColumns.map(function (col, colIndex) {
|
|
1205
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
1184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
1206
1185
|
var cellValue = spaceRow
|
|
1207
1186
|
? spaceRow[col.key]
|
|
1208
1187
|
: resolveValue(row, col.key);
|
|
@@ -1218,8 +1197,7 @@ var NewTable = function (props) {
|
|
|
1218
1197
|
!!props.onObjectEdit;
|
|
1219
1198
|
var isEditable = ((_d = props.editable) === null || _d === void 0 ? void 0 : _d.active) &&
|
|
1220
1199
|
!isActionColumn &&
|
|
1221
|
-
!(((_f = (_e = props.selectedIds) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0 ||
|
|
1222
|
-
props.selectAll) &&
|
|
1200
|
+
!(((_f = (_e = props.selectedIds) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0 || props.selectAll) &&
|
|
1223
1201
|
utils_1.supportedInlineEditList.includes(resolvedColType);
|
|
1224
1202
|
var rowData = editDataRowId === row.id ? editDataValue : row;
|
|
1225
1203
|
// INFO: a list column with a palette paints the whole cell —
|
|
@@ -1229,25 +1207,12 @@ var NewTable = function (props) {
|
|
|
1229
1207
|
var fillColour = resolvedColType === "list" && !isActionColumn
|
|
1230
1208
|
? handleGetListColour(col, rawListValue)
|
|
1231
1209
|
: undefined;
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((
|
|
1237
|
-
react_2.default.createElement("div", { "data-testid": "table-fill-".concat(col.key), "data-colour": fillColour,
|
|
1238
|
-
? function (e) {
|
|
1239
|
-
e.stopPropagation();
|
|
1240
|
-
var rect = e.currentTarget.getBoundingClientRect();
|
|
1241
|
-
handleEditDataOnClick(row.id, col.key, row);
|
|
1242
|
-
setPaletteCell({
|
|
1243
|
-
rowId: row.id,
|
|
1244
|
-
key: col.key,
|
|
1245
|
-
top: rect.bottom + 4,
|
|
1246
|
-
left: rect.left,
|
|
1247
|
-
width: rect.width,
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
: undefined, className: "flex h-full min-h-[40px] items-center justify-center px-3 text-sm font-medium ".concat((_o = FILL_CLASS[fillColour]) !== null && _o !== void 0 ? _o : FILL_CLASS.default, " ").concat(canPickColour ? "cursor-pointer hover:brightness-95" : "") }, String(rawListValue))));
|
|
1210
|
+
// INFO: an editable table renders the coloured cell as its Select in
|
|
1211
|
+
// every row (filled while closed) so the control never swaps in and
|
|
1212
|
+
// out; the plain block is for read-only tables
|
|
1213
|
+
if (fillColour && !((_g = props.editable) === null || _g === void 0 ? void 0 : _g.active)) {
|
|
1214
|
+
return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((_j = (_h = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _h === void 0 ? void 0 : _h.className) !== null && _j !== void 0 ? _j : ""), style: (_k = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _k === void 0 ? void 0 : _k.style },
|
|
1215
|
+
react_2.default.createElement("div", { "data-testid": "table-fill-".concat(col.key), "data-colour": fillColour, className: "flex h-full min-h-[40px] items-center justify-center px-3 text-sm font-medium ".concat((_l = FILL_CLASS[fillColour]) !== null && _l !== void 0 ? _l : FILL_CLASS.default) }, String(rawListValue))));
|
|
1251
1216
|
}
|
|
1252
1217
|
if (isObjectEdit) {
|
|
1253
1218
|
return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
|
|
@@ -1269,18 +1234,15 @@ var NewTable = function (props) {
|
|
|
1269
1234
|
react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
|
|
1270
1235
|
}
|
|
1271
1236
|
if (isEditable) {
|
|
1272
|
-
var bareOverride = (
|
|
1237
|
+
var bareOverride = (_o = (_m = props.bareSettings) === null || _m === void 0 ? void 0 : _m.bareListDescription) === null || _o === void 0 ? void 0 : _o.call(_m, col.key, cellValue);
|
|
1273
1238
|
if (!bareOverride)
|
|
1274
1239
|
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
1275
1240
|
}
|
|
1276
1241
|
return (
|
|
1277
1242
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
1278
|
-
react_2.default.createElement("td", { key: col.key, "data-pin-key": leftPinned.includes(col.key) ||
|
|
1279
|
-
rightPinned.includes(col.key)
|
|
1243
|
+
react_2.default.createElement("td", { key: col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
|
|
1280
1244
|
? col.key
|
|
1281
|
-
: undefined, className: "".concat(cellPadding, " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((
|
|
1282
|
-
row.id +
|
|
1283
|
-
((_u = props.addNewTabUrl) !== null && _u !== void 0 ? _u : ""), className: "w-full block", linkType: props.linkType, custom: props.custom }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))));
|
|
1245
|
+
: undefined, className: "".concat(cellPadding, " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_q = (_p = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _p === void 0 ? void 0 : _p.className) !== null && _q !== void 0 ? _q : ""), style: (_r = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _r === void 0 ? void 0 : _r.style }, props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_s = props.addNewTabUrl) !== null && _s !== void 0 ? _s : ""), className: "w-full block", linkType: props.linkType, custom: props.custom }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))));
|
|
1284
1246
|
}),
|
|
1285
1247
|
renderActionColumnCell(row.id)));
|
|
1286
1248
|
};
|
|
@@ -1472,73 +1434,6 @@ var NewTable = function (props) {
|
|
|
1472
1434
|
});
|
|
1473
1435
|
}))));
|
|
1474
1436
|
};
|
|
1475
|
-
var renderPageNumber = function (type) {
|
|
1476
|
-
var _a, _b, _c, _d;
|
|
1477
|
-
var pageNumberList = [];
|
|
1478
|
-
var selectedBorderColor = props.darkMode
|
|
1479
|
-
? "border-primary-200"
|
|
1480
|
-
: "border-primary-500";
|
|
1481
|
-
var selectedFontColor = props.darkMode
|
|
1482
|
-
? "text-primary-200"
|
|
1483
|
-
: "text-primary-500";
|
|
1484
|
-
var basePageNumberClassname = "px-3 flex items-center h-full w-full text-sm font-medium cursor-pointer ";
|
|
1485
|
-
if (type === "page") {
|
|
1486
|
-
var pageOffset = Math.floor(((_a = props.pageIndex) !== null && _a !== void 0 ? _a : 0) / defaultPageSize);
|
|
1487
|
-
var _loop_1 = function (i) {
|
|
1488
|
-
var pageNumberClassName = basePageNumberClassname +
|
|
1489
|
-
(props.pageIndex === i
|
|
1490
|
-
? "border rounded-xl ".concat(selectedBorderColor, " ").concat(selectedFontColor, " ").concat(bgColor)
|
|
1491
|
-
: "".concat(cellFontColor));
|
|
1492
|
-
pageNumberList.push(react_2.default.createElement("div", { key: i, "aria-current": "page", className: pageNumberClassName, onClick: props.pageIndex !== i
|
|
1493
|
-
? function () { var _a; return (_a = props.handleUpdatePageIndex) === null || _a === void 0 ? void 0 : _a.call(props, i); }
|
|
1494
|
-
: function () { } }, i + 1));
|
|
1495
|
-
};
|
|
1496
|
-
for (var i = pageOffset * defaultPageSize; i * ((_b = props.limit) !== null && _b !== void 0 ? _b : defaultLimit) < ((_c = props.size) !== null && _c !== void 0 ? _c : props.data.length) &&
|
|
1497
|
-
i < pageOffset * defaultPageSize + defaultPageSize; i++) {
|
|
1498
|
-
_loop_1(i);
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
else if (type === "cursor") {
|
|
1502
|
-
pageNumberList.push(react_2.default.createElement("div", { "aria-current": "page", className: "".concat(basePageNumberClassname, " ").concat(selectedBorderColor, " ").concat(selectedFontColor) }, ((_d = props.pageIndex) !== null && _d !== void 0 ? _d : 0) + 1));
|
|
1503
|
-
}
|
|
1504
|
-
return pageNumberList;
|
|
1505
|
-
};
|
|
1506
|
-
var renderPagination = function () {
|
|
1507
|
-
var _a, _b, _c;
|
|
1508
|
-
var nextDataAvailable = ((_a = props.size) !== null && _a !== void 0 ? _a : 0) >
|
|
1509
|
-
(((_b = props.pageIndex) !== null && _b !== void 0 ? _b : 0) + 1) * ((_c = props.limit) !== null && _c !== void 0 ? _c : defaultLimit) ||
|
|
1510
|
-
props.cursor;
|
|
1511
|
-
switch (props.paginationType) {
|
|
1512
|
-
case "cursor":
|
|
1513
|
-
return (react_2.default.createElement("div", { className: "h-8 flex items-center justify-center gap-x-0.5", "aria-label": "Pagination" },
|
|
1514
|
-
react_2.default.createElement("button", { type: "button", disabled: props.pageIndex === 0 ? true : false, className: "p-2 ".concat(cellFontColor, " ").concat(props.pageIndex === 0 ? "cursor-not-allowed" : ""), onClick: function () { var _a; return (_a = props.handleUpdatePageIndex) === null || _a === void 0 ? void 0 : _a.call(props, "prev"); } },
|
|
1515
|
-
react_2.default.createElement(solid_1.ChevronLeftIcon, { className: "h-4 w-4", "aria-hidden": "true" })),
|
|
1516
|
-
renderPageNumber("cursor"),
|
|
1517
|
-
react_2.default.createElement("button", { type: "button", disabled: nextDataAvailable ? false : true, className: "p-2 ".concat(cellFontColor, " ").concat(nextDataAvailable ? "" : "cursor-not-allowed"), onClick: function () { var _a; return (_a = props.handleUpdatePageIndex) === null || _a === void 0 ? void 0 : _a.call(props, "next"); } },
|
|
1518
|
-
react_2.default.createElement(solid_1.ChevronRightIcon, { className: "h-4 w-4", "aria-hidden": "true" }))));
|
|
1519
|
-
case "page":
|
|
1520
|
-
var disablePrev = props.pageIndex === 0 ? true : false;
|
|
1521
|
-
return (react_2.default.createElement("div", { className: "h-8 flex items-center justify-center gap-x-0.5", "aria-label": "Pagination" },
|
|
1522
|
-
react_2.default.createElement("button", { type: "button", disabled: disablePrev, className: "p-2 ".concat(cellFontColor, " ").concat(disablePrev ? "cursor-not-allowed" : ""), onClick: function () { var _a, _b; return (_a = props.handleUpdatePageIndex) === null || _a === void 0 ? void 0 : _a.call(props, ((_b = props.pageIndex) !== null && _b !== void 0 ? _b : 0) - 1); } },
|
|
1523
|
-
react_2.default.createElement(solid_1.ChevronLeftIcon, { className: "h-4 w-4", "aria-hidden": "true" })),
|
|
1524
|
-
renderPageNumber("page"),
|
|
1525
|
-
react_2.default.createElement("button", { type: "button", disabled: nextDataAvailable ? false : true, className: "p-2 ".concat(cellFontColor, " ").concat(nextDataAvailable ? "" : "cursor-not-allowed"), onClick: function () { var _a, _b; return (_a = props.handleUpdatePageIndex) === null || _a === void 0 ? void 0 : _a.call(props, ((_b = props.pageIndex) !== null && _b !== void 0 ? _b : 0) + 1); } },
|
|
1526
|
-
react_2.default.createElement(solid_1.ChevronRightIcon, { className: "h-4 w-4", "aria-hidden": "true" }))));
|
|
1527
|
-
default:
|
|
1528
|
-
return react_2.default.createElement(react_2.default.Fragment, null);
|
|
1529
|
-
}
|
|
1530
|
-
};
|
|
1531
|
-
var renderPageResult = function () {
|
|
1532
|
-
var _a, _b;
|
|
1533
|
-
var text = "";
|
|
1534
|
-
if (props.paginationType === "page") {
|
|
1535
|
-
text = "Showing ".concat((_a = props.customPaginationSize) !== null && _a !== void 0 ? _a : props.size, " result(s)");
|
|
1536
|
-
}
|
|
1537
|
-
else {
|
|
1538
|
-
text = "Showing ".concat((_b = props.customPaginationSize) !== null && _b !== void 0 ? _b : props.data.length, " result(s)");
|
|
1539
|
-
}
|
|
1540
|
-
return react_2.default.createElement("p", { className: "text-xs ".concat(cellFontColor) }, text);
|
|
1541
|
-
};
|
|
1542
1437
|
var renderCheckbox = function (checked, onChange, onClick, extraClassName) { return (react_2.default.createElement("input", { type: "checkbox", checked: checked, onChange: onChange, onClick: onClick, className: "rounded ".concat(props.darkMode ? "border-gray-400" : "border-gray-500", " ").concat(bgColor, " focus:ring-0 focus:ring-offset-0 focus:outline-offset-0 checked:text-primary-400 ").concat(extraClassName !== null && extraClassName !== void 0 ? extraClassName : "") })); };
|
|
1543
1438
|
if (props.mobileView) {
|
|
1544
1439
|
var isIdLike_1 = function (c) {
|
|
@@ -1547,7 +1442,9 @@ var NewTable = function (props) {
|
|
|
1547
1442
|
var titleCol_1 = (_k = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _k !== void 0 ? _k : flatColumns[0];
|
|
1548
1443
|
var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
|
|
1549
1444
|
var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
|
|
1550
|
-
var headerBgColor_1 = props.darkMode
|
|
1445
|
+
var headerBgColor_1 = props.darkMode
|
|
1446
|
+
? ((_l = props.darkModeBg) !== null && _l !== void 0 ? _l : "bg-gray-900")
|
|
1447
|
+
: "";
|
|
1551
1448
|
var headerFontColor_1 = props.darkMode ? "text-white" : "";
|
|
1552
1449
|
// INFO: renders tag + trailing text adjacent to the Collapse title
|
|
1553
1450
|
var renderMobileTitleAdjacent_1 = function (row, spaceRow) {
|
|
@@ -1616,14 +1513,14 @@ var NewTable = function (props) {
|
|
|
1616
1513
|
})))));
|
|
1617
1514
|
};
|
|
1618
1515
|
return (react_2.default.createElement("div", null,
|
|
1619
|
-
react_2.default.createElement("div", { className: "w-full ".concat(((
|
|
1516
|
+
react_2.default.createElement("div", { className: "w-full ".concat(((_m = props.mobileTooltip) === null || _m === void 0 ? void 0 : _m.tooltip) ? "overflow-visible" : "overflow-hidden", " border ").concat(borderRadius, " ").concat(borderColor, " ").concat(bgColor, " shadow-sm divide-y ").concat(dividerColor, " ").concat((_o = props.className) !== null && _o !== void 0 ? _o : "") },
|
|
1620
1517
|
react_2.default.createElement("div", { className: "p-3 flex justify-between" },
|
|
1621
1518
|
renderSelectAll(),
|
|
1622
1519
|
renderSelectedCount()),
|
|
1623
1520
|
props.loading &&
|
|
1624
1521
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
1625
1522
|
react_2.default.createElement("div", { className: "h-5 w-3/4 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }),
|
|
1626
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (
|
|
1523
|
+
!props.loading && props.data.length === 0 && (react_2.default.createElement("p", { className: "p-4 text-center text-sm ".concat(cellFontColor) }, (_p = props.emptyTitle) !== null && _p !== void 0 ? _p : "No items")),
|
|
1627
1524
|
!props.loading &&
|
|
1628
1525
|
props.data.map(function (row, index) {
|
|
1629
1526
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1669,57 +1566,18 @@ var NewTable = function (props) {
|
|
|
1669
1566
|
((_g = props.mobileTooltip) === null || _g === void 0 ? void 0 : _g.tooltip) &&
|
|
1670
1567
|
renderMobileTooltipContent_1(row, spaceRow) && (react_2.default.createElement("div", { className: "absolute left-1/2 -translate-x-1/2 top-full mt-1 z-50 hidden group-hover/tooltip:block" }, renderMobileTooltipContent_1(row, spaceRow)))));
|
|
1671
1568
|
})),
|
|
1672
|
-
|
|
1673
|
-
? "pagination-container w-full sm:px-6 ".concat(borderColor, " ").concat(isFixed
|
|
1674
|
-
|
|
1675
|
-
: "sticky top-0 left-0")
|
|
1676
|
-
: "") },
|
|
1677
|
-
renderPageResult(),
|
|
1678
|
-
renderPagination())),
|
|
1569
|
+
react_2.default.createElement(newPagination_1.NewPagination, { paginationType: props.paginationType, pageIndex: props.pageIndex, limit: props.limit, size: props.size, cursor: props.cursor, resultCount: props.data.length, customPaginationSize: props.customPaginationSize, hidePagination: props.hidePagination, darkMode: props.darkMode, darkModeBg: props.darkModeBg, handleUpdatePageIndex: props.handleUpdatePageIndex, className: "".concat(props.fixedPagination
|
|
1570
|
+
? "pagination-container w-full sm:px-6 ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|
|
1571
|
+
: "") }),
|
|
1679
1572
|
renderFloatingActionBar()));
|
|
1680
1573
|
}
|
|
1681
|
-
return (react_2.default.createElement("div", { className: "w-full ".concat((
|
|
1574
|
+
return (react_2.default.createElement("div", { className: "w-full ".concat((_q = props.className) !== null && _q !== void 0 ? _q : "") },
|
|
1682
1575
|
react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
|
|
1683
1576
|
var _a, _b;
|
|
1684
1577
|
return (react_2.default.createElement("div", { className: "pb-44" },
|
|
1685
1578
|
react_2.default.createElement("div", { className: "pb-48" }, (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderFilterElements) === null || _b === void 0 ? void 0 : _b.call(_a, filterModal))));
|
|
1686
1579
|
}, onClose: function () { return setFilterModal(""); } }),
|
|
1687
|
-
|
|
1688
|
-
(function () {
|
|
1689
|
-
var _a;
|
|
1690
|
-
var column = flatColumns.find(function (eachCol) { return eachCol.key === paletteCell.key; });
|
|
1691
|
-
var row = props.data.find(function (eachRow) { return eachRow.id === paletteCell.rowId; });
|
|
1692
|
-
if (!column || !row)
|
|
1693
|
-
return null;
|
|
1694
|
-
var current = resolveValue(row, column.key);
|
|
1695
|
-
return (react_2.default.createElement("div", { "data-testid": "table-fill-palette", role: "listbox", className: "fixed z-50 grid grid-cols-2 gap-1.5 rounded-lg border border-gray-200 bg-white p-2 shadow-xl", style: {
|
|
1696
|
-
top: paletteCell.top,
|
|
1697
|
-
left: paletteCell.left,
|
|
1698
|
-
minWidth: Math.max(paletteCell.width, 200),
|
|
1699
|
-
}, onMouseDown: function (e) { return e.stopPropagation(); } }, ((_a = column.listSelection) !== null && _a !== void 0 ? _a : []).map(function (option, index) {
|
|
1700
|
-
var _a, _b;
|
|
1701
|
-
var colour = (_a = column.listSelectionColour) === null || _a === void 0 ? void 0 : _a[index];
|
|
1702
|
-
var fillClass = colour
|
|
1703
|
-
? ((_b = FILL_CLASS[colour]) !== null && _b !== void 0 ? _b : FILL_CLASS.default)
|
|
1704
|
-
: "bg-gray-100 text-gray-700";
|
|
1705
|
-
return (react_2.default.createElement("button", { key: option, type: "button", role: "option", "aria-selected": option === current, "data-testid": "table-fill-option-".concat(option), className: "rounded-md px-3 py-2 text-center text-sm font-medium ".concat(fillClass, " hover:brightness-95 ").concat(option === current
|
|
1706
|
-
? "ring-2 ring-primary-500 ring-offset-1"
|
|
1707
|
-
: ""), onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1708
|
-
var _a;
|
|
1709
|
-
return __generator(this, function (_b) {
|
|
1710
|
-
switch (_b.label) {
|
|
1711
|
-
case 0:
|
|
1712
|
-
setPaletteCell(null);
|
|
1713
|
-
return [4 /*yield*/, handleEditDataOnBlur(column.key, __assign(__assign({}, row), (_a = {}, _a[column.key] = option, _a)))];
|
|
1714
|
-
case 1:
|
|
1715
|
-
_b.sent();
|
|
1716
|
-
return [2 /*return*/];
|
|
1717
|
-
}
|
|
1718
|
-
});
|
|
1719
|
-
}); } }, option));
|
|
1720
|
-
})));
|
|
1721
|
-
})(),
|
|
1722
|
-
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_r = (_q = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _q === void 0 ? void 0 : _q.title) !== null && _r !== void 0 ? _r : "Edit", onClose: handleModalEditClose, renderContent: function () {
|
|
1580
|
+
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (_s = (_r = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; })) === null || _r === void 0 ? void 0 : _r.title) !== null && _s !== void 0 ? _s : "Edit", onClose: handleModalEditClose, renderContent: function () {
|
|
1723
1581
|
var _a, _b, _c, _d;
|
|
1724
1582
|
var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
|
|
1725
1583
|
if (!selectedCol)
|
|
@@ -1760,7 +1618,7 @@ var NewTable = function (props) {
|
|
|
1760
1618
|
return (react_2.default.createElement("div", null, (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderAddColumnElements) === null || _b === void 0 ? void 0 : _b.call(_a, addColumnModal, function (id) { return handleAddColumnModal(id); })));
|
|
1761
1619
|
}, onClose: function () { return handleAddColumnModal(""); } }),
|
|
1762
1620
|
react_2.default.createElement(scrollShadow_1.ScrollShadow, { className: "w-full overflow-x-auto ".concat(borderRadius, " border ").concat(borderColor, " ").concat(bgColor, " shadow-sm"), shadowFrom: props.darkMode ? "from-gray-900" : "from-white" },
|
|
1763
|
-
(props.selectAll || ((
|
|
1621
|
+
(props.selectAll || ((_u = (_t = props.selectedIds) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) > 0) &&
|
|
1764
1622
|
(!props.multiActionFloatingBtns ||
|
|
1765
1623
|
(props.multiActionFloatingBtns &&
|
|
1766
1624
|
props.multiActionFloatingBtns.length <= 0)) && (react_2.default.createElement("div", { className: "sticky left-0 flex flex-row items-center px-4 py-3 gap-x-2" },
|
|
@@ -1776,13 +1634,11 @@ var NewTable = function (props) {
|
|
|
1776
1634
|
react_2.default.createElement("div", { className: "h-5 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }))); }),
|
|
1777
1635
|
!props.loading && renderDesktopRows(),
|
|
1778
1636
|
!props.loading && addData && renderAddDataRow())),
|
|
1779
|
-
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (
|
|
1637
|
+
!props.loading && props.data.length === 0 && (react_2.default.createElement("div", { className: "p-4 text-sm ".concat(cellFontColor, " text-center sticky left-0") }, (_v = props.emptyTitle) !== null && _v !== void 0 ? _v : "No items")),
|
|
1780
1638
|
renderAddableSection()),
|
|
1781
|
-
|
|
1639
|
+
react_2.default.createElement(newPagination_1.NewPagination, { paginationType: props.paginationType, pageIndex: props.pageIndex, limit: props.limit, size: props.size, cursor: props.cursor, resultCount: props.data.length, customPaginationSize: props.customPaginationSize, hidePagination: props.hidePagination, darkMode: props.darkMode, darkModeBg: props.darkModeBg, handleUpdatePageIndex: props.handleUpdatePageIndex, className: "".concat(props.fixedPagination
|
|
1782
1640
|
? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|
|
1783
|
-
: "") },
|
|
1784
|
-
renderPageResult(),
|
|
1785
|
-
renderPagination())),
|
|
1641
|
+
: "") }),
|
|
1786
1642
|
renderFloatingActionBar()));
|
|
1787
1643
|
};
|
|
1788
1644
|
exports.NewTable = NewTable;
|