blixify-ui-web 1.2.60 → 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 +3 -0
- package/lib/components/action/radioList/index.d.ts.map +1 -1
- package/lib/components/action/radioList/index.js +25 -11
- 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 +10 -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 +698 -429
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +5 -0
- 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/listModule.d.ts.map +1 -1
- package/lib/components/data/listModule.js +7 -1
- package/lib/components/data/listModule.js.map +1 -1
- package/lib/components/data/moduleUtils.d.ts +1 -0
- package/lib/components/data/moduleUtils.d.ts.map +1 -1
- package/lib/components/data/moduleUtils.js +144 -114
- package/lib/components/data/moduleUtils.js.map +1 -1
- package/lib/components/data/readModule.d.ts.map +1 -1
- package/lib/components/data/readModule.js +24 -6
- package/lib/components/data/readModule.js.map +1 -1
- package/lib/components/data/testSchema.js +1 -1
- package/lib/components/data/testSchema.js.map +1 -1
- package/lib/components/data/updateModule.d.ts +6 -0
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +79 -41
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/data/utils.d.ts +2 -0
- package/lib/components/data/utils.d.ts.map +1 -1
- package/lib/components/data/utils.js +42 -1
- package/lib/components/data/utils.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/flexTable/index.d.ts +14 -0
- package/lib/components/display/flexTable/index.d.ts.map +1 -1
- package/lib/components/display/flexTable/index.js +97 -17
- package/lib/components/display/flexTable/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 +8 -0
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +381 -204
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/display/notification/index.d.ts +2 -0
- package/lib/components/display/notification/index.d.ts.map +1 -1
- package/lib/components/display/notification/index.js +2 -1
- package/lib/components/display/notification/index.js.map +1 -1
- package/lib/components/display/scrollShadow/index.d.ts +9 -0
- package/lib/components/display/scrollShadow/index.d.ts.map +1 -0
- package/lib/components/display/scrollShadow/index.js +66 -0
- package/lib/components/display/scrollShadow/index.js.map +1 -0
- package/lib/components/display/stepper/index.d.ts +3 -0
- package/lib/components/display/stepper/index.d.ts.map +1 -1
- package/lib/components/display/stepper/index.js +28 -11
- package/lib/components/display/stepper/index.js.map +1 -1
- package/lib/components/display/table/index.d.ts.map +1 -1
- package/lib/components/display/table/index.js +3 -2
- package/lib/components/display/table/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 +9 -9
- 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 +57 -22
- 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 +22 -4
- 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 +32 -12
- 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");
|
|
@@ -102,6 +103,7 @@ var iconButton_1 = require("../../action/iconButton");
|
|
|
102
103
|
var link_1 = require("../../structure/link");
|
|
103
104
|
var button_1 = require("../../action/button");
|
|
104
105
|
var modal_1 = require("../modal");
|
|
106
|
+
var scrollShadow_1 = require("../scrollShadow");
|
|
105
107
|
// INFO: resolve dotted key paths (e.g. "group.subKey") against a row object.
|
|
106
108
|
// Required because flatColumns uses "parent.child" keys for groupData sub-columns.
|
|
107
109
|
var resolveValue = function (row, key) {
|
|
@@ -157,11 +159,56 @@ var handleCheckModalEditEmpty = function (value) {
|
|
|
157
159
|
}
|
|
158
160
|
return false;
|
|
159
161
|
};
|
|
162
|
+
// INFO: literal class maps so Tailwind emits them. Keys match the Tag palette
|
|
163
|
+
// (tag/utils.ts) so a column's listSelectionColour drives both the chip in the
|
|
164
|
+
// read view and the solid fill in the table. Yellow gets dark text — white on
|
|
165
|
+
// yellow-500 fails contrast.
|
|
166
|
+
var FILL_CLASS = {
|
|
167
|
+
default: "bg-primary-500 text-white",
|
|
168
|
+
red: "bg-red-500 text-white",
|
|
169
|
+
blue: "bg-blue-500 text-white",
|
|
170
|
+
green: "bg-green-500 text-white",
|
|
171
|
+
yellow: "bg-yellow-400 text-yellow-950",
|
|
172
|
+
indigo: "bg-indigo-500 text-white",
|
|
173
|
+
dark: "bg-gray-800 text-white",
|
|
174
|
+
};
|
|
175
|
+
// INFO: group band (tinted) and the accent bar its member rows carry
|
|
176
|
+
var BAND_CLASS = {
|
|
177
|
+
default: "bg-primary-50 text-primary-800 border-primary-500",
|
|
178
|
+
red: "bg-red-50 text-red-800 border-red-500",
|
|
179
|
+
blue: "bg-blue-50 text-blue-800 border-blue-500",
|
|
180
|
+
green: "bg-green-50 text-green-800 border-green-500",
|
|
181
|
+
yellow: "bg-yellow-50 text-yellow-800 border-yellow-500",
|
|
182
|
+
indigo: "bg-indigo-50 text-indigo-800 border-indigo-500",
|
|
183
|
+
dark: "bg-gray-100 text-gray-800 border-gray-700",
|
|
184
|
+
none: "bg-gray-50 text-gray-700 border-gray-300",
|
|
185
|
+
};
|
|
186
|
+
var ACCENT_CLASS = {
|
|
187
|
+
default: "border-primary-500",
|
|
188
|
+
red: "border-red-500",
|
|
189
|
+
blue: "border-blue-500",
|
|
190
|
+
green: "border-green-500",
|
|
191
|
+
yellow: "border-yellow-500",
|
|
192
|
+
indigo: "border-indigo-500",
|
|
193
|
+
dark: "border-gray-700",
|
|
194
|
+
none: "border-gray-300",
|
|
195
|
+
};
|
|
196
|
+
// INFO: the colour a list column assigns to a value, or undefined when the
|
|
197
|
+
// column carries no palette — undefined means "render as before"
|
|
198
|
+
var handleGetListColour = function (col, value) {
|
|
199
|
+
var column = col;
|
|
200
|
+
if (!Array.isArray(column.listSelection) ||
|
|
201
|
+
!Array.isArray(column.listSelectionColour))
|
|
202
|
+
return undefined;
|
|
203
|
+
var index = column.listSelection.indexOf(value);
|
|
204
|
+
if (index < 0)
|
|
205
|
+
return undefined;
|
|
206
|
+
return column.listSelectionColour[index] || undefined;
|
|
207
|
+
};
|
|
160
208
|
var NewTable = function (props) {
|
|
161
|
-
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;
|
|
162
210
|
var columns = (_b = (_a = props.columns) !== null && _a !== void 0 ? _a : props.header) !== null && _b !== void 0 ? _b : [];
|
|
163
211
|
var defaultLimit = 10;
|
|
164
|
-
var defaultPageSize = 5;
|
|
165
212
|
// INFO: flatten groupData columns so both mobile and desktop share the same
|
|
166
213
|
// resolved column list — groupData parent becomes individual sub-columns.
|
|
167
214
|
// Also filters out id/_id columns unless showId is explicitly enabled.
|
|
@@ -207,30 +254,40 @@ var NewTable = function (props) {
|
|
|
207
254
|
flatColumns.length = 0;
|
|
208
255
|
flatColumns.push.apply(flatColumns, __spreadArray(__spreadArray(__spreadArray([], leftCols, false), middleCols, false), rightCols, false));
|
|
209
256
|
}
|
|
210
|
-
var
|
|
257
|
+
var _w = (0, react_2.useState)(props.fixedPagination ? true : false), isFixed = _w[0], setIsFixed = _w[1];
|
|
211
258
|
//=====================================================================================
|
|
212
259
|
// SECTION: Advanced Settings
|
|
213
260
|
//=====================================================================================
|
|
214
|
-
var
|
|
215
|
-
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];
|
|
216
263
|
//=====================================================================================
|
|
217
264
|
// SECTION: Editable & Addable cells
|
|
218
265
|
//=====================================================================================
|
|
219
|
-
var
|
|
220
|
-
var
|
|
221
|
-
var
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
+
// INFO: sheet-style row selection — Shift-click extends from the last
|
|
271
|
+
// clicked row, a mouse-down-and-drag down the checkbox column paints a
|
|
272
|
+
// range. The drag applies the start row itself, so the click that lands on
|
|
273
|
+
// mouse-up must be swallowed or it would toggle that row straight back.
|
|
274
|
+
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
275
|
+
var dragSelectRef = (0, react_2.useRef)(null);
|
|
276
|
+
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
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];
|
|
279
|
+
var _5 = (0, react_2.useState)({}), editDataValue = _5[0], setEditDataValue = _5[1];
|
|
280
|
+
var _6 = (0, react_2.useState)(false), editDataIsLoading = _6[0], setEditDataIsLoading = _6[1];
|
|
281
|
+
var _7 = (0, react_2.useState)(false), addData = _7[0], setAddData = _7[1];
|
|
282
|
+
var _8 = (0, react_2.useState)({}), addDataValue = _8[0], setAddDataValue = _8[1];
|
|
283
|
+
var _9 = (0, react_2.useState)({}), referencesOptions = _9[0], setReferencesOptions = _9[1];
|
|
227
284
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
228
285
|
// results still win per key
|
|
229
286
|
var mergedReferencesOptions = __assign(__assign({}, ((_g = props.referencesOptions) !== null && _g !== void 0 ? _g : {})), referencesOptions);
|
|
230
|
-
var
|
|
231
|
-
var
|
|
287
|
+
var _10 = (0, react_2.useState)({}), referencesDetails = _10[0], setReferencesDetails = _10[1];
|
|
288
|
+
var _11 = (0, react_2.useState)(false), referenceLoading = _11[0], setReferenceLoading = _11[1];
|
|
232
289
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
233
|
-
var
|
|
290
|
+
var _12 = (0, react_2.useState)({}), measuredPinWidths = _12[0], setMeasuredPinWidths = _12[1];
|
|
234
291
|
var editDataValueRef = (0, react_2.useRef)({});
|
|
235
292
|
var editDataRowIdRef = (0, react_2.useRef)("");
|
|
236
293
|
var editDataInputRefs = (0, react_2.useRef)([]);
|
|
@@ -250,7 +307,7 @@ var NewTable = function (props) {
|
|
|
250
307
|
: "bg-white";
|
|
251
308
|
var borderRadius = "rounded-2xl";
|
|
252
309
|
var borderColor = props.darkMode ? "border-gray-700" : "border-gray-100";
|
|
253
|
-
var selectedRowBg = props.darkMode ? "bg-
|
|
310
|
+
var selectedRowBg = props.darkMode ? "bg-gray-700" : "bg-primary-50";
|
|
254
311
|
var rowHoverBg = props.darkMode ? "hover:bg-gray-700" : "hover:bg-gray-100";
|
|
255
312
|
var dividerColor = props.darkMode ? "divide-gray-700" : "divide-gray-100";
|
|
256
313
|
var cellFontColor = props.darkMode ? "text-gray-200" : "text-gray-700";
|
|
@@ -258,6 +315,10 @@ var NewTable = function (props) {
|
|
|
258
315
|
? "text-primary-300 font-medium"
|
|
259
316
|
: "text-primary-600 font-medium";
|
|
260
317
|
var cellPadding = "px-4 py-2";
|
|
318
|
+
// INFO: an inline input carries its own vertical padding, so the cell around
|
|
319
|
+
// it keeps only enough to clear the hover border — this is what holds an
|
|
320
|
+
// editable row to roughly the height of a read-only one
|
|
321
|
+
var editCellPadding = "px-4 py-0.5";
|
|
261
322
|
var tableHeaderBgColor = props.tableHeaderBgColor
|
|
262
323
|
? props.tableHeaderBgColor
|
|
263
324
|
: props.darkMode
|
|
@@ -360,10 +421,13 @@ var NewTable = function (props) {
|
|
|
360
421
|
return false;
|
|
361
422
|
return filtered.every(function (col) { return !col.type || utils_1.supportedTableAddList.includes(col.type); });
|
|
362
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; };
|
|
363
427
|
var handleConvertColumnToDataStructure = function (cols) {
|
|
364
428
|
return cols.map(function (col) {
|
|
365
429
|
var _a;
|
|
366
|
-
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) }));
|
|
367
431
|
});
|
|
368
432
|
};
|
|
369
433
|
var handleCreateFormInputRefs = function (type) {
|
|
@@ -610,9 +674,134 @@ var NewTable = function (props) {
|
|
|
610
674
|
var handleFilterModal = function (id) {
|
|
611
675
|
setFilterModal(id);
|
|
612
676
|
};
|
|
677
|
+
var handleSelectRange = function (fromIndex, toIndex, mode, base) {
|
|
678
|
+
if (!props.handleSelectedIds)
|
|
679
|
+
return;
|
|
680
|
+
var _a = fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex], low = _a[0], high = _a[1];
|
|
681
|
+
var rangeIds = props.data
|
|
682
|
+
.slice(low, high + 1)
|
|
683
|
+
.map(function (eachRow) { return eachRow.id; });
|
|
684
|
+
if (mode === "remove") {
|
|
685
|
+
props.handleSelectedIds(base.filter(function (eachId) { return !rangeIds.includes(eachId); }));
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
var next = __spreadArray([], base, true);
|
|
689
|
+
rangeIds.forEach(function (eachId) {
|
|
690
|
+
if (next.includes(eachId))
|
|
691
|
+
return;
|
|
692
|
+
if (props.maxSelectedCount && next.length >= props.maxSelectedCount)
|
|
693
|
+
return;
|
|
694
|
+
next.push(eachId);
|
|
695
|
+
});
|
|
696
|
+
props.handleSelectedIds(next);
|
|
697
|
+
};
|
|
698
|
+
var handleDragSelectStart = function (rowId, e) {
|
|
699
|
+
var _a;
|
|
700
|
+
if (props.singleSelect ||
|
|
701
|
+
props.selectAll ||
|
|
702
|
+
!props.handleSelectedIds ||
|
|
703
|
+
e.button !== 0 ||
|
|
704
|
+
e.shiftKey)
|
|
705
|
+
return;
|
|
706
|
+
// INFO: stop the browser from starting a text selection as the pointer
|
|
707
|
+
// sweeps down the column
|
|
708
|
+
e.preventDefault();
|
|
709
|
+
var startIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
|
|
710
|
+
if (startIndex < 0)
|
|
711
|
+
return;
|
|
712
|
+
var base = (_a = props.selectedIds) !== null && _a !== void 0 ? _a : [];
|
|
713
|
+
var mode = base.includes(rowId) ? "remove" : "add";
|
|
714
|
+
dragSelectRef.current = { startIndex: startIndex, mode: mode, base: base };
|
|
715
|
+
suppressNextClickRef.current = true;
|
|
716
|
+
lastSelectedRowRef.current = rowId;
|
|
717
|
+
setIsDragSelecting(true);
|
|
718
|
+
handleSelectRange(startIndex, startIndex, mode, base);
|
|
719
|
+
};
|
|
720
|
+
var handleDragSelectOver = function (rowId) {
|
|
721
|
+
var drag = dragSelectRef.current;
|
|
722
|
+
if (!drag)
|
|
723
|
+
return;
|
|
724
|
+
var overIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
|
|
725
|
+
if (overIndex < 0)
|
|
726
|
+
return;
|
|
727
|
+
handleSelectRange(drag.startIndex, overIndex, drag.mode, drag.base);
|
|
728
|
+
};
|
|
729
|
+
(0, react_2.useEffect)(function () {
|
|
730
|
+
if (!isDragSelecting)
|
|
731
|
+
return;
|
|
732
|
+
var handleEnd = function () {
|
|
733
|
+
dragSelectRef.current = null;
|
|
734
|
+
setIsDragSelecting(false);
|
|
735
|
+
};
|
|
736
|
+
document.addEventListener("mouseup", handleEnd);
|
|
737
|
+
return function () { return document.removeEventListener("mouseup", handleEnd); };
|
|
738
|
+
}, [isDragSelecting]);
|
|
739
|
+
// INFO: Esc drops the whole selection, the way it drops a range in a sheet.
|
|
740
|
+
// When the colour palette is open Esc closes that instead (its own handler).
|
|
741
|
+
(0, react_2.useEffect)(function () {
|
|
742
|
+
var _a, _b;
|
|
743
|
+
var hasSelection = props.selectAll || ((_b = (_a = props.selectedIds) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
744
|
+
if (!hasSelection)
|
|
745
|
+
return;
|
|
746
|
+
var handleKey = function (e) {
|
|
747
|
+
var _a, _b;
|
|
748
|
+
if (e.key !== "Escape")
|
|
749
|
+
return;
|
|
750
|
+
(_a = props.handleSelectAll) === null || _a === void 0 ? void 0 : _a.call(props, false);
|
|
751
|
+
(_b = props.handleSelectedIds) === null || _b === void 0 ? void 0 : _b.call(props, []);
|
|
752
|
+
lastSelectedRowRef.current = null;
|
|
753
|
+
};
|
|
754
|
+
document.addEventListener("keydown", handleKey);
|
|
755
|
+
return function () { return document.removeEventListener("keydown", handleKey); };
|
|
756
|
+
}, [props.selectAll, props.selectedIds]);
|
|
757
|
+
// INFO: visible columns of the selected rows as TSV — header row first —
|
|
758
|
+
// so a paste into Excel or Sheets lands one value per cell
|
|
759
|
+
var handleCopySelection = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
760
|
+
var columns, rowIndexes, lines, err_1;
|
|
761
|
+
return __generator(this, function (_a) {
|
|
762
|
+
switch (_a.label) {
|
|
763
|
+
case 0:
|
|
764
|
+
columns = flatColumns.filter(function (eachCol) { return !(eachCol.key === "update" && !eachCol.type); });
|
|
765
|
+
rowIndexes = props.data
|
|
766
|
+
.map(function (_eachRow, index) { return index; })
|
|
767
|
+
.filter(function (index) {
|
|
768
|
+
var _a;
|
|
769
|
+
return props.selectAll ||
|
|
770
|
+
((_a = props.selectedIds) !== null && _a !== void 0 ? _a : []).includes(props.data[index].id);
|
|
771
|
+
});
|
|
772
|
+
lines = __spreadArray([
|
|
773
|
+
columns.map(function (eachCol) { var _a; return (_a = eachCol.title) !== null && _a !== void 0 ? _a : eachCol.key; }).join("\t")
|
|
774
|
+
], rowIndexes.map(function (index) {
|
|
775
|
+
return columns
|
|
776
|
+
.map(function (eachCol) {
|
|
777
|
+
var _a;
|
|
778
|
+
return resolveValueToString(eachCol.key, (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index], props.data[index]).replace(/[\t\n\r]+/g, " ");
|
|
779
|
+
})
|
|
780
|
+
.join("\t");
|
|
781
|
+
}), true);
|
|
782
|
+
_a.label = 1;
|
|
783
|
+
case 1:
|
|
784
|
+
_a.trys.push([1, 3, , 4]);
|
|
785
|
+
return [4 /*yield*/, navigator.clipboard.writeText(lines.join("\n"))];
|
|
786
|
+
case 2:
|
|
787
|
+
_a.sent();
|
|
788
|
+
setCopiedCount(rowIndexes.length);
|
|
789
|
+
setTimeout(function () { return setCopiedCount(0); }, 1500);
|
|
790
|
+
return [3 /*break*/, 4];
|
|
791
|
+
case 3:
|
|
792
|
+
err_1 = _a.sent();
|
|
793
|
+
return [3 /*break*/, 4];
|
|
794
|
+
case 4: return [2 /*return*/];
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}); };
|
|
613
798
|
var handleSelectRow = function (rowId, e) {
|
|
614
799
|
var _a, _b;
|
|
615
800
|
e.stopPropagation();
|
|
801
|
+
if (suppressNextClickRef.current) {
|
|
802
|
+
suppressNextClickRef.current = false;
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
616
805
|
// INFO: deactivate "select all pages" mode before doing individual row toggle
|
|
617
806
|
if (props.selectAll) {
|
|
618
807
|
(_a = props.handleSelectAll) === null || _a === void 0 ? void 0 : _a.call(props, false);
|
|
@@ -625,6 +814,15 @@ var NewTable = function (props) {
|
|
|
625
814
|
}
|
|
626
815
|
else {
|
|
627
816
|
var current = (_b = props.selectedIds) !== null && _b !== void 0 ? _b : [];
|
|
817
|
+
if (e.shiftKey && lastSelectedRowRef.current) {
|
|
818
|
+
var fromIndex = props.data.findIndex(function (eachRow) { return eachRow.id === lastSelectedRowRef.current; });
|
|
819
|
+
var toIndex = props.data.findIndex(function (eachRow) { return eachRow.id === rowId; });
|
|
820
|
+
if (fromIndex >= 0 && toIndex >= 0) {
|
|
821
|
+
handleSelectRange(fromIndex, toIndex, "add", current);
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
lastSelectedRowRef.current = rowId;
|
|
628
826
|
var idx = current.indexOf(rowId);
|
|
629
827
|
// INFO: allow deselect, block new selection when maxSelectedCount is reached
|
|
630
828
|
if (idx < 0 &&
|
|
@@ -829,11 +1027,11 @@ var NewTable = function (props) {
|
|
|
829
1027
|
};
|
|
830
1028
|
var renderEditDataInputs = function (colIndex, col, rowData, rowId, rowBgClass, isHoverable) {
|
|
831
1029
|
var _a, _b, _c, _d;
|
|
832
|
-
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) });
|
|
833
1031
|
var editingRow = editDataRowId === rowId;
|
|
834
1032
|
return (react_2.default.createElement("td", { key: col.key + String(colIndex),
|
|
835
1033
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
836
|
-
className: "".concat(
|
|
1034
|
+
className: "".concat(editCellPadding, " ").concat(getPinProps(col.key, false) ? "" : "whitespace-nowrap", " text-sm ").concat(cellFontColor, " ").concat((_c = (_b = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _b === void 0 ? void 0 : _b.className) !== null && _c !== void 0 ? _c : ""), style: (_d = getPinProps(col.key, false, rowBgClass, isHoverable)) === null || _d === void 0 ? void 0 : _d.style },
|
|
837
1035
|
react_2.default.createElement("div", { className: "w-max p-[1px]", onClick: function (e) {
|
|
838
1036
|
e.stopPropagation();
|
|
839
1037
|
handleEditDataOnClick(rowId, col.key, rowData);
|
|
@@ -925,7 +1123,7 @@ var NewTable = function (props) {
|
|
|
925
1123
|
return react_2.default.createElement(react_2.default.Fragment, null);
|
|
926
1124
|
return (react_2.default.createElement("div", { className: "flex items-center" },
|
|
927
1125
|
renderCheckbox(renderCheckAllSelected() || ((_b = props.selectAll) !== null && _b !== void 0 ? _b : false), function () { return handleSelectCurrentPage(renderCheckAllSelected()); }, undefined, "mr-1"),
|
|
928
|
-
!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") },
|
|
929
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"),
|
|
930
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")) }))));
|
|
931
1129
|
};
|
|
@@ -948,12 +1146,147 @@ var NewTable = function (props) {
|
|
|
948
1146
|
// INFO: true when maxSelectedCount is set and the current selection has reached the limit
|
|
949
1147
|
var isMaxReached = !!props.maxSelectedCount &&
|
|
950
1148
|
((_j = (_h = props.selectedIds) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0) >= props.maxSelectedCount;
|
|
1149
|
+
// INFO: one desktop row. groupAccent carries the group's colour so member
|
|
1150
|
+
// rows show the band's colour as a bar down their left edge.
|
|
1151
|
+
var renderDesktopRow = function (row, index, groupAccent) {
|
|
1152
|
+
var _a, _b, _c, _d, _e;
|
|
1153
|
+
var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
|
|
1154
|
+
var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
|
|
1155
|
+
((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
|
|
1156
|
+
var rowBgClass = isSelected ? selectedRowBg : bgColor;
|
|
1157
|
+
var isRowHoverable = !!props.onClickRow && !isSelected;
|
|
1158
|
+
return (react_2.default.createElement("tr", { key: row.id, onClick: function (e) {
|
|
1159
|
+
if (props.onClickRow) {
|
|
1160
|
+
props.onClickRow(row.id, row, spaceRow);
|
|
1161
|
+
}
|
|
1162
|
+
e.preventDefault();
|
|
1163
|
+
}, className: "group ".concat(isSelected
|
|
1164
|
+
? selectedRowBg
|
|
1165
|
+
: props.onClickRow
|
|
1166
|
+
? "cursor-pointer ".concat(isSelected ? "" : rowHoverBg)
|
|
1167
|
+
: editDataIsLoading && editDataRowId === row.id
|
|
1168
|
+
? "animate-pulse"
|
|
1169
|
+
: "", " ").concat(groupAccent
|
|
1170
|
+
? "border-l-4 ".concat((_e = ACCENT_CLASS[groupAccent]) !== null && _e !== void 0 ? _e : ACCENT_CLASS.default)
|
|
1171
|
+
: "") },
|
|
1172
|
+
props.checkbox && (react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "") : ""), style: hasPinColumns
|
|
1173
|
+
? {
|
|
1174
|
+
position: "sticky",
|
|
1175
|
+
left: 0,
|
|
1176
|
+
zIndex: 1,
|
|
1177
|
+
width: CHECKBOX_WIDTH,
|
|
1178
|
+
minWidth: CHECKBOX_WIDTH,
|
|
1179
|
+
}
|
|
1180
|
+
: undefined, onClick: function (e) { return handleSelectRow(row.id, e); }, onMouseDown: function (e) { return handleDragSelectStart(row.id, e); }, onMouseEnter: function () { return handleDragSelectOver(row.id); } }, renderCheckbox(isSelected, function () { }, undefined, isMaxReached && !isSelected
|
|
1181
|
+
? "opacity-50 cursor-not-allowed"
|
|
1182
|
+
: ""))),
|
|
1183
|
+
flatColumns.map(function (col, colIndex) {
|
|
1184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
1185
|
+
var cellValue = spaceRow
|
|
1186
|
+
? spaceRow[col.key]
|
|
1187
|
+
: resolveValue(row, col.key);
|
|
1188
|
+
// INFO: first col with type "string" is never made editable
|
|
1189
|
+
var resolvedColType = (_a = col.type) !== null && _a !== void 0 ? _a : "string";
|
|
1190
|
+
var isActionColumn = col.key === "update" && !col.type;
|
|
1191
|
+
var isModalEdit = ((_b = props.editable) === null || _b === void 0 ? void 0 : _b.active) &&
|
|
1192
|
+
!isActionColumn &&
|
|
1193
|
+
utils_1.supportedModalEditList.includes(resolvedColType);
|
|
1194
|
+
var isObjectEdit = ((_c = props.editable) === null || _c === void 0 ? void 0 : _c.active) &&
|
|
1195
|
+
!isActionColumn &&
|
|
1196
|
+
resolvedColType === "object" &&
|
|
1197
|
+
!!props.onObjectEdit;
|
|
1198
|
+
var isEditable = ((_d = props.editable) === null || _d === void 0 ? void 0 : _d.active) &&
|
|
1199
|
+
!isActionColumn &&
|
|
1200
|
+
!(((_f = (_e = props.selectedIds) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0 || props.selectAll) &&
|
|
1201
|
+
utils_1.supportedInlineEditList.includes(resolvedColType);
|
|
1202
|
+
var rowData = editDataRowId === row.id ? editDataValue : row;
|
|
1203
|
+
// INFO: a list column with a palette paints the whole cell —
|
|
1204
|
+
// a status column then reads like a heat map instead of a
|
|
1205
|
+
// row of chips. Editable tables open the palette on click.
|
|
1206
|
+
var rawListValue = resolveValue(row, col.key);
|
|
1207
|
+
var fillColour = resolvedColType === "list" && !isActionColumn
|
|
1208
|
+
? handleGetListColour(col, rawListValue)
|
|
1209
|
+
: undefined;
|
|
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))));
|
|
1216
|
+
}
|
|
1217
|
+
if (isObjectEdit) {
|
|
1218
|
+
return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
|
|
1219
|
+
react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
|
|
1220
|
+
var _a;
|
|
1221
|
+
e.stopPropagation();
|
|
1222
|
+
(_a = props.onObjectEdit) === null || _a === void 0 ? void 0 : _a.call(props, row.id, col.key, row);
|
|
1223
|
+
} },
|
|
1224
|
+
handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
|
|
1225
|
+
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" }))));
|
|
1226
|
+
}
|
|
1227
|
+
if (isModalEdit) {
|
|
1228
|
+
return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
|
|
1229
|
+
react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
|
|
1230
|
+
e.stopPropagation();
|
|
1231
|
+
handleModalEditOnClick(row.id, col.key, row);
|
|
1232
|
+
} },
|
|
1233
|
+
handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
|
|
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" }))));
|
|
1235
|
+
}
|
|
1236
|
+
if (isEditable) {
|
|
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);
|
|
1238
|
+
if (!bareOverride)
|
|
1239
|
+
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
1240
|
+
}
|
|
1241
|
+
return (
|
|
1242
|
+
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
1243
|
+
react_2.default.createElement("td", { key: col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
|
|
1244
|
+
? col.key
|
|
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))));
|
|
1246
|
+
}),
|
|
1247
|
+
renderActionColumnCell(row.id)));
|
|
1248
|
+
};
|
|
1249
|
+
// INFO: with groups, each group is a tinted band row (chevron, title, count)
|
|
1250
|
+
// followed by its member rows; collapsing a band hides them. Without groups,
|
|
1251
|
+
// the plain row list.
|
|
1252
|
+
var renderDesktopRows = function () {
|
|
1253
|
+
if (!props.groups || props.groups.length === 0) {
|
|
1254
|
+
return props.data.map(function (row, index) { return renderDesktopRow(row, index); });
|
|
1255
|
+
}
|
|
1256
|
+
var indexById = new Map(props.data.map(function (row, index) { return [row.id, index]; }));
|
|
1257
|
+
var columnCount = flatColumns.length + (props.checkbox ? 1 : 0) + 1;
|
|
1258
|
+
return props.groups.map(function (group) {
|
|
1259
|
+
var _a, _b;
|
|
1260
|
+
var colourKey = (_a = group.colour) !== null && _a !== void 0 ? _a : "none";
|
|
1261
|
+
var isCollapsed = collapsedGroupIds.includes(group.id);
|
|
1262
|
+
var memberIndexes = group.rowIds
|
|
1263
|
+
.map(function (rowId) { return indexById.get(rowId); })
|
|
1264
|
+
.filter(function (rowIndex) { return rowIndex !== undefined; });
|
|
1265
|
+
return (react_2.default.createElement(react_2.default.Fragment, { key: "group-".concat(group.id) },
|
|
1266
|
+
react_2.default.createElement("tr", { "data-testid": "table-group-".concat(group.id), "data-collapsed": isCollapsed ? "true" : "false", className: "border-l-4 ".concat((_b = BAND_CLASS[colourKey]) !== null && _b !== void 0 ? _b : BAND_CLASS.none) },
|
|
1267
|
+
react_2.default.createElement("td", { colSpan: columnCount, className: "px-3 py-2" },
|
|
1268
|
+
react_2.default.createElement("button", { type: "button", className: "flex w-full items-center gap-x-2 text-left text-xs font-semibold uppercase tracking-wide", onClick: function (e) {
|
|
1269
|
+
e.stopPropagation();
|
|
1270
|
+
setCollapsedGroupIds(function (previous) {
|
|
1271
|
+
return previous.includes(group.id)
|
|
1272
|
+
? previous.filter(function (eachId) { return eachId !== group.id; })
|
|
1273
|
+
: __spreadArray(__spreadArray([], previous, true), [group.id], false);
|
|
1274
|
+
});
|
|
1275
|
+
} },
|
|
1276
|
+
isCollapsed ? (react_2.default.createElement(solid_1.ChevronRightIcon, { className: "h-4 w-4" })) : (react_2.default.createElement(solid_1.ChevronDownIcon, { className: "h-4 w-4" })),
|
|
1277
|
+
react_2.default.createElement("span", null, group.title),
|
|
1278
|
+
react_2.default.createElement("span", { className: "rounded-full bg-white/70 px-2 py-0.5 text-[11px] font-medium normal-case tracking-normal" }, memberIndexes.length)))),
|
|
1279
|
+
!isCollapsed &&
|
|
1280
|
+
memberIndexes.map(function (rowIndex) {
|
|
1281
|
+
return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey);
|
|
1282
|
+
})));
|
|
1283
|
+
});
|
|
1284
|
+
};
|
|
951
1285
|
var renderFloatingActionBar = function () {
|
|
952
1286
|
var _a, _b, _c, _d, _e;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
if (visibleBtns.length === 0)
|
|
1287
|
+
var visibleBtns = ((_a = props.multiActionFloatingBtns) !== null && _a !== void 0 ? _a : []).filter(function (btn) { return !btn.hide; });
|
|
1288
|
+
var canCopy = props.enableCopy !== false;
|
|
1289
|
+
if (visibleBtns.length === 0 && !canCopy)
|
|
957
1290
|
return null;
|
|
958
1291
|
var hasSelection = props.selectAll || ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0;
|
|
959
1292
|
if (!hasSelection)
|
|
@@ -972,11 +1305,12 @@ var NewTable = function (props) {
|
|
|
972
1305
|
var renderCloseBtn = function () { return (react_2.default.createElement(iconButton_1.IconButton, { icon: react_2.default.createElement(solid_1.XMarkIcon, { className: "w-4 h-4" }), className: "!p-1 shrink-0 ".concat(props.darkMode
|
|
973
1306
|
? "hover:bg-gray-700 text-gray-400 hover:text-gray-200"
|
|
974
1307
|
: "hover:bg-gray-100 text-gray-400 hover:text-gray-600"), onClick: function () { return handleSelectAllPages(false); } })); };
|
|
975
|
-
var
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1308
|
+
var actionBtnClassName = "px-2 py-1 text-xs sm:text-sm whitespace-nowrap ".concat(props.darkMode ? "!text-gray-300 hover:!text-primary-300" : "!text-gray-600 hover:!text-primary-600");
|
|
1309
|
+
var renderActionBtns = function () { return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
1310
|
+
visibleBtns.map(function (btn) { return (react_2.default.createElement(textButton_1.TextButton, { key: btn.id, text: btn.btnText, className: actionBtnClassName, onClick: function () { return btn.onClick(btn.id); } })); }),
|
|
1311
|
+
canCopy && (react_2.default.createElement(textButton_1.TextButton, { key: "copy", id: "dtw-copy-selection", text: copiedCount > 0 ? "Copied ".concat(copiedCount) : "Copy", className: actionBtnClassName, onClick: function () {
|
|
1312
|
+
handleCopySelection();
|
|
1313
|
+
} })))); };
|
|
980
1314
|
var pillBase = "shadow-xl ".concat(borderRadius, " ").concat(bgColor, " border-2 ").concat(props.darkMode ? "border-primary-300" : "border-primary-500");
|
|
981
1315
|
return (react_2.default.createElement("div", { className: "fixed ".concat(props.multiActionFloatingOffset || "bottom-10", " inset-x-4 z-10 flex justify-center pointer-events-none") },
|
|
982
1316
|
react_2.default.createElement("div", { className: "sm:hidden flex flex-col w-full px-4 py-2.5 pointer-events-auto ".concat(pillBase) },
|
|
@@ -1100,73 +1434,6 @@ var NewTable = function (props) {
|
|
|
1100
1434
|
});
|
|
1101
1435
|
}))));
|
|
1102
1436
|
};
|
|
1103
|
-
var renderPageNumber = function (type) {
|
|
1104
|
-
var _a, _b, _c, _d;
|
|
1105
|
-
var pageNumberList = [];
|
|
1106
|
-
var selectedBorderColor = props.darkMode
|
|
1107
|
-
? "border-primary-200"
|
|
1108
|
-
: "border-primary-500";
|
|
1109
|
-
var selectedFontColor = props.darkMode
|
|
1110
|
-
? "text-primary-200"
|
|
1111
|
-
: "text-primary-500";
|
|
1112
|
-
var basePageNumberClassname = "px-3 flex items-center h-full w-full text-sm font-medium cursor-pointer ";
|
|
1113
|
-
if (type === "page") {
|
|
1114
|
-
var pageOffset = Math.floor(((_a = props.pageIndex) !== null && _a !== void 0 ? _a : 0) / defaultPageSize);
|
|
1115
|
-
var _loop_1 = function (i) {
|
|
1116
|
-
var pageNumberClassName = basePageNumberClassname +
|
|
1117
|
-
(props.pageIndex === i
|
|
1118
|
-
? "border rounded-xl ".concat(selectedBorderColor, " ").concat(selectedFontColor, " ").concat(bgColor)
|
|
1119
|
-
: "".concat(cellFontColor));
|
|
1120
|
-
pageNumberList.push(react_2.default.createElement("div", { key: i, "aria-current": "page", className: pageNumberClassName, onClick: props.pageIndex !== i
|
|
1121
|
-
? function () { var _a; return (_a = props.handleUpdatePageIndex) === null || _a === void 0 ? void 0 : _a.call(props, i); }
|
|
1122
|
-
: function () { } }, i + 1));
|
|
1123
|
-
};
|
|
1124
|
-
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) &&
|
|
1125
|
-
i < pageOffset * defaultPageSize + defaultPageSize; i++) {
|
|
1126
|
-
_loop_1(i);
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
else if (type === "cursor") {
|
|
1130
|
-
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));
|
|
1131
|
-
}
|
|
1132
|
-
return pageNumberList;
|
|
1133
|
-
};
|
|
1134
|
-
var renderPagination = function () {
|
|
1135
|
-
var _a, _b, _c;
|
|
1136
|
-
var nextDataAvailable = ((_a = props.size) !== null && _a !== void 0 ? _a : 0) >
|
|
1137
|
-
(((_b = props.pageIndex) !== null && _b !== void 0 ? _b : 0) + 1) * ((_c = props.limit) !== null && _c !== void 0 ? _c : defaultLimit) ||
|
|
1138
|
-
props.cursor;
|
|
1139
|
-
switch (props.paginationType) {
|
|
1140
|
-
case "cursor":
|
|
1141
|
-
return (react_2.default.createElement("div", { className: "h-8 flex items-center justify-center gap-x-0.5", "aria-label": "Pagination" },
|
|
1142
|
-
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"); } },
|
|
1143
|
-
react_2.default.createElement(solid_1.ChevronLeftIcon, { className: "h-4 w-4", "aria-hidden": "true" })),
|
|
1144
|
-
renderPageNumber("cursor"),
|
|
1145
|
-
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"); } },
|
|
1146
|
-
react_2.default.createElement(solid_1.ChevronRightIcon, { className: "h-4 w-4", "aria-hidden": "true" }))));
|
|
1147
|
-
case "page":
|
|
1148
|
-
var disablePrev = props.pageIndex === 0 ? true : false;
|
|
1149
|
-
return (react_2.default.createElement("div", { className: "h-8 flex items-center justify-center gap-x-0.5", "aria-label": "Pagination" },
|
|
1150
|
-
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); } },
|
|
1151
|
-
react_2.default.createElement(solid_1.ChevronLeftIcon, { className: "h-4 w-4", "aria-hidden": "true" })),
|
|
1152
|
-
renderPageNumber("page"),
|
|
1153
|
-
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); } },
|
|
1154
|
-
react_2.default.createElement(solid_1.ChevronRightIcon, { className: "h-4 w-4", "aria-hidden": "true" }))));
|
|
1155
|
-
default:
|
|
1156
|
-
return react_2.default.createElement(react_2.default.Fragment, null);
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
|
-
var renderPageResult = function () {
|
|
1160
|
-
var _a, _b;
|
|
1161
|
-
var text = "";
|
|
1162
|
-
if (props.paginationType === "page") {
|
|
1163
|
-
text = "Showing ".concat((_a = props.customPaginationSize) !== null && _a !== void 0 ? _a : props.size, " result(s)");
|
|
1164
|
-
}
|
|
1165
|
-
else {
|
|
1166
|
-
text = "Showing ".concat((_b = props.customPaginationSize) !== null && _b !== void 0 ? _b : props.data.length, " result(s)");
|
|
1167
|
-
}
|
|
1168
|
-
return react_2.default.createElement("p", { className: "text-xs ".concat(cellFontColor) }, text);
|
|
1169
|
-
};
|
|
1170
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 : "") })); };
|
|
1171
1438
|
if (props.mobileView) {
|
|
1172
1439
|
var isIdLike_1 = function (c) {
|
|
@@ -1175,7 +1442,9 @@ var NewTable = function (props) {
|
|
|
1175
1442
|
var titleCol_1 = (_k = flatColumns.find(function (c) { return !isIdLike_1(c); })) !== null && _k !== void 0 ? _k : flatColumns[0];
|
|
1176
1443
|
var expandHeaderBg_1 = props.darkMode ? "bg-gray-700" : "bg-gray-100";
|
|
1177
1444
|
var expandHeaderFontColor_1 = props.darkMode ? "text-white" : "";
|
|
1178
|
-
var headerBgColor_1 = props.darkMode
|
|
1445
|
+
var headerBgColor_1 = props.darkMode
|
|
1446
|
+
? ((_l = props.darkModeBg) !== null && _l !== void 0 ? _l : "bg-gray-900")
|
|
1447
|
+
: "";
|
|
1179
1448
|
var headerFontColor_1 = props.darkMode ? "text-white" : "";
|
|
1180
1449
|
// INFO: renders tag + trailing text adjacent to the Collapse title
|
|
1181
1450
|
var renderMobileTitleAdjacent_1 = function (row, spaceRow) {
|
|
@@ -1244,14 +1513,14 @@ var NewTable = function (props) {
|
|
|
1244
1513
|
})))));
|
|
1245
1514
|
};
|
|
1246
1515
|
return (react_2.default.createElement("div", null,
|
|
1247
|
-
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 : "") },
|
|
1248
1517
|
react_2.default.createElement("div", { className: "p-3 flex justify-between" },
|
|
1249
1518
|
renderSelectAll(),
|
|
1250
1519
|
renderSelectedCount()),
|
|
1251
1520
|
props.loading &&
|
|
1252
1521
|
Array.from({ length: 3 }).map(function (_, i) { return (react_2.default.createElement("div", { key: "skeleton-".concat(i), className: "p-4" },
|
|
1253
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") }))); }),
|
|
1254
|
-
!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")),
|
|
1255
1524
|
!props.loading &&
|
|
1256
1525
|
props.data.map(function (row, index) {
|
|
1257
1526
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1297,22 +1566,18 @@ var NewTable = function (props) {
|
|
|
1297
1566
|
((_g = props.mobileTooltip) === null || _g === void 0 ? void 0 : _g.tooltip) &&
|
|
1298
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)))));
|
|
1299
1568
|
})),
|
|
1300
|
-
|
|
1301
|
-
? "pagination-container w-full sm:px-6 ".concat(borderColor, " ").concat(isFixed
|
|
1302
|
-
|
|
1303
|
-
: "sticky top-0 left-0")
|
|
1304
|
-
: "") },
|
|
1305
|
-
renderPageResult(),
|
|
1306
|
-
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
|
+
: "") }),
|
|
1307
1572
|
renderFloatingActionBar()));
|
|
1308
1573
|
}
|
|
1309
|
-
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 : "") },
|
|
1310
1575
|
react_2.default.createElement(modal_1.Modal, { open: filterModal ? true : false, title: "Filter Options", renderContent: function () {
|
|
1311
1576
|
var _a, _b;
|
|
1312
1577
|
return (react_2.default.createElement("div", { className: "pb-44" },
|
|
1313
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))));
|
|
1314
1579
|
}, onClose: function () { return setFilterModal(""); } }),
|
|
1315
|
-
react_2.default.createElement(modal_1.Modal, { open: modalEditVisible, title: (
|
|
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 () {
|
|
1316
1581
|
var _a, _b, _c, _d;
|
|
1317
1582
|
var selectedCol = flatColumns.find(function (eachCol) { return eachCol.key === editDataHeaderKey; });
|
|
1318
1583
|
if (!selectedCol)
|
|
@@ -1352,14 +1617,14 @@ var NewTable = function (props) {
|
|
|
1352
1617
|
var _a, _b;
|
|
1353
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); })));
|
|
1354
1619
|
}, onClose: function () { return handleAddColumnModal(""); } }),
|
|
1355
|
-
react_2.default.createElement(
|
|
1356
|
-
(props.selectAll || ((
|
|
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" },
|
|
1621
|
+
(props.selectAll || ((_u = (_t = props.selectedIds) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) > 0) &&
|
|
1357
1622
|
(!props.multiActionFloatingBtns ||
|
|
1358
1623
|
(props.multiActionFloatingBtns &&
|
|
1359
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" },
|
|
1360
1625
|
renderSelectedCount(),
|
|
1361
1626
|
props.multiActionButton)),
|
|
1362
|
-
react_2.default.createElement("table", { className: "w-full", ref: tableRef },
|
|
1627
|
+
react_2.default.createElement("table", { className: "w-full ".concat(isDragSelecting ? "select-none" : ""), ref: tableRef },
|
|
1363
1628
|
renderTableHeader(),
|
|
1364
1629
|
react_2.default.createElement("tbody", { className: "divide-y ".concat(dividerColor) },
|
|
1365
1630
|
props.loading &&
|
|
@@ -1367,101 +1632,13 @@ var NewTable = function (props) {
|
|
|
1367
1632
|
props.checkbox && react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding) }),
|
|
1368
1633
|
flatColumns.map(function (col) { return (react_2.default.createElement("td", { key: col.key, className: cellPadding },
|
|
1369
1634
|
react_2.default.createElement("div", { className: "h-5 rounded-md animate-pulse ".concat(props.darkMode ? "bg-gray-700" : "bg-gray-200") }))); }))); }),
|
|
1370
|
-
!props.loading &&
|
|
1371
|
-
props.data.map(function (row, index) {
|
|
1372
|
-
var _a, _b, _c, _d;
|
|
1373
|
-
var spaceRow = (_a = props.spaceData) === null || _a === void 0 ? void 0 : _a[index];
|
|
1374
|
-
var isSelected = ((_c = (_b = props.selectedIds) === null || _b === void 0 ? void 0 : _b.includes(row.id)) !== null && _c !== void 0 ? _c : false) ||
|
|
1375
|
-
((_d = props.selectAll) !== null && _d !== void 0 ? _d : false);
|
|
1376
|
-
var rowBgClass = isSelected ? selectedRowBg : bgColor;
|
|
1377
|
-
var isRowHoverable = !!props.onClickRow && !isSelected;
|
|
1378
|
-
return (react_2.default.createElement("tr", { key: row.id, onClick: function (e) {
|
|
1379
|
-
if (props.onClickRow) {
|
|
1380
|
-
props.onClickRow(row.id, row, spaceRow);
|
|
1381
|
-
}
|
|
1382
|
-
e.preventDefault();
|
|
1383
|
-
}, className: "group ".concat(isSelected
|
|
1384
|
-
? selectedRowBg
|
|
1385
|
-
: props.onClickRow
|
|
1386
|
-
? "cursor-pointer ".concat(rowHoverBg)
|
|
1387
|
-
: editDataIsLoading && editDataRowId === row.id
|
|
1388
|
-
? "animate-pulse"
|
|
1389
|
-
: "") },
|
|
1390
|
-
props.checkbox && (react_2.default.createElement("td", { className: "w-10 ".concat(cellPadding, " ").concat(hasPinColumns ? "".concat(rowBgClass, " ").concat(isRowHoverable ? (props.darkMode ? "group-hover:bg-gray-700" : "group-hover:bg-gray-100") : "") : ""), style: hasPinColumns
|
|
1391
|
-
? {
|
|
1392
|
-
position: "sticky",
|
|
1393
|
-
left: 0,
|
|
1394
|
-
zIndex: 1,
|
|
1395
|
-
width: CHECKBOX_WIDTH,
|
|
1396
|
-
minWidth: CHECKBOX_WIDTH,
|
|
1397
|
-
}
|
|
1398
|
-
: undefined, onClick: function (e) { return handleSelectRow(row.id, e); } }, renderCheckbox(isSelected, function () { }, undefined, isMaxReached && !isSelected
|
|
1399
|
-
? "opacity-50 cursor-not-allowed"
|
|
1400
|
-
: ""))),
|
|
1401
|
-
flatColumns.map(function (col, colIndex) {
|
|
1402
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1403
|
-
var cellValue = spaceRow
|
|
1404
|
-
? spaceRow[col.key]
|
|
1405
|
-
: resolveValue(row, col.key);
|
|
1406
|
-
// INFO: first col with type "string" is never made editable
|
|
1407
|
-
var resolvedColType = (_a = col.type) !== null && _a !== void 0 ? _a : "string";
|
|
1408
|
-
var isActionColumn = col.key === "update" && !col.type;
|
|
1409
|
-
var isModalEdit = ((_b = props.editable) === null || _b === void 0 ? void 0 : _b.active) &&
|
|
1410
|
-
!isActionColumn &&
|
|
1411
|
-
utils_1.supportedModalEditList.includes(resolvedColType);
|
|
1412
|
-
var isObjectEdit = ((_c = props.editable) === null || _c === void 0 ? void 0 : _c.active) &&
|
|
1413
|
-
!isActionColumn &&
|
|
1414
|
-
resolvedColType === "object" &&
|
|
1415
|
-
!!props.onObjectEdit;
|
|
1416
|
-
var isEditable = ((_d = props.editable) === null || _d === void 0 ? void 0 : _d.active) &&
|
|
1417
|
-
!isActionColumn &&
|
|
1418
|
-
!(((_f = (_e = props.selectedIds) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0 ||
|
|
1419
|
-
props.selectAll) &&
|
|
1420
|
-
utils_1.supportedInlineEditList.includes(resolvedColType);
|
|
1421
|
-
var rowData = editDataRowId === row.id ? editDataValue : row;
|
|
1422
|
-
if (isObjectEdit) {
|
|
1423
|
-
return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
|
|
1424
|
-
react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-object-edit-".concat(col.key), onClick: function (e) {
|
|
1425
|
-
var _a;
|
|
1426
|
-
e.stopPropagation();
|
|
1427
|
-
(_a = props.onObjectEdit) === null || _a === void 0 ? void 0 : _a.call(props, row.id, col.key, row);
|
|
1428
|
-
} },
|
|
1429
|
-
handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
|
|
1430
|
-
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" }))));
|
|
1431
|
-
}
|
|
1432
|
-
if (isModalEdit) {
|
|
1433
|
-
return (react_2.default.createElement("td", { key: col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap") },
|
|
1434
|
-
react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6", "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
|
|
1435
|
-
e.stopPropagation();
|
|
1436
|
-
handleModalEditOnClick(row.id, col.key, row);
|
|
1437
|
-
} },
|
|
1438
|
-
handleCheckModalEditEmpty(cellValue) ? (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add")) : ((0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord)),
|
|
1439
|
-
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" }))));
|
|
1440
|
-
}
|
|
1441
|
-
if (isEditable) {
|
|
1442
|
-
var bareOverride = (_h = (_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareListDescription) === null || _h === void 0 ? void 0 : _h.call(_g, col.key, cellValue);
|
|
1443
|
-
if (!bareOverride)
|
|
1444
|
-
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
1445
|
-
}
|
|
1446
|
-
return (
|
|
1447
|
-
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
1448
|
-
react_2.default.createElement("td", { key: col.key, "data-pin-key": leftPinned.includes(col.key) ||
|
|
1449
|
-
rightPinned.includes(col.key)
|
|
1450
|
-
? col.key
|
|
1451
|
-
: 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((_k = (_j = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _j === void 0 ? void 0 : _j.className) !== null && _k !== void 0 ? _k : ""), style: (_l = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _l === void 0 ? void 0 : _l.style }, props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl +
|
|
1452
|
-
row.id +
|
|
1453
|
-
((_m = props.addNewTabUrl) !== null && _m !== void 0 ? _m : ""), 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))));
|
|
1454
|
-
}),
|
|
1455
|
-
renderActionColumnCell(row.id)));
|
|
1456
|
-
}),
|
|
1635
|
+
!props.loading && renderDesktopRows(),
|
|
1457
1636
|
!props.loading && addData && renderAddDataRow())),
|
|
1458
|
-
!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")),
|
|
1459
1638
|
renderAddableSection()),
|
|
1460
|
-
|
|
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
|
|
1461
1640
|
? "pagination-container w-full ".concat(borderColor, " ").concat(isFixed ? "fixed bottom-0 left-0 z-10" : "sticky top-0 left-0")
|
|
1462
|
-
: "") },
|
|
1463
|
-
renderPageResult(),
|
|
1464
|
-
renderPagination())),
|
|
1641
|
+
: "") }),
|
|
1465
1642
|
renderFloatingActionBar()));
|
|
1466
1643
|
};
|
|
1467
1644
|
exports.NewTable = NewTable;
|