blixify-ui-web 1.2.197 → 1.2.199
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/data/columnTypes/buttonCell.d.ts +17 -0
- package/lib/components/data/columnTypes/buttonCell.d.ts.map +1 -0
- package/lib/components/data/columnTypes/buttonCell.js +160 -0
- package/lib/components/data/columnTypes/buttonCell.js.map +1 -0
- package/lib/components/data/columnTypes/context.d.ts +13 -0
- package/lib/components/data/columnTypes/context.d.ts.map +1 -0
- package/lib/components/data/columnTypes/context.js +8 -0
- package/lib/components/data/columnTypes/context.js.map +1 -0
- package/lib/components/data/columnTypes/dateRange.d.ts +24 -0
- package/lib/components/data/columnTypes/dateRange.d.ts.map +1 -0
- package/lib/components/data/columnTypes/dateRange.js +75 -0
- package/lib/components/data/columnTypes/dateRange.js.map +1 -0
- package/lib/components/data/columnTypes/dateRangeCell.d.ts +20 -0
- package/lib/components/data/columnTypes/dateRangeCell.d.ts.map +1 -0
- package/lib/components/data/columnTypes/dateRangeCell.js +210 -0
- package/lib/components/data/columnTypes/dateRangeCell.js.map +1 -0
- package/lib/components/data/columnTypes/groupSections.d.ts +56 -0
- package/lib/components/data/columnTypes/groupSections.d.ts.map +1 -0
- package/lib/components/data/columnTypes/groupSections.js +170 -0
- package/lib/components/data/columnTypes/groupSections.js.map +1 -0
- package/lib/components/data/columnTypes/index.d.ts +15 -0
- package/lib/components/data/columnTypes/index.d.ts.map +1 -0
- package/lib/components/data/columnTypes/index.js +31 -0
- package/lib/components/data/columnTypes/index.js.map +1 -0
- package/lib/components/data/columnTypes/ratingCell.d.ts +29 -0
- package/lib/components/data/columnTypes/ratingCell.d.ts.map +1 -0
- package/lib/components/data/columnTypes/ratingCell.js +176 -0
- package/lib/components/data/columnTypes/ratingCell.js.map +1 -0
- package/lib/components/data/columnTypes/systemColumns.d.ts +27 -0
- package/lib/components/data/columnTypes/systemColumns.d.ts.map +1 -0
- package/lib/components/data/columnTypes/systemColumns.js +118 -0
- package/lib/components/data/columnTypes/systemColumns.js.map +1 -0
- package/lib/components/data/columnTypes/timeTracking.d.ts +27 -0
- package/lib/components/data/columnTypes/timeTracking.d.ts.map +1 -0
- package/lib/components/data/columnTypes/timeTracking.js +127 -0
- package/lib/components/data/columnTypes/timeTracking.js.map +1 -0
- package/lib/components/data/columnTypes/timeTrackingCell.d.ts +17 -0
- package/lib/components/data/columnTypes/timeTrackingCell.d.ts.map +1 -0
- package/lib/components/data/columnTypes/timeTrackingCell.js +146 -0
- package/lib/components/data/columnTypes/timeTrackingCell.js.map +1 -0
- package/lib/components/data/dataTemplate/activityChanges.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/activityChanges.js +7 -0
- package/lib/components/data/dataTemplate/activityChanges.js.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.d.ts +6 -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 +519 -332
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +26 -2
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/settingsModal.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/settingsModal.js +13 -6
- package/lib/components/data/dataTemplate/settingsModal.js.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +1 -0
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js +18 -3
- package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
- package/lib/components/data/flexFilter/index.d.ts.map +1 -1
- package/lib/components/data/flexFilter/index.js +17 -1
- package/lib/components/data/flexFilter/index.js.map +1 -1
- package/lib/components/data/formula/builder.d.ts.map +1 -1
- package/lib/components/data/formula/builder.js +30 -10
- package/lib/components/data/formula/builder.js.map +1 -1
- package/lib/components/data/formula/functions.d.ts +3 -0
- package/lib/components/data/formula/functions.d.ts.map +1 -1
- package/lib/components/data/formula/functions.js +269 -1
- package/lib/components/data/formula/functions.js.map +1 -1
- package/lib/components/data/formula/index.d.ts +8 -0
- package/lib/components/data/formula/index.d.ts.map +1 -1
- package/lib/components/data/formula/index.js +80 -13
- package/lib/components/data/formula/index.js.map +1 -1
- package/lib/components/data/listModule.d.ts +2 -0
- package/lib/components/data/listModule.d.ts.map +1 -1
- package/lib/components/data/listModule.js +109 -53
- package/lib/components/data/listModule.js.map +1 -1
- package/lib/components/data/readModule.d.ts.map +1 -1
- package/lib/components/data/readModule.js +105 -74
- package/lib/components/data/readModule.js.map +1 -1
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +78 -28
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/data/utils.d.ts +1 -0
- package/lib/components/data/utils.d.ts.map +1 -1
- package/lib/components/data/utils.js +32 -12
- package/lib/components/data/utils.js.map +1 -1
- package/lib/components/display/newTable/index.d.ts +9 -0
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +362 -109
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/tail.css +2 -2
- package/package.json +1 -1
|
@@ -82,7 +82,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
82
82
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
83
|
};
|
|
84
84
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
-
exports.NewTable = exports.handleGetEditableColumnTypes = void 0;
|
|
85
|
+
exports.NewTable = exports.handleGetEditableColumnTypes = exports.handleWriteColumnOptions = exports.handleReadColumnOptions = exports.NEW_TABLE_GROUP_ROW_BATCH = void 0;
|
|
86
86
|
var react_1 = require("@headlessui/react");
|
|
87
87
|
var solid_1 = require("@heroicons/react/20/solid");
|
|
88
88
|
var outline_1 = require("@heroicons/react/24/outline");
|
|
@@ -95,6 +95,10 @@ var textButton_1 = require("../../action/textButton");
|
|
|
95
95
|
var collapse_1 = require("../../advanced/collapse");
|
|
96
96
|
var popUp_1 = require("../../advanced/popUp");
|
|
97
97
|
var formula_1 = require("../../data/formula");
|
|
98
|
+
var buttonCell_1 = require("../../data/columnTypes/buttonCell");
|
|
99
|
+
var context_1 = require("../../data/columnTypes/context");
|
|
100
|
+
var dateRangeCell_1 = require("../../data/columnTypes/dateRangeCell");
|
|
101
|
+
var systemColumns_1 = require("../../data/columnTypes/systemColumns");
|
|
98
102
|
var builder_1 = require("../../data/formula/builder");
|
|
99
103
|
var readModule_1 = require("../../data/readModule");
|
|
100
104
|
var updateModule_1 = require("../../data/updateModule");
|
|
@@ -109,6 +113,9 @@ var modal_1 = require("../modal");
|
|
|
109
113
|
var newPagination_1 = require("../newPagination");
|
|
110
114
|
var scrollShadow_1 = require("../scrollShadow");
|
|
111
115
|
var tag_1 = require("../tag");
|
|
116
|
+
// INFO: rows a section draws before its "Show more" — a 2,000-row section
|
|
117
|
+
// would otherwise mount every row (and every cell's controls) at once
|
|
118
|
+
exports.NEW_TABLE_GROUP_ROW_BATCH = 50;
|
|
112
119
|
// INFO: resolve dotted key paths (e.g. "group.subKey") against a row object.
|
|
113
120
|
// Required because flatColumns uses "parent.child" keys for groupData sub-columns.
|
|
114
121
|
var resolveValue = function (row, key) {
|
|
@@ -174,7 +181,7 @@ var MIN_COLUMN_WIDTH = 80;
|
|
|
174
181
|
// INFO: every field type the popup can finish. math has its own expression
|
|
175
182
|
// builder, and object/listObject need a nested schema the schema editor builds —
|
|
176
183
|
// creating either here would only ever produce a dead column.
|
|
177
|
-
var
|
|
184
|
+
var ALL_COLUMN_TYPES = [
|
|
178
185
|
{ key: "string", label: "Text" },
|
|
179
186
|
{ key: "textArea", label: "Long text" },
|
|
180
187
|
{ key: "markdown", label: "Markdown" },
|
|
@@ -203,8 +210,20 @@ var ADD_COLUMN_TYPES = [
|
|
|
203
210
|
{ key: "listReference", label: "Reference list" },
|
|
204
211
|
{ key: "referenceSelection", label: "Reference selection" },
|
|
205
212
|
{ key: "ganttchart", label: "Gantt chart" },
|
|
213
|
+
{ key: "dateRange", label: "Timeline" },
|
|
214
|
+
{ key: "timeTracking", label: "Time tracking" },
|
|
215
|
+
{ key: "button", label: "Button" },
|
|
206
216
|
];
|
|
217
|
+
// INFO: never drawn as a table cell, so a column of these added from the
|
|
218
|
+
// table would be invisible the moment it was made; one that exists can still
|
|
219
|
+
// be renamed
|
|
220
|
+
var NON_ADDABLE_COLUMN_TYPES = ["listAddress", "ganttchart", "canvas"];
|
|
221
|
+
var ADD_COLUMN_TYPES = ALL_COLUMN_TYPES.filter(function (eachType) { return !NON_ADDABLE_COLUMN_TYPES.includes(eachType.key); });
|
|
207
222
|
var REFERENCE_TYPES = ["reference", "listReference", "referenceSelection"];
|
|
223
|
+
var BUTTON_COLOUR_OPTIONS = buttonCell_1.BUTTON_COLOURS.map(function (eachColour) { return ({
|
|
224
|
+
key: eachColour,
|
|
225
|
+
label: eachColour.charAt(0).toUpperCase() + eachColour.slice(1),
|
|
226
|
+
}); });
|
|
208
227
|
var LIST_TYPES = ["list", "multipleList"];
|
|
209
228
|
// INFO: asset columns need a storage path, which the consumer fills in from its
|
|
210
229
|
// own settings — nothing for the user to type
|
|
@@ -239,14 +258,75 @@ var REFERENCE_TARGET_KEYS = [
|
|
|
239
258
|
"referenceSort",
|
|
240
259
|
"referenceDependency",
|
|
241
260
|
];
|
|
242
|
-
|
|
243
|
-
var
|
|
244
|
-
|
|
245
|
-
return
|
|
246
|
-
.split(",")
|
|
247
|
-
.map(function (eachOption) { return eachOption.trim(); })
|
|
248
|
-
.filter(Boolean);
|
|
261
|
+
var columnOptionKey = 0;
|
|
262
|
+
var handleNextOptionKey = function () {
|
|
263
|
+
columnOptionKey += 1;
|
|
264
|
+
return columnOptionKey;
|
|
249
265
|
};
|
|
266
|
+
var OPTION_COLOURS = [
|
|
267
|
+
"primary",
|
|
268
|
+
"red",
|
|
269
|
+
"blue",
|
|
270
|
+
"green",
|
|
271
|
+
"yellow",
|
|
272
|
+
"indigo",
|
|
273
|
+
"purple",
|
|
274
|
+
"lime",
|
|
275
|
+
"sky",
|
|
276
|
+
"pink",
|
|
277
|
+
"orange",
|
|
278
|
+
"dark",
|
|
279
|
+
];
|
|
280
|
+
// INFO: literal classes so Tailwind emits them
|
|
281
|
+
var OPTION_SWATCH_CLASS = {
|
|
282
|
+
"": "bg-white border-gray-300",
|
|
283
|
+
primary: "bg-primary-500 border-primary-500",
|
|
284
|
+
red: "bg-red-500 border-red-500",
|
|
285
|
+
blue: "bg-blue-500 border-blue-500",
|
|
286
|
+
green: "bg-green-500 border-green-500",
|
|
287
|
+
yellow: "bg-yellow-500 border-yellow-500",
|
|
288
|
+
indigo: "bg-indigo-500 border-indigo-500",
|
|
289
|
+
purple: "bg-purple-500 border-purple-500",
|
|
290
|
+
lime: "bg-lime-500 border-lime-500",
|
|
291
|
+
sky: "bg-sky-500 border-sky-500",
|
|
292
|
+
pink: "bg-pink-500 border-pink-500",
|
|
293
|
+
orange: "bg-orange-500 border-orange-500",
|
|
294
|
+
dark: "bg-gray-900 border-gray-900",
|
|
295
|
+
};
|
|
296
|
+
var handleReadColumnOptions = function (column) {
|
|
297
|
+
var _a;
|
|
298
|
+
return ((_a = column === null || column === void 0 ? void 0 : column.listSelection) !== null && _a !== void 0 ? _a : []).map(function (eachOption, index) {
|
|
299
|
+
var _a, _b, _c;
|
|
300
|
+
return ({
|
|
301
|
+
key: handleNextOptionKey(),
|
|
302
|
+
text: eachOption,
|
|
303
|
+
colour: (_b = (_a = column === null || column === void 0 ? void 0 : column.listSelectionColour) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : "",
|
|
304
|
+
label: ((_c = column === null || column === void 0 ? void 0 : column.listSelectionLabel) === null || _c === void 0 ? void 0 : _c[index]) || undefined,
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
exports.handleReadColumnOptions = handleReadColumnOptions;
|
|
309
|
+
// INFO: options, colours and labels saved side by side, index for index; a
|
|
310
|
+
// column with no colour or label set carries no list of them
|
|
311
|
+
var handleWriteColumnOptions = function (column, rows) {
|
|
312
|
+
// INFO: a row left blank is not an option
|
|
313
|
+
var options = rows
|
|
314
|
+
.map(function (eachOption) { return (__assign(__assign({}, eachOption), { text: eachOption.text.trim() })); })
|
|
315
|
+
.filter(function (eachOption) { return eachOption.text; });
|
|
316
|
+
column.listSelection = options.map(function (eachOption) { return eachOption.text; });
|
|
317
|
+
var colours = options.map(function (eachOption) { var _a; return (_a = eachOption.colour) !== null && _a !== void 0 ? _a : ""; });
|
|
318
|
+
if (colours.some(Boolean))
|
|
319
|
+
column.listSelectionColour = colours;
|
|
320
|
+
else
|
|
321
|
+
delete column.listSelectionColour;
|
|
322
|
+
var labels = options.map(function (eachOption) { var _a; return (_a = eachOption.label) !== null && _a !== void 0 ? _a : ""; });
|
|
323
|
+
if (labels.some(Boolean))
|
|
324
|
+
column.listSelectionLabel = labels;
|
|
325
|
+
else
|
|
326
|
+
delete column.listSelectionLabel;
|
|
327
|
+
return column;
|
|
328
|
+
};
|
|
329
|
+
exports.handleWriteColumnOptions = handleWriteColumnOptions;
|
|
250
330
|
// INFO: the column's own type first, then those it may become
|
|
251
331
|
var handleGetEditableColumnTypes = function (type) {
|
|
252
332
|
var _a;
|
|
@@ -371,29 +451,41 @@ var NewTable = function (props) {
|
|
|
371
451
|
//=====================================================================================
|
|
372
452
|
var _4 = (0, react_2.useState)(""), filterModal = _4[0], setFilterModal = _4[1];
|
|
373
453
|
var _5 = (0, react_2.useState)(""), addColumnModal = _5[0], setAddColumnModal = _5[1];
|
|
454
|
+
// INFO: what a DataTemplate around the table lets a cell save
|
|
455
|
+
var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
|
|
374
456
|
var _6 = (0, react_2.useState)(""), newColumnName = _6[0], setNewColumnName = _6[1];
|
|
375
457
|
var _7 = (0, react_2.useState)("string"), newColumnType = _7[0], setNewColumnType = _7[1];
|
|
376
458
|
var _8 = (0, react_2.useState)(""), newColumnRefSpace = _8[0], setNewColumnRefSpace = _8[1];
|
|
377
459
|
var _9 = (0, react_2.useState)(""), newColumnRefLabel = _9[0], setNewColumnRefLabel = _9[1];
|
|
378
|
-
var _10 = (0, react_2.useState)(
|
|
379
|
-
|
|
380
|
-
var
|
|
460
|
+
var _10 = (0, react_2.useState)([]), newColumnOptions = _10[0], setNewColumnOptions = _10[1];
|
|
461
|
+
// INFO: the option row whose colour palette is open
|
|
462
|
+
var _11 = (0, react_2.useState)(null), optionColourKey = _11[0], setOptionColourKey = _11[1];
|
|
463
|
+
var _12 = (0, react_2.useState)(false), newColumnRequired = _12[0], setNewColumnRequired = _12[1];
|
|
464
|
+
var _13 = (0, react_2.useState)(""), newColumnRatingMax = _13[0], setNewColumnRatingMax = _13[1];
|
|
465
|
+
var _14 = (0, react_2.useState)(""), newColumnButtonLabel = _14[0], setNewColumnButtonLabel = _14[1];
|
|
466
|
+
var _15 = (0, react_2.useState)(""), newColumnButtonColour = _15[0], setNewColumnButtonColour = _15[1];
|
|
467
|
+
var _16 = (0, react_2.useState)(""), newColumnButtonConfirm = _16[0], setNewColumnButtonConfirm = _16[1];
|
|
468
|
+
var _17 = (0, react_2.useState)(false), addingColumn = _17[0], setAddingColumn = _17[1];
|
|
381
469
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
382
|
-
var
|
|
470
|
+
var _18 = (0, react_2.useState)(""), newColumnFormula = _18[0], setNewColumnFormula = _18[1];
|
|
383
471
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
384
472
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
385
|
-
var
|
|
473
|
+
var _19 = (0, react_2.useState)(null), editingColumn = _19[0], setEditingColumn = _19[1];
|
|
386
474
|
//=====================================================================================
|
|
387
475
|
// SECTION: Editable & Addable cells
|
|
388
476
|
//=====================================================================================
|
|
389
|
-
var
|
|
390
|
-
var
|
|
477
|
+
var _20 = (0, react_2.useState)(""), editDataRowId = _20[0], setEditDataRowId = _20[1];
|
|
478
|
+
var _21 = (0, react_2.useState)(""), editDataHeaderKey = _21[0], setEditDataHeaderKey = _21[1];
|
|
391
479
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
392
480
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
393
481
|
// becomes its input now.
|
|
394
|
-
var
|
|
395
|
-
var
|
|
396
|
-
|
|
482
|
+
var _22 = (0, react_2.useState)(null), hoveredCell = _22[0], setHoveredCell = _22[1];
|
|
483
|
+
var _23 = (0, react_2.useState)(false), modalEditVisible = _23[0], setModalEditVisible = _23[1];
|
|
484
|
+
// INFO: whether the modal's signature pad has been drawn on
|
|
485
|
+
var _24 = (0, react_2.useState)(false), signatureSigning = _24[0], setSignatureSigning = _24[1];
|
|
486
|
+
var _25 = (0, react_2.useState)([]), collapsedGroupIds = _25[0], setCollapsedGroupIds = _25[1];
|
|
487
|
+
// INFO: rows shown per section when the sections do not page themselves
|
|
488
|
+
var _26 = (0, react_2.useState)({}), groupVisibleCounts = _26[0], setGroupVisibleCounts = _26[1];
|
|
397
489
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
398
490
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
399
491
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
@@ -409,25 +501,25 @@ var NewTable = function (props) {
|
|
|
409
501
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
410
502
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
411
503
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
412
|
-
var
|
|
413
|
-
var
|
|
414
|
-
var
|
|
415
|
-
var
|
|
504
|
+
var _27 = (0, react_2.useState)(false), isDragSelecting = _27[0], setIsDragSelecting = _27[1];
|
|
505
|
+
var _28 = (0, react_2.useState)(0), copiedCount = _28[0], setCopiedCount = _28[1];
|
|
506
|
+
var _29 = (0, react_2.useState)({}), editDataValue = _29[0], setEditDataValue = _29[1];
|
|
507
|
+
var _30 = (0, react_2.useState)(false), editDataIsLoading = _30[0], setEditDataIsLoading = _30[1];
|
|
416
508
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
417
509
|
// always there in an addable table
|
|
418
|
-
var
|
|
419
|
-
var
|
|
510
|
+
var _31 = (0, react_2.useState)(false), addData = _31[0], setAddData = _31[1];
|
|
511
|
+
var _32 = (0, react_2.useState)({}), addDataValue = _32[0], setAddDataValue = _32[1];
|
|
420
512
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
421
513
|
// inputs and its first cell takes the focus
|
|
422
|
-
var
|
|
423
|
-
var
|
|
514
|
+
var _33 = (0, react_2.useState)(0), addRowKey = _33[0], setAddRowKey = _33[1];
|
|
515
|
+
var _34 = (0, react_2.useState)({}), referencesOptions = _34[0], setReferencesOptions = _34[1];
|
|
424
516
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
425
517
|
// results still win per key
|
|
426
518
|
var mergedReferencesOptions = __assign(__assign({}, ((_l = props.referencesOptions) !== null && _l !== void 0 ? _l : {})), referencesOptions);
|
|
427
|
-
var
|
|
428
|
-
var
|
|
519
|
+
var _35 = (0, react_2.useState)({}), referencesDetails = _35[0], setReferencesDetails = _35[1];
|
|
520
|
+
var _36 = (0, react_2.useState)(false), referenceLoading = _36[0], setReferenceLoading = _36[1];
|
|
429
521
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
430
|
-
var
|
|
522
|
+
var _37 = (0, react_2.useState)({}), measuredPinWidths = _37[0], setMeasuredPinWidths = _37[1];
|
|
431
523
|
var editDataValueRef = (0, react_2.useRef)({});
|
|
432
524
|
var editDataRowIdRef = (0, react_2.useRef)("");
|
|
433
525
|
var editDataHeaderKeyRef = (0, react_2.useRef)("");
|
|
@@ -799,7 +891,11 @@ var NewTable = function (props) {
|
|
|
799
891
|
commitAddRef.current = handleCommitAdd;
|
|
800
892
|
// INFO: a list column with a palette edits through the ordinary Select, whose
|
|
801
893
|
// options render as the same coloured tags — one dropdown for every cell
|
|
802
|
-
var handleColumnShowsTags = function (col) {
|
|
894
|
+
var handleColumnShowsTags = function (col) {
|
|
895
|
+
var _a;
|
|
896
|
+
return LIST_TYPES.includes((_a = col.type) !== null && _a !== void 0 ? _a : "string") &&
|
|
897
|
+
!!col.listSelectionColour;
|
|
898
|
+
};
|
|
803
899
|
var handleConvertColumnToDataStructure = function (cols) {
|
|
804
900
|
return cols.map(function (col) {
|
|
805
901
|
var _a;
|
|
@@ -919,6 +1015,7 @@ var NewTable = function (props) {
|
|
|
919
1015
|
};
|
|
920
1016
|
var handleModalEditClose = function () {
|
|
921
1017
|
setModalEditVisible(false);
|
|
1018
|
+
setSignatureSigning(false);
|
|
922
1019
|
editDataRowIdRef.current = "";
|
|
923
1020
|
editDataValueRef.current = {};
|
|
924
1021
|
setEditDataRowId("");
|
|
@@ -933,6 +1030,12 @@ var NewTable = function (props) {
|
|
|
933
1030
|
switch (_g.label) {
|
|
934
1031
|
case 0:
|
|
935
1032
|
columnId = editDataHeaderKey;
|
|
1033
|
+
return [4 /*yield*/, handleCheckFormInputRefs("edit")];
|
|
1034
|
+
case 1:
|
|
1035
|
+
// INFO: a signature hands over what was drawn only when its field is
|
|
1036
|
+
// checked, so the fields are checked before the value is read
|
|
1037
|
+
if (!(_g.sent()))
|
|
1038
|
+
return [2 /*return*/];
|
|
936
1039
|
value = editDataValueRef.current[columnId];
|
|
937
1040
|
isUntouchedFilesObj = value &&
|
|
938
1041
|
typeof value === "object" &&
|
|
@@ -942,12 +1045,12 @@ var NewTable = function (props) {
|
|
|
942
1045
|
((_d = (_c = value.remove) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) === 0 &&
|
|
943
1046
|
JSON.stringify(value.data) ===
|
|
944
1047
|
JSON.stringify((_f = (_e = originalDataRef.current) === null || _e === void 0 ? void 0 : _e[columnId]) !== null && _f !== void 0 ? _f : []);
|
|
945
|
-
if (!!isUntouchedFilesObj) return [3 /*break*/,
|
|
1048
|
+
if (!!isUntouchedFilesObj) return [3 /*break*/, 3];
|
|
946
1049
|
return [4 /*yield*/, handleEditDataOnBlur(columnId, editDataValueRef.current)];
|
|
947
|
-
case 1:
|
|
948
|
-
_g.sent();
|
|
949
|
-
_g.label = 2;
|
|
950
1050
|
case 2:
|
|
1051
|
+
_g.sent();
|
|
1052
|
+
_g.label = 3;
|
|
1053
|
+
case 3:
|
|
951
1054
|
handleModalEditClose();
|
|
952
1055
|
return [2 /*return*/];
|
|
953
1056
|
}
|
|
@@ -958,6 +1061,18 @@ var NewTable = function (props) {
|
|
|
958
1061
|
cloned[e.target.id] = e.target.value;
|
|
959
1062
|
handleUpdateChangeData(cloned);
|
|
960
1063
|
};
|
|
1064
|
+
var handleOnChangeMarkdown = function (id, value) {
|
|
1065
|
+
var cloned = handleGenerateClonedData();
|
|
1066
|
+
cloned[id] = value;
|
|
1067
|
+
handleUpdateChangeData(cloned);
|
|
1068
|
+
};
|
|
1069
|
+
// INFO: a drawn signature arrives as a data URL, uploaded by the save
|
|
1070
|
+
var handleSignatureComplete = function (dataURL, id) {
|
|
1071
|
+
var cloned = handleGenerateClonedData();
|
|
1072
|
+
if (dataURL)
|
|
1073
|
+
cloned[id] = dataURL;
|
|
1074
|
+
handleUpdateChangeData(cloned);
|
|
1075
|
+
};
|
|
961
1076
|
var handleOnChangeSelect = function (id, value) {
|
|
962
1077
|
var cloned = handleGenerateClonedData();
|
|
963
1078
|
cloned[id] = value;
|
|
@@ -1052,7 +1167,7 @@ var NewTable = function (props) {
|
|
|
1052
1167
|
// resize is a per-viewer preference and there is no storage for it yet.
|
|
1053
1168
|
// Tailwind cannot emit a runtime w-[Npx], so this drives an inline style and
|
|
1054
1169
|
// wins over the col.width class.
|
|
1055
|
-
var
|
|
1170
|
+
var _38 = (0, react_2.useState)({}), columnWidths = _38[0], setColumnWidths = _38[1];
|
|
1056
1171
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1057
1172
|
// INFO: a consumer may deliberately set a column narrower than the default
|
|
1058
1173
|
// floor (a 40px icon column, say) — never force it wider than it was asked to
|
|
@@ -1118,7 +1233,7 @@ var NewTable = function (props) {
|
|
|
1118
1233
|
});
|
|
1119
1234
|
};
|
|
1120
1235
|
var renderAddColumnPanel = function () {
|
|
1121
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
1236
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1122
1237
|
// INFO: a caller that renders its own form keeps full control; the
|
|
1123
1238
|
// built-in one only appears when it hands over onAddColumn instead
|
|
1124
1239
|
if ((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderAddColumnElements)
|
|
@@ -1139,7 +1254,7 @@ var NewTable = function (props) {
|
|
|
1139
1254
|
react_2.default.createElement("span", { className: "font-mono font-medium" }, derivedId),
|
|
1140
1255
|
taken ? " — already used by another column" : "")) : ("The field id is generated from the name")))),
|
|
1141
1256
|
react_2.default.createElement(select_1.Select, { id: "newColumnType", label: "Type", value: newColumnType, darkMode: props.darkMode, options: editingColumn
|
|
1142
|
-
?
|
|
1257
|
+
? ALL_COLUMN_TYPES.filter(function (eachType) {
|
|
1143
1258
|
return (0, exports.handleGetEditableColumnTypes)(editingColumn.type).includes(eachType.key);
|
|
1144
1259
|
})
|
|
1145
1260
|
: ADD_COLUMN_TYPES, disabled: !!editingColumn &&
|
|
@@ -1162,15 +1277,14 @@ var NewTable = function (props) {
|
|
|
1162
1277
|
setNewColumnRefLabel("");
|
|
1163
1278
|
} }),
|
|
1164
1279
|
react_2.default.createElement(select_1.Select, { id: "newColumnRefLabel", label: "Reference label", value: newColumnRefLabel, darkMode: props.darkMode, portalDropdown: true, disabled: !newColumnRefSpace, options: (_g = (_f = (_e = props.advSettings).renderReferenceLabelOptions) === null || _f === void 0 ? void 0 : _f.call(_e, newColumnRefSpace)) !== null && _g !== void 0 ? _g : [], onChange: function (value) { return setNewColumnRefLabel(value); } }))),
|
|
1165
|
-
LIST_TYPES.includes(newColumnType) && (
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}), onChange: function (event) { var _a, _b; return setNewColumnOptions((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""); } })),
|
|
1280
|
+
LIST_TYPES.includes(newColumnType) && renderColumnOptions(),
|
|
1281
|
+
newColumnType === "number" && (react_2.default.createElement(textInput_1.TextInput, { id: "newColumnRatingMax", type: "number", label: "Rating Stars", placeholder: "1 - ".concat(buttonCell_1.MAX_RATING), value: newColumnRatingMax, darkMode: props.darkMode, onChange: function (event) { var _a, _b; return setNewColumnRatingMax((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""); } })),
|
|
1282
|
+
newColumnType === "button" && (react_2.default.createElement(react_2.default.Fragment, null,
|
|
1283
|
+
react_2.default.createElement(textInput_1.TextInput, { id: "newColumnButtonLabel", type: "text", label: "Button Label", placeholder: newColumnName.trim() || "Send", value: newColumnButtonLabel, darkMode: props.darkMode, onChange: function (event) { var _a, _b; return setNewColumnButtonLabel((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""); } }),
|
|
1284
|
+
react_2.default.createElement(select_1.Select, { id: "newColumnButtonColour", label: "Button Colour", value: newColumnButtonColour, darkMode: props.darkMode, portalDropdown: true, options: BUTTON_COLOUR_OPTIONS, onChange: function (value) { return setNewColumnButtonColour(value); } }),
|
|
1285
|
+
react_2.default.createElement(textInput_1.TextInput, { id: "newColumnButtonConfirm", type: "text", label: "Confirm Message", placeholder: "Send this to the customer?", value: newColumnButtonConfirm, darkMode: props.darkMode, onChange: function (event) { var _a, _b; return setNewColumnButtonConfirm((_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""); } }))),
|
|
1172
1286
|
ASSET_TYPES.includes(newColumnType) && (react_2.default.createElement("p", { className: "-mt-2 text-xs text-gray-500" }, "Uploads are stored against this space automatically.")),
|
|
1173
|
-
newColumnType === "formula" && (react_2.default.createElement(builder_1.FormulaBuilder, { value: newColumnFormula, schema: handleGetFormulaSchema(), columnId: editingColumn === null || editingColumn === void 0 ? void 0 : editingColumn.id, previewRow: (
|
|
1287
|
+
newColumnType === "formula" && (react_2.default.createElement(builder_1.FormulaBuilder, { value: newColumnFormula, schema: handleGetFormulaSchema(), columnId: editingColumn === null || editingColumn === void 0 ? void 0 : editingColumn.id, previewRow: (_h = props.data) === null || _h === void 0 ? void 0 : _h[0], previewDisplayRow: (_j = props.spaceData) === null || _j === void 0 ? void 0 : _j[0], darkMode: props.darkMode, onChange: setNewColumnFormula })),
|
|
1174
1288
|
newColumnType !== "formula" && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnRequired",
|
|
1175
1289
|
// INFO: the checkbox itself is not a required field — without this it
|
|
1176
1290
|
// renders "Required *", which reads as a validation error on a toggle
|
|
@@ -1192,8 +1306,54 @@ var NewTable = function (props) {
|
|
|
1192
1306
|
addingColumn ||
|
|
1193
1307
|
!handleIsNewColumnReady(), onClick: handleSubmitNewColumn }))));
|
|
1194
1308
|
};
|
|
1309
|
+
var handleChangeOption = function (key, change) {
|
|
1310
|
+
return setNewColumnOptions(newColumnOptions.map(function (eachOption) {
|
|
1311
|
+
return eachOption.key === key ? __assign(__assign({}, eachOption), change) : eachOption;
|
|
1312
|
+
}));
|
|
1313
|
+
};
|
|
1314
|
+
var handleAddOption = function () {
|
|
1315
|
+
return setNewColumnOptions(__spreadArray(__spreadArray([], newColumnOptions, true), [
|
|
1316
|
+
{ key: handleNextOptionKey(), text: "", colour: "" },
|
|
1317
|
+
], false));
|
|
1318
|
+
};
|
|
1319
|
+
var handleRemoveOption = function (key) {
|
|
1320
|
+
setNewColumnOptions(newColumnOptions.filter(function (eachOption) { return eachOption.key !== key; }));
|
|
1321
|
+
setOptionColourKey(null);
|
|
1322
|
+
};
|
|
1323
|
+
// INFO: two options of one text could not be told apart in a cell
|
|
1324
|
+
var handleHasDuplicateOptions = function () {
|
|
1325
|
+
var texts = newColumnOptions
|
|
1326
|
+
.map(function (eachOption) { return eachOption.text.trim(); })
|
|
1327
|
+
.filter(Boolean);
|
|
1328
|
+
return new Set(texts).size !== texts.length;
|
|
1329
|
+
};
|
|
1330
|
+
var renderOptionColourPalette = function (option, index) { return (react_2.default.createElement("div", { className: "absolute right-0 top-full z-10 mt-1 grid w-44 grid-cols-5 gap-2 rounded-md border border-gray-200 bg-white p-2 shadow-lg", "data-testid": "column-option-palette-".concat(index) }, __spreadArray([""], OPTION_COLOURS, true).map(function (eachColour) { return (react_2.default.createElement("button", { key: eachColour || "none", type: "button", "aria-label": eachColour || "none", "aria-pressed": option.colour === eachColour, "data-testid": "column-option-colour-".concat(index, "-").concat(eachColour || "none"), className: "h-6 w-6 rounded-full border-2 ".concat(OPTION_SWATCH_CLASS[eachColour], " ").concat(option.colour === eachColour
|
|
1331
|
+
? "ring-2 ring-gray-500 ring-offset-1"
|
|
1332
|
+
: ""), onClick: function () {
|
|
1333
|
+
handleChangeOption(option.key, { colour: eachColour });
|
|
1334
|
+
setOptionColourKey(null);
|
|
1335
|
+
} })); }))); };
|
|
1336
|
+
var renderColumnOptions = function () { return (react_2.default.createElement("div", { className: "flex flex-col gap-y-2" },
|
|
1337
|
+
react_2.default.createElement("span", { className: "text-sm font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700") }, "Options"),
|
|
1338
|
+
newColumnOptions.map(function (eachOption, index) {
|
|
1339
|
+
var _a;
|
|
1340
|
+
return (react_2.default.createElement("div", { key: eachOption.key, className: "relative flex flex-row items-center gap-x-2", "data-testid": "column-option-".concat(index) },
|
|
1341
|
+
react_2.default.createElement("input", { id: "newColumnOption-".concat(index), type: "text", value: eachOption.text, placeholder: "Option", className: "block w-full min-w-0 flex-1 rounded-md border px-3 py-1.5 text-sm focus:border-primary-500 focus:outline-none focus:ring-0 ".concat(props.darkMode
|
|
1342
|
+
? "border-gray-600 bg-gray-800 text-white"
|
|
1343
|
+
: "border-gray-300"), onChange: function (event) {
|
|
1344
|
+
return handleChangeOption(eachOption.key, { text: event.target.value });
|
|
1345
|
+
} }),
|
|
1346
|
+
react_2.default.createElement("button", { type: "button", "aria-label": "Colour", "data-testid": "column-option-colour-btn-".concat(index), className: "h-6 w-6 shrink-0 rounded-full border-2 ".concat((_a = OPTION_SWATCH_CLASS[eachOption.colour]) !== null && _a !== void 0 ? _a : OPTION_SWATCH_CLASS[""]), onClick: function () {
|
|
1347
|
+
return setOptionColourKey(optionColourKey === eachOption.key ? null : eachOption.key);
|
|
1348
|
+
} }),
|
|
1349
|
+
react_2.default.createElement("button", { type: "button", "aria-label": "Remove", "data-testid": "column-option-remove-".concat(index), className: "shrink-0 text-gray-400 hover:text-red-600", onClick: function () { return handleRemoveOption(eachOption.key); } },
|
|
1350
|
+
react_2.default.createElement(solid_2.XMarkIcon, { className: "h-4 w-4" })),
|
|
1351
|
+
optionColourKey === eachOption.key &&
|
|
1352
|
+
renderOptionColourPalette(eachOption, index)));
|
|
1353
|
+
}),
|
|
1354
|
+
react_2.default.createElement(textButton_1.TextButton, { text: "Add option", className: "self-start text-sm", onClick: handleAddOption }))); };
|
|
1195
1355
|
var handleEditColumnModal = function (columnId) {
|
|
1196
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1356
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1197
1357
|
var schema = (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.getColumnSchema) === null || _b === void 0 ? void 0 : _b.call(_a, columnId);
|
|
1198
1358
|
if (!schema)
|
|
1199
1359
|
return;
|
|
@@ -1202,13 +1362,24 @@ var NewTable = function (props) {
|
|
|
1202
1362
|
setNewColumnType((_d = schema.type) !== null && _d !== void 0 ? _d : "string");
|
|
1203
1363
|
setNewColumnRefSpace((_e = schema.referenceSpaceId) !== null && _e !== void 0 ? _e : "");
|
|
1204
1364
|
setNewColumnRefLabel((_f = schema.referenceLabel) !== null && _f !== void 0 ? _f : "");
|
|
1205
|
-
setNewColumnOptions(
|
|
1365
|
+
setNewColumnOptions((0, exports.handleReadColumnOptions)(schema));
|
|
1366
|
+
setOptionColourKey(null);
|
|
1206
1367
|
setNewColumnRequired(!schema.optional);
|
|
1368
|
+
setNewColumnRatingMax(schema.ratingMax ? String(schema.ratingMax) : "");
|
|
1369
|
+
setNewColumnButtonLabel((_g = schema.buttonLabel) !== null && _g !== void 0 ? _g : "");
|
|
1370
|
+
setNewColumnButtonColour((_h = schema.buttonColour) !== null && _h !== void 0 ? _h : "");
|
|
1371
|
+
setNewColumnButtonConfirm((_j = schema.buttonConfirm) !== null && _j !== void 0 ? _j : "");
|
|
1207
1372
|
setNewColumnFormula(schema.type === "formula"
|
|
1208
1373
|
? (0, formula_1.handleGetFormulaDisplay)(schema, handleGetFormulaSchema())
|
|
1209
1374
|
: "");
|
|
1210
1375
|
setAddColumnModal(columnId);
|
|
1211
1376
|
};
|
|
1377
|
+
var handleFitPanelToWindow = function (panel) {
|
|
1378
|
+
if (!panel)
|
|
1379
|
+
return;
|
|
1380
|
+
var top = panel.getBoundingClientRect().top;
|
|
1381
|
+
panel.style.maxHeight = "".concat(Math.max(240, window.innerHeight - top - 16), "px");
|
|
1382
|
+
};
|
|
1212
1383
|
var handleAddColumnModal = function (id) {
|
|
1213
1384
|
setAddColumnModal(id);
|
|
1214
1385
|
if (!id) {
|
|
@@ -1217,9 +1388,14 @@ var NewTable = function (props) {
|
|
|
1217
1388
|
setNewColumnType("string");
|
|
1218
1389
|
setNewColumnRefSpace("");
|
|
1219
1390
|
setNewColumnRefLabel("");
|
|
1220
|
-
setNewColumnOptions(
|
|
1391
|
+
setNewColumnOptions([]);
|
|
1392
|
+
setOptionColourKey(null);
|
|
1221
1393
|
setNewColumnRequired(false);
|
|
1222
1394
|
setNewColumnFormula("");
|
|
1395
|
+
setNewColumnRatingMax("");
|
|
1396
|
+
setNewColumnButtonLabel("");
|
|
1397
|
+
setNewColumnButtonColour("");
|
|
1398
|
+
setNewColumnButtonConfirm("");
|
|
1223
1399
|
}
|
|
1224
1400
|
};
|
|
1225
1401
|
// INFO: the stored field id is derived from what the user types rather than
|
|
@@ -1236,8 +1412,13 @@ var NewTable = function (props) {
|
|
|
1236
1412
|
.map(function (eachWord) { return eachWord.charAt(0).toUpperCase() + eachWord.slice(1); })
|
|
1237
1413
|
.join(""));
|
|
1238
1414
|
};
|
|
1415
|
+
// INFO: the record's key fields and the system columns are on every row
|
|
1416
|
+
// whether or not the table shows them, so a new column cannot claim them
|
|
1239
1417
|
var handleColumnIdTaken = function (id) {
|
|
1240
|
-
return
|
|
1418
|
+
return id === "id" ||
|
|
1419
|
+
id === "_id" ||
|
|
1420
|
+
(0, systemColumns_1.handleIsSystemColumn)(id) ||
|
|
1421
|
+
flatColumns.some(function (eachColumn) { return eachColumn.key === id; });
|
|
1241
1422
|
};
|
|
1242
1423
|
// INFO: every column a formula may read. The full model when the caller
|
|
1243
1424
|
// gives it — hidden columns are still on the row — else the shown columns.
|
|
@@ -1260,6 +1441,12 @@ var NewTable = function (props) {
|
|
|
1260
1441
|
// INFO: a reference with no target resolves nothing, so it cannot be saved
|
|
1261
1442
|
// half-built. Everything else is complete with a name and a type.
|
|
1262
1443
|
var handleIsNewColumnReady = function () {
|
|
1444
|
+
if (LIST_TYPES.includes(newColumnType) && handleHasDuplicateOptions())
|
|
1445
|
+
return false;
|
|
1446
|
+
if (newColumnType === "number" &&
|
|
1447
|
+
newColumnRatingMax.trim() &&
|
|
1448
|
+
handleParseRatingMax(newColumnRatingMax) === undefined)
|
|
1449
|
+
return false;
|
|
1263
1450
|
if (REFERENCE_TYPES.includes(newColumnType))
|
|
1264
1451
|
return !!newColumnRefSpace && !!newColumnRefLabel;
|
|
1265
1452
|
// INFO: an illegal formula would show "Error" in every row
|
|
@@ -1271,25 +1458,60 @@ var NewTable = function (props) {
|
|
|
1271
1458
|
}
|
|
1272
1459
|
return true;
|
|
1273
1460
|
};
|
|
1461
|
+
// INFO: a number column shows as stars only with a whole 1 to 10; blank
|
|
1462
|
+
// leaves it a plain number
|
|
1463
|
+
var handleParseRatingMax = function (value) {
|
|
1464
|
+
var parsed = Number(value);
|
|
1465
|
+
return value.trim() &&
|
|
1466
|
+
Number.isInteger(parsed) &&
|
|
1467
|
+
parsed >= 1 &&
|
|
1468
|
+
parsed <= buttonCell_1.MAX_RATING
|
|
1469
|
+
? parsed
|
|
1470
|
+
: undefined;
|
|
1471
|
+
};
|
|
1472
|
+
// INFO: the panel's rating and button settings on the column — kept only on
|
|
1473
|
+
// the type they belong to, and a blank one is left off rather than saved empty
|
|
1474
|
+
var handleApplyColumnSettings = function (column) {
|
|
1475
|
+
var ratingMax = newColumnType === "number"
|
|
1476
|
+
? handleParseRatingMax(newColumnRatingMax)
|
|
1477
|
+
: undefined;
|
|
1478
|
+
if (ratingMax)
|
|
1479
|
+
column.ratingMax = ratingMax;
|
|
1480
|
+
else
|
|
1481
|
+
delete column.ratingMax;
|
|
1482
|
+
var buttonSettings = [
|
|
1483
|
+
["buttonLabel", newColumnButtonLabel],
|
|
1484
|
+
["buttonColour", newColumnButtonColour],
|
|
1485
|
+
["buttonConfirm", newColumnButtonConfirm],
|
|
1486
|
+
];
|
|
1487
|
+
buttonSettings.forEach(function (_a) {
|
|
1488
|
+
var eachKey = _a[0], eachValue = _a[1];
|
|
1489
|
+
if (newColumnType === "button" && eachValue.trim())
|
|
1490
|
+
column[eachKey] = eachValue.trim();
|
|
1491
|
+
else
|
|
1492
|
+
delete column[eachKey];
|
|
1493
|
+
});
|
|
1494
|
+
return column;
|
|
1495
|
+
};
|
|
1274
1496
|
var handleSubmitNewColumn = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1275
1497
|
var id, column;
|
|
1276
|
-
var _a, _b;
|
|
1277
|
-
return __generator(this, function (
|
|
1278
|
-
switch (
|
|
1498
|
+
var _a, _b, _c;
|
|
1499
|
+
return __generator(this, function (_d) {
|
|
1500
|
+
switch (_d.label) {
|
|
1279
1501
|
case 0:
|
|
1280
1502
|
if (!editingColumn) return [3 /*break*/, 2];
|
|
1281
1503
|
return [4 /*yield*/, handleSubmitEditedColumn(editingColumn)];
|
|
1282
1504
|
case 1:
|
|
1283
|
-
|
|
1505
|
+
_d.sent();
|
|
1284
1506
|
return [2 /*return*/];
|
|
1285
1507
|
case 2:
|
|
1286
1508
|
id = handleDeriveColumnId(newColumnName);
|
|
1287
1509
|
if (!id || handleColumnIdTaken(id) || !handleIsNewColumnReady())
|
|
1288
1510
|
return [2 /*return*/];
|
|
1289
1511
|
setAddingColumn(true);
|
|
1290
|
-
|
|
1512
|
+
_d.label = 3;
|
|
1291
1513
|
case 3:
|
|
1292
|
-
|
|
1514
|
+
_d.trys.push([3, , 5, 6]);
|
|
1293
1515
|
column = {
|
|
1294
1516
|
id: id,
|
|
1295
1517
|
name: newColumnName.trim(),
|
|
@@ -1304,18 +1526,19 @@ var NewTable = function (props) {
|
|
|
1304
1526
|
column.referenceLabel = newColumnRefLabel;
|
|
1305
1527
|
}
|
|
1306
1528
|
if (LIST_TYPES.includes(newColumnType))
|
|
1307
|
-
column
|
|
1308
|
-
.split(",")
|
|
1309
|
-
.map(function (eachOption) { return eachOption.trim(); })
|
|
1310
|
-
.filter(Boolean);
|
|
1529
|
+
(0, exports.handleWriteColumnOptions)(column, newColumnOptions);
|
|
1311
1530
|
if (newColumnType === "formula") {
|
|
1312
1531
|
column.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1313
1532
|
column.optional = true;
|
|
1314
1533
|
}
|
|
1534
|
+
handleApplyColumnSettings(column);
|
|
1315
1535
|
return [4 /*yield*/, ((_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.onAddColumn) === null || _b === void 0 ? void 0 : _b.call(_a, column))];
|
|
1316
1536
|
case 4:
|
|
1317
|
-
|
|
1537
|
+
_d.sent();
|
|
1318
1538
|
handleAddColumnModal("");
|
|
1539
|
+
// INFO: the column is on the table now; the panel left open showed an
|
|
1540
|
+
// empty form that read as the add not having happened
|
|
1541
|
+
(_c = addColumnPopUpRef.current) === null || _c === void 0 ? void 0 : _c.handleOnClose();
|
|
1319
1542
|
return [3 /*break*/, 6];
|
|
1320
1543
|
case 5:
|
|
1321
1544
|
setAddingColumn(false);
|
|
@@ -1327,23 +1550,23 @@ var NewTable = function (props) {
|
|
|
1327
1550
|
// INFO: the column keeps everything the panel does not show; settings that
|
|
1328
1551
|
// belong to a type it no longer has are dropped with it
|
|
1329
1552
|
var handleSubmitEditedColumn = function (original) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1330
|
-
var
|
|
1331
|
-
var _a, _b, _c
|
|
1332
|
-
return __generator(this, function (
|
|
1333
|
-
switch (
|
|
1553
|
+
var source, column_1;
|
|
1554
|
+
var _a, _b, _c;
|
|
1555
|
+
return __generator(this, function (_d) {
|
|
1556
|
+
switch (_d.label) {
|
|
1334
1557
|
case 0:
|
|
1335
1558
|
if (!newColumnName.trim() || !handleIsNewColumnReady())
|
|
1336
1559
|
return [2 /*return*/];
|
|
1337
1560
|
setAddingColumn(true);
|
|
1338
|
-
|
|
1561
|
+
_d.label = 1;
|
|
1339
1562
|
case 1:
|
|
1340
|
-
|
|
1341
|
-
|
|
1563
|
+
_d.trys.push([1, , 3, 4]);
|
|
1564
|
+
source = original;
|
|
1342
1565
|
column_1 = __assign(__assign({}, original), { name: newColumnName.trim(), type: newColumnType, optional: !newColumnRequired });
|
|
1343
1566
|
if (newColumnType !== original.type)
|
|
1344
1567
|
((_a = TYPE_ONLY_KEYS[original.type]) !== null && _a !== void 0 ? _a : []).forEach(function (eachKey) { return delete column_1[eachKey]; });
|
|
1345
1568
|
if (REFERENCE_TYPES.includes(newColumnType)) {
|
|
1346
|
-
if (newColumnRefSpace !==
|
|
1569
|
+
if (newColumnRefSpace !== source.referenceSpaceId)
|
|
1347
1570
|
REFERENCE_TARGET_KEYS.forEach(function (eachKey) { return delete column_1[eachKey]; });
|
|
1348
1571
|
column_1.referenceSpaceId = newColumnRefSpace;
|
|
1349
1572
|
column_1.referenceLabel = newColumnRefLabel;
|
|
@@ -1354,25 +1577,7 @@ var NewTable = function (props) {
|
|
|
1354
1577
|
REFERENCE_TARGET_KEYS.forEach(function (eachKey) { return delete column_1[eachKey]; });
|
|
1355
1578
|
}
|
|
1356
1579
|
if (LIST_TYPES.includes(newColumnType)) {
|
|
1357
|
-
|
|
1358
|
-
// INFO: unchanged text keeps the stored options exactly — an option
|
|
1359
|
-
// holding a comma would otherwise come back split in two
|
|
1360
|
-
if (newColumnOptions !== handleJoinOptions(previous_1)) {
|
|
1361
|
-
next_1 = handleSplitOptions(newColumnOptions);
|
|
1362
|
-
column_1.listSelection = next_1;
|
|
1363
|
-
// INFO: colours and labels line up with the options by position, so
|
|
1364
|
-
// each follows its own option rather than the slot it sat in
|
|
1365
|
-
["listSelectionColour", "listSelectionLabel"].forEach(function (eachKey) {
|
|
1366
|
-
var values = source_1[eachKey];
|
|
1367
|
-
if (!values)
|
|
1368
|
-
return;
|
|
1369
|
-
var rebuilt = next_1.map(function (eachOption) { var _a; return (_a = values[previous_1.indexOf(eachOption)]) !== null && _a !== void 0 ? _a : ""; });
|
|
1370
|
-
if (rebuilt.some(Boolean))
|
|
1371
|
-
column_1[eachKey] = rebuilt;
|
|
1372
|
-
else
|
|
1373
|
-
delete column_1[eachKey];
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1580
|
+
(0, exports.handleWriteColumnOptions)(column_1, newColumnOptions);
|
|
1376
1581
|
}
|
|
1377
1582
|
else {
|
|
1378
1583
|
delete column_1.listSelection;
|
|
@@ -1383,9 +1588,10 @@ var NewTable = function (props) {
|
|
|
1383
1588
|
column_1.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1384
1589
|
column_1.optional = true;
|
|
1385
1590
|
}
|
|
1386
|
-
|
|
1591
|
+
handleApplyColumnSettings(column_1);
|
|
1592
|
+
return [4 /*yield*/, ((_c = (_b = props.advSettings) === null || _b === void 0 ? void 0 : _b.onEditColumn) === null || _c === void 0 ? void 0 : _c.call(_b, column_1))];
|
|
1387
1593
|
case 2:
|
|
1388
|
-
|
|
1594
|
+
_d.sent();
|
|
1389
1595
|
handleAddColumnModal("");
|
|
1390
1596
|
return [3 /*break*/, 4];
|
|
1391
1597
|
case 3:
|
|
@@ -2027,7 +2233,7 @@ var NewTable = function (props) {
|
|
|
2027
2233
|
flatColumns.map(function (col, colIndex) {
|
|
2028
2234
|
var _a, _b, _c;
|
|
2029
2235
|
var renderDataCell = function () {
|
|
2030
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
2236
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
2031
2237
|
// INFO: a coloured list cell is this table's to render, so it takes
|
|
2032
2238
|
// the raw value even when a display row is supplied. The list view
|
|
2033
2239
|
// builds those rows and puts a Tag in for a coloured value — an
|
|
@@ -2035,12 +2241,22 @@ var NewTable = function (props) {
|
|
|
2035
2241
|
// the column came out as a pill that could not be edited in place.
|
|
2036
2242
|
// Only the cell is redirected: the display rows still carry the Tag
|
|
2037
2243
|
// for the read view, the kanban and the grid.
|
|
2038
|
-
var cellValue = spaceRow &&
|
|
2244
|
+
var cellValue = spaceRow &&
|
|
2245
|
+
!(handleColumnShowsTags(col) &&
|
|
2246
|
+
(col.type === "list" || ((_a = props.editable) === null || _a === void 0 ? void 0 : _a.active)))
|
|
2039
2247
|
? spaceRow[col.key]
|
|
2040
2248
|
: resolveValue(row, col.key);
|
|
2041
2249
|
// INFO: first col with type "string" is never made editable
|
|
2042
|
-
var resolvedColType = (
|
|
2250
|
+
var resolvedColType = (_b = col.type) !== null && _b !== void 0 ? _b : "string";
|
|
2043
2251
|
var isActionColumn = col.key === "update" && !col.type;
|
|
2252
|
+
// INFO: a timeline is picked in its cell, as stars and timers are
|
|
2253
|
+
// used there, by whoever may update the record
|
|
2254
|
+
if (resolvedColType === "dateRange" &&
|
|
2255
|
+
columnTypeActions.canUpdate &&
|
|
2256
|
+
columnTypeActions.onUpdateCell &&
|
|
2257
|
+
!col.disabled)
|
|
2258
|
+
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " whitespace-nowrap ").concat((_d = (_c = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _c === void 0 ? void 0 : _c.className) !== null && _d !== void 0 ? _d : ""), style: (_e = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _e === void 0 ? void 0 : _e.style },
|
|
2259
|
+
react_2.default.createElement(dateRangeCell_1.DateRangeCell, { column: __assign(__assign({}, col), { id: col.key, name: col.title, type: "dateRange" }), rowId: (_f = row.recordId) !== null && _f !== void 0 ? _f : row.id, value: resolveValue(row, col.key) })));
|
|
2044
2260
|
// INFO: a cell whose value is already a React element (row action
|
|
2045
2261
|
// buttons, a custom control) is rendered as-is even in an editable
|
|
2046
2262
|
// table — wrapping it in an inline editor would swallow it
|
|
@@ -2049,12 +2265,13 @@ var NewTable = function (props) {
|
|
|
2049
2265
|
// so it stays read-only in an editable table too — without this an
|
|
2050
2266
|
// admin-locked (often system-filled) column was editable on hover
|
|
2051
2267
|
var isColumnLocked = !!col.disabled;
|
|
2052
|
-
|
|
2268
|
+
// INFO: a thumbnail or a file name is still the cell of a modal
|
|
2269
|
+
// field — the click opens its editor rather than the record
|
|
2270
|
+
var isModalEdit = ((_g = props.editable) === null || _g === void 0 ? void 0 : _g.active) &&
|
|
2053
2271
|
!isColumnLocked &&
|
|
2054
2272
|
!isActionColumn &&
|
|
2055
|
-
!isElementCell &&
|
|
2056
2273
|
utils_1.supportedModalEditList.includes(resolvedColType);
|
|
2057
|
-
var isObjectEdit = ((
|
|
2274
|
+
var isObjectEdit = ((_h = props.editable) === null || _h === void 0 ? void 0 : _h.active) &&
|
|
2058
2275
|
!isColumnLocked &&
|
|
2059
2276
|
!isActionColumn &&
|
|
2060
2277
|
!isElementCell &&
|
|
@@ -2066,12 +2283,12 @@ var NewTable = function (props) {
|
|
|
2066
2283
|
cellValue !== null &&
|
|
2067
2284
|
!(cellValue instanceof Date) &&
|
|
2068
2285
|
utils_1.primitiveInlineEditList.includes(resolvedColType);
|
|
2069
|
-
var isEditable = ((
|
|
2286
|
+
var isEditable = ((_j = props.editable) === null || _j === void 0 ? void 0 : _j.active) &&
|
|
2070
2287
|
!isColumnLocked &&
|
|
2071
2288
|
!isActionColumn &&
|
|
2072
2289
|
!isElementCell &&
|
|
2073
2290
|
!isUneditableShape &&
|
|
2074
|
-
!(((
|
|
2291
|
+
!(((_l = (_k = props.selectedIds) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0) > 0 || props.selectAll) &&
|
|
2075
2292
|
utils_1.supportedInlineEditList.includes(resolvedColType);
|
|
2076
2293
|
var rowData = editDataRowId === row.id ? editDataValue : row;
|
|
2077
2294
|
// INFO: a list column with a palette paints the whole cell —
|
|
@@ -2084,17 +2301,17 @@ var NewTable = function (props) {
|
|
|
2084
2301
|
// INFO: an editable table renders the coloured cell as its Select in
|
|
2085
2302
|
// every row (filled while closed) so the control never swaps in and
|
|
2086
2303
|
// out; the plain block is for read-only tables and locked columns
|
|
2087
|
-
if (fillColour && (!((
|
|
2304
|
+
if (fillColour && (!((_m = props.editable) === null || _m === void 0 ? void 0 : _m.active) || isColumnLocked)) {
|
|
2088
2305
|
// INFO: a read-only table shows the same filled Select as an
|
|
2089
2306
|
// editable one, just disabled — the cell looks identical in both
|
|
2090
2307
|
// modes and the row click still navigates
|
|
2091
|
-
var readOnlyDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (
|
|
2308
|
+
var readOnlyDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (_o = col.type) !== null && _o !== void 0 ? _o : "string", showTagSelections: handleColumnShowsTags(col), disabled: true });
|
|
2092
2309
|
// INFO: navigate on click only for a genuinely read-only table. This
|
|
2093
2310
|
// branch is ALSO entered for a locked column inside an EDITABLE
|
|
2094
2311
|
// table (isColumnLocked) — there a click must leave the Select alone,
|
|
2095
2312
|
// not navigate — so the overlay is gated on !editable.active.
|
|
2096
|
-
var shouldNavigateOnClick = !((
|
|
2097
|
-
return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((
|
|
2313
|
+
var shouldNavigateOnClick = !((_p = props.editable) === null || _p === void 0 ? void 0 : _p.active);
|
|
2314
|
+
return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((_r = (_q = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _q === void 0 ? void 0 : _q.className) !== null && _r !== void 0 ? _r : ""), style: (_s = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _s === void 0 ? void 0 : _s.style },
|
|
2098
2315
|
react_2.default.createElement("div", { className: "relative w-max whitespace-nowrap p-[1px]" },
|
|
2099
2316
|
renderFormCell(row, readOnlyDS, null, {
|
|
2100
2317
|
active: true,
|
|
@@ -2116,7 +2333,7 @@ var NewTable = function (props) {
|
|
|
2116
2333
|
// INFO: share the column width source with the read-only/edit cell
|
|
2117
2334
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
2118
2335
|
// same column resolve to different widths and the column looks ragged
|
|
2119
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((
|
|
2336
|
+
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_u = (_t = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _t === void 0 ? void 0 : _t.className) !== null && _u !== void 0 ? _u : ""), style: (_v = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _v === void 0 ? void 0 : _v.style },
|
|
2120
2337
|
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) {
|
|
2121
2338
|
var _a;
|
|
2122
2339
|
e.stopPropagation();
|
|
@@ -2133,7 +2350,7 @@ var NewTable = function (props) {
|
|
|
2133
2350
|
// INFO: share the column width source with the read-only/edit cell
|
|
2134
2351
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
2135
2352
|
// same column resolve to different widths and the column looks ragged
|
|
2136
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((
|
|
2353
|
+
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((_x = (_w = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _w === void 0 ? void 0 : _w.className) !== null && _x !== void 0 ? _x : ""), style: (_y = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _y === void 0 ? void 0 : _y.style },
|
|
2137
2354
|
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) {
|
|
2138
2355
|
e.stopPropagation();
|
|
2139
2356
|
handleModalEditOnClick(row.id, col.key, row);
|
|
@@ -2146,7 +2363,7 @@ var NewTable = function (props) {
|
|
|
2146
2363
|
// filled pill, so there is nothing to swap to.
|
|
2147
2364
|
if (isEditable &&
|
|
2148
2365
|
(handleColumnShowsTags(col) || handleIsCellLive(row.id, col.key))) {
|
|
2149
|
-
var bareOverride = (
|
|
2366
|
+
var bareOverride = (_0 = (_z = props.bareSettings) === null || _z === void 0 ? void 0 : _z.bareListDescription) === null || _0 === void 0 ? void 0 : _0.call(_z, col.key, cellValue);
|
|
2150
2367
|
if (!bareOverride)
|
|
2151
2368
|
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
2152
2369
|
}
|
|
@@ -2154,7 +2371,7 @@ var NewTable = function (props) {
|
|
|
2154
2371
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
2155
2372
|
react_2.default.createElement("td", __assign({ key: col.key }, (isEditable ? handleCellHoverProps(row.id, col.key) : {}), { "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
|
|
2156
2373
|
? col.key
|
|
2157
|
-
: undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " 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((
|
|
2374
|
+
: undefined, className: "".concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " 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((_2 = (_1 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _1 === void 0 ? void 0 : _1.className) !== null && _2 !== void 0 ? _2 : ""), style: (_3 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _3 === void 0 ? void 0 : _3.style, "data-row-link-cell": props.newTabUrl && props.onClickRow ? "" : undefined }), props.newTabUrl && props.onClickRow ? (react_2.default.createElement(link_1.Link, { href: props.newTabUrl + row.id + ((_4 = props.addNewTabUrl) !== null && _4 !== void 0 ? _4 : ""), 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))));
|
|
2158
2375
|
};
|
|
2159
2376
|
var cell = renderDataCell();
|
|
2160
2377
|
if (colIndex !== 0 || !props.onRowActivity)
|
|
@@ -2208,13 +2425,44 @@ var NewTable = function (props) {
|
|
|
2208
2425
|
react_2.default.createElement("span", null, group.title),
|
|
2209
2426
|
react_2.default.createElement("span", { className: "rounded-full bg-white/70 px-2 py-0.5 text-[11px] font-medium normal-case tracking-normal" }, (_c = group.count) !== null && _c !== void 0 ? _c : memberIndexes.length)))),
|
|
2210
2427
|
!isCollapsed &&
|
|
2211
|
-
memberIndexes
|
|
2428
|
+
memberIndexes
|
|
2429
|
+
.slice(0, handleGetGroupVisibleCount(group.id))
|
|
2430
|
+
.map(function (rowIndex) {
|
|
2212
2431
|
return renderDesktopRow(props.data[rowIndex], rowIndex, colourKey);
|
|
2213
2432
|
}),
|
|
2433
|
+
renderGroupShowMoreRow(group.id, memberIndexes.length, columnCount, isCollapsed),
|
|
2214
2434
|
renderGroupLoadMoreRow(group.id, columnCount, isCollapsed),
|
|
2215
2435
|
renderGroupPagerRow(group, columnCount, isCollapsed)));
|
|
2216
2436
|
});
|
|
2217
2437
|
};
|
|
2438
|
+
// INFO: a section that pages itself already holds one page at a time, so
|
|
2439
|
+
// only sections built from every loaded row draw in batches
|
|
2440
|
+
var handleGetGroupVisibleCount = function (groupId) {
|
|
2441
|
+
var _a;
|
|
2442
|
+
return props.onGroupLoadMore || props.onGroupPageChange
|
|
2443
|
+
? Infinity
|
|
2444
|
+
: ((_a = groupVisibleCounts[groupId]) !== null && _a !== void 0 ? _a : exports.NEW_TABLE_GROUP_ROW_BATCH);
|
|
2445
|
+
};
|
|
2446
|
+
var renderGroupShowMoreRow = function (groupId, memberCount, columnCount, isCollapsed) {
|
|
2447
|
+
var visibleCount = handleGetGroupVisibleCount(groupId);
|
|
2448
|
+
if (isCollapsed || memberCount <= visibleCount)
|
|
2449
|
+
return null;
|
|
2450
|
+
var remaining = memberCount - visibleCount;
|
|
2451
|
+
return (react_2.default.createElement("tr", { "data-testid": "table-group-more-".concat(groupId), className: "border-l-4 border-transparent" },
|
|
2452
|
+
react_2.default.createElement("td", { colSpan: columnCount, className: "px-3 py-1" },
|
|
2453
|
+
react_2.default.createElement("button", { type: "button", className: "min-h-[44px] w-full rounded-md text-sm font-medium text-primary-600 hover:bg-gray-50", onClick: function (e) {
|
|
2454
|
+
e.stopPropagation();
|
|
2455
|
+
setGroupVisibleCounts(function (previous) {
|
|
2456
|
+
var _a;
|
|
2457
|
+
return (__assign(__assign({}, previous), (_a = {}, _a[groupId] = visibleCount + exports.NEW_TABLE_GROUP_ROW_BATCH, _a)));
|
|
2458
|
+
});
|
|
2459
|
+
} },
|
|
2460
|
+
"Show ",
|
|
2461
|
+
Math.min(remaining, exports.NEW_TABLE_GROUP_ROW_BATCH),
|
|
2462
|
+
" more of",
|
|
2463
|
+
" ",
|
|
2464
|
+
remaining))));
|
|
2465
|
+
};
|
|
2218
2466
|
// INFO: per-group scroll sentinel row. Rendered after a band's member rows in
|
|
2219
2467
|
// grouped scroll mode so the group lazily loads its next page as it scrolls
|
|
2220
2468
|
// into view; shows a spinner while that group's page is in flight. Nothing is
|
|
@@ -2388,7 +2636,10 @@ var NewTable = function (props) {
|
|
|
2388
2636
|
// padding. The button (36px) then fits the 56px pinned width.
|
|
2389
2637
|
className: "!px-2 !py-2 whitespace-nowrap text-left text-xs font-semibold uppercase tracking-wide ".concat(cursorClassname, " ").concat(handleGetAddColumnPin(true).className), style: handleGetAddColumnPin(true).style, rowSpan: hasGroupHeaders ? 2 : undefined },
|
|
2390
2638
|
react_2.default.createElement("div", { className: "hidden flex-row items-center md:flex" },
|
|
2391
|
-
react_2.default.createElement(popUp_1.PopUp, { ref: addColumnPopUpRef, darkMode: props.darkMode, darkModeBg: props.darkModeBg, anchor: "right", portal: true, lib: { Transition: react_1.Transition }, excludePortalIds: ["select-portal"], ctaComp: react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-column-btn", icon: react_2.default.createElement(solid_1.PlusIcon, { className: "h-5 w-5 text-gray" }) }), renderComp:
|
|
2639
|
+
react_2.default.createElement(popUp_1.PopUp, { ref: addColumnPopUpRef, darkMode: props.darkMode, darkModeBg: props.darkModeBg, anchor: "right", portal: true, lib: { Transition: react_1.Transition }, excludePortalIds: ["select-portal"], ctaComp: react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-column-btn", icon: react_2.default.createElement(solid_1.PlusIcon, { className: "h-5 w-5 text-gray" }) }), renderComp:
|
|
2640
|
+
// INFO: a button or list column's settings run past a short
|
|
2641
|
+
// screen, so the panel ends at the window's edge and scrolls
|
|
2642
|
+
react_2.default.createElement("div", { ref: handleFitPanelToWindow, className: "w-80 overflow-y-auto p-4 normal-case tracking-normal" }, renderAddColumnPanel()) })),
|
|
2392
2643
|
react_2.default.createElement("div", { className: "flex flex-row items-center md:hidden" },
|
|
2393
2644
|
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-column-btn-mobile", icon: react_2.default.createElement(solid_1.PlusIcon, { className: "h-5 w-5 text-gray" }), onClick: function () { return handleAddColumnModal("new"); } }))));
|
|
2394
2645
|
};
|
|
@@ -2655,6 +2906,8 @@ var NewTable = function (props) {
|
|
|
2655
2906
|
handleOnChangeDate: handleOnChangeDate,
|
|
2656
2907
|
handleOnChangeFile: handleOnChangeFile,
|
|
2657
2908
|
handleOnChangeFiles: handleOnChangeFiles,
|
|
2909
|
+
handleOnChangeMarkdown: handleOnChangeMarkdown,
|
|
2910
|
+
handleSignatureComplete: handleSignatureComplete,
|
|
2658
2911
|
}, true, undefined, {
|
|
2659
2912
|
id: editDataRowId,
|
|
2660
2913
|
type: "list",
|
|
@@ -2672,7 +2925,7 @@ var NewTable = function (props) {
|
|
|
2672
2925
|
imageEndpoint: (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.imageEndpoint) !== null && _b !== void 0 ? _b : "",
|
|
2673
2926
|
imageBucketName: (_c = props.devSettings) === null || _c === void 0 ? void 0 : _c.bucketName,
|
|
2674
2927
|
maxFileSize: (_d = props.devSettings) === null || _d === void 0 ? void 0 : _d.maxFileSize,
|
|
2675
|
-
}),
|
|
2928
|
+
}, undefined, { signing: signatureSigning, setSigning: setSignatureSigning }),
|
|
2676
2929
|
react_2.default.createElement("div", { className: "flex justify-end gap-3", "data-testid": "table-modal-editor-actions" },
|
|
2677
2930
|
react_2.default.createElement(button_1.Button, { text: "Cancel", type: "light", onClick: handleModalEditClose }),
|
|
2678
2931
|
react_2.default.createElement(button_1.Button, { text: editDataIsLoading ? "Saving" : "Save", type: "normal", disable: editDataIsLoading, onClick: handleModalEditSave }))));
|