blixify-ui-web 1.2.198 → 1.2.200
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 +3 -1
- package/lib/components/data/columnTypes/buttonCell.d.ts.map +1 -1
- package/lib/components/data/columnTypes/buttonCell.js +4 -0
- package/lib/components/data/columnTypes/buttonCell.js.map +1 -1
- package/lib/components/data/columnTypes/context.d.ts +1 -0
- package/lib/components/data/columnTypes/context.d.ts.map +1 -1
- package/lib/components/data/columnTypes/context.js.map +1 -1
- 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 +211 -0
- package/lib/components/data/columnTypes/dateRangeCell.js.map +1 -0
- package/lib/components/data/columnTypes/index.d.ts +1 -0
- package/lib/components/data/columnTypes/index.d.ts.map +1 -1
- package/lib/components/data/columnTypes/index.js +1 -0
- package/lib/components/data/columnTypes/index.js.map +1 -1
- package/lib/components/data/columnTypes/personAvatar.d.ts +24 -0
- package/lib/components/data/columnTypes/personAvatar.d.ts.map +1 -0
- package/lib/components/data/columnTypes/personAvatar.js +89 -0
- package/lib/components/data/columnTypes/personAvatar.js.map +1 -0
- package/lib/components/data/columnTypes/timeTracking.d.ts +2 -0
- package/lib/components/data/columnTypes/timeTracking.d.ts.map +1 -1
- package/lib/components/data/columnTypes/timeTracking.js +14 -1
- package/lib/components/data/columnTypes/timeTracking.js.map +1 -1
- package/lib/components/data/columnTypes/timeTrackingCell.d.ts +7 -0
- package/lib/components/data/columnTypes/timeTrackingCell.d.ts.map +1 -1
- package/lib/components/data/columnTypes/timeTrackingCell.js +72 -17
- package/lib/components/data/columnTypes/timeTrackingCell.js.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.d.ts +20 -1
- 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 +490 -216
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +6 -0
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js +35 -1
- 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 +1 -1
- package/lib/components/data/flexFilter/index.js.map +1 -1
- package/lib/components/data/formula/index.d.ts.map +1 -1
- package/lib/components/data/formula/index.js +3 -1
- package/lib/components/data/formula/index.js.map +1 -1
- package/lib/components/data/listModule.d.ts +3 -0
- package/lib/components/data/listModule.d.ts.map +1 -1
- package/lib/components/data/listModule.js +83 -68
- 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 +7 -14
- 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 +29 -22
- 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 +19 -12
- package/lib/components/data/utils.js.map +1 -1
- package/lib/components/display/newTable/columnWidth.d.ts +8 -0
- package/lib/components/display/newTable/columnWidth.d.ts.map +1 -0
- package/lib/components/display/newTable/columnWidth.js +32 -0
- package/lib/components/display/newTable/columnWidth.js.map +1 -0
- 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 +379 -136
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/input/select/index.d.ts +2 -0
- package/lib/components/input/select/index.d.ts.map +1 -1
- package/lib/components/input/select/index.js +62 -16
- package/lib/components/input/select/index.js.map +1 -1
- package/lib/components/input/textInput/index.d.ts.map +1 -1
- package/lib/components/input/textInput/index.js +16 -11
- package/lib/components/input/textInput/index.js.map +1 -1
- package/lib/tail.css +12 -2
- package/package.json +1 -1
|
@@ -69,6 +69,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
73
|
+
var t = {};
|
|
74
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
75
|
+
t[p] = s[p];
|
|
76
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
77
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
78
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
79
|
+
t[p[i]] = s[p[i]];
|
|
80
|
+
}
|
|
81
|
+
return t;
|
|
82
|
+
};
|
|
72
83
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
84
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
85
|
if (ar || !(i in from)) {
|
|
@@ -82,7 +93,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
82
93
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
94
|
};
|
|
84
95
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
-
exports.NewTable = exports.handleGetEditableColumnTypes = exports.NEW_TABLE_GROUP_ROW_BATCH = void 0;
|
|
96
|
+
exports.NewTable = exports.handleGetEditableColumnTypes = exports.handleWriteColumnOptions = exports.handleReadColumnOptions = exports.NEW_TABLE_GROUP_ROW_BATCH = void 0;
|
|
86
97
|
var react_1 = require("@headlessui/react");
|
|
87
98
|
var solid_1 = require("@heroicons/react/20/solid");
|
|
88
99
|
var outline_1 = require("@heroicons/react/24/outline");
|
|
@@ -95,6 +106,10 @@ var textButton_1 = require("../../action/textButton");
|
|
|
95
106
|
var collapse_1 = require("../../advanced/collapse");
|
|
96
107
|
var popUp_1 = require("../../advanced/popUp");
|
|
97
108
|
var formula_1 = require("../../data/formula");
|
|
109
|
+
var buttonCell_1 = require("../../data/columnTypes/buttonCell");
|
|
110
|
+
var context_1 = require("../../data/columnTypes/context");
|
|
111
|
+
var dateRangeCell_1 = require("../../data/columnTypes/dateRangeCell");
|
|
112
|
+
var systemColumns_1 = require("../../data/columnTypes/systemColumns");
|
|
98
113
|
var builder_1 = require("../../data/formula/builder");
|
|
99
114
|
var readModule_1 = require("../../data/readModule");
|
|
100
115
|
var updateModule_1 = require("../../data/updateModule");
|
|
@@ -108,6 +123,7 @@ var loading_1 = require("../loading");
|
|
|
108
123
|
var modal_1 = require("../modal");
|
|
109
124
|
var newPagination_1 = require("../newPagination");
|
|
110
125
|
var scrollShadow_1 = require("../scrollShadow");
|
|
126
|
+
var columnWidth_1 = require("./columnWidth");
|
|
111
127
|
var tag_1 = require("../tag");
|
|
112
128
|
// INFO: rows a section draws before its "Show more" — a 2,000-row section
|
|
113
129
|
// would otherwise mount every row (and every cell's controls) at once
|
|
@@ -177,7 +193,7 @@ var MIN_COLUMN_WIDTH = 80;
|
|
|
177
193
|
// INFO: every field type the popup can finish. math has its own expression
|
|
178
194
|
// builder, and object/listObject need a nested schema the schema editor builds —
|
|
179
195
|
// creating either here would only ever produce a dead column.
|
|
180
|
-
var
|
|
196
|
+
var ALL_COLUMN_TYPES = [
|
|
181
197
|
{ key: "string", label: "Text" },
|
|
182
198
|
{ key: "textArea", label: "Long text" },
|
|
183
199
|
{ key: "markdown", label: "Markdown" },
|
|
@@ -210,7 +226,16 @@ var ADD_COLUMN_TYPES = [
|
|
|
210
226
|
{ key: "timeTracking", label: "Time tracking" },
|
|
211
227
|
{ key: "button", label: "Button" },
|
|
212
228
|
];
|
|
229
|
+
// INFO: never drawn as a table cell, so a column of these added from the
|
|
230
|
+
// table would be invisible the moment it was made; one that exists can still
|
|
231
|
+
// be renamed
|
|
232
|
+
var NON_ADDABLE_COLUMN_TYPES = ["listAddress", "ganttchart", "canvas"];
|
|
233
|
+
var ADD_COLUMN_TYPES = ALL_COLUMN_TYPES.filter(function (eachType) { return !NON_ADDABLE_COLUMN_TYPES.includes(eachType.key); });
|
|
213
234
|
var REFERENCE_TYPES = ["reference", "listReference", "referenceSelection"];
|
|
235
|
+
var BUTTON_COLOUR_OPTIONS = buttonCell_1.BUTTON_COLOURS.map(function (eachColour) { return ({
|
|
236
|
+
key: eachColour,
|
|
237
|
+
label: eachColour.charAt(0).toUpperCase() + eachColour.slice(1),
|
|
238
|
+
}); });
|
|
214
239
|
var LIST_TYPES = ["list", "multipleList"];
|
|
215
240
|
// INFO: asset columns need a storage path, which the consumer fills in from its
|
|
216
241
|
// own settings — nothing for the user to type
|
|
@@ -245,14 +270,75 @@ var REFERENCE_TARGET_KEYS = [
|
|
|
245
270
|
"referenceSort",
|
|
246
271
|
"referenceDependency",
|
|
247
272
|
];
|
|
248
|
-
|
|
249
|
-
var
|
|
250
|
-
|
|
251
|
-
return
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
273
|
+
var columnOptionKey = 0;
|
|
274
|
+
var handleNextOptionKey = function () {
|
|
275
|
+
columnOptionKey += 1;
|
|
276
|
+
return columnOptionKey;
|
|
277
|
+
};
|
|
278
|
+
var OPTION_COLOURS = [
|
|
279
|
+
"primary",
|
|
280
|
+
"red",
|
|
281
|
+
"blue",
|
|
282
|
+
"green",
|
|
283
|
+
"yellow",
|
|
284
|
+
"indigo",
|
|
285
|
+
"purple",
|
|
286
|
+
"lime",
|
|
287
|
+
"sky",
|
|
288
|
+
"pink",
|
|
289
|
+
"orange",
|
|
290
|
+
"dark",
|
|
291
|
+
];
|
|
292
|
+
// INFO: literal classes so Tailwind emits them
|
|
293
|
+
var OPTION_SWATCH_CLASS = {
|
|
294
|
+
"": "bg-white border-gray-300",
|
|
295
|
+
primary: "bg-primary-500 border-primary-500",
|
|
296
|
+
red: "bg-red-500 border-red-500",
|
|
297
|
+
blue: "bg-blue-500 border-blue-500",
|
|
298
|
+
green: "bg-green-500 border-green-500",
|
|
299
|
+
yellow: "bg-yellow-500 border-yellow-500",
|
|
300
|
+
indigo: "bg-indigo-500 border-indigo-500",
|
|
301
|
+
purple: "bg-purple-500 border-purple-500",
|
|
302
|
+
lime: "bg-lime-500 border-lime-500",
|
|
303
|
+
sky: "bg-sky-500 border-sky-500",
|
|
304
|
+
pink: "bg-pink-500 border-pink-500",
|
|
305
|
+
orange: "bg-orange-500 border-orange-500",
|
|
306
|
+
dark: "bg-gray-900 border-gray-900",
|
|
307
|
+
};
|
|
308
|
+
var handleReadColumnOptions = function (column) {
|
|
309
|
+
var _a;
|
|
310
|
+
return ((_a = column === null || column === void 0 ? void 0 : column.listSelection) !== null && _a !== void 0 ? _a : []).map(function (eachOption, index) {
|
|
311
|
+
var _a, _b, _c;
|
|
312
|
+
return ({
|
|
313
|
+
key: handleNextOptionKey(),
|
|
314
|
+
text: eachOption,
|
|
315
|
+
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 : "",
|
|
316
|
+
label: ((_c = column === null || column === void 0 ? void 0 : column.listSelectionLabel) === null || _c === void 0 ? void 0 : _c[index]) || undefined,
|
|
317
|
+
});
|
|
318
|
+
});
|
|
255
319
|
};
|
|
320
|
+
exports.handleReadColumnOptions = handleReadColumnOptions;
|
|
321
|
+
// INFO: options, colours and labels saved side by side, index for index; a
|
|
322
|
+
// column with no colour or label set carries no list of them
|
|
323
|
+
var handleWriteColumnOptions = function (column, rows) {
|
|
324
|
+
// INFO: a row left blank is not an option
|
|
325
|
+
var options = rows
|
|
326
|
+
.map(function (eachOption) { return (__assign(__assign({}, eachOption), { text: eachOption.text.trim() })); })
|
|
327
|
+
.filter(function (eachOption) { return eachOption.text; });
|
|
328
|
+
column.listSelection = options.map(function (eachOption) { return eachOption.text; });
|
|
329
|
+
var colours = options.map(function (eachOption) { var _a; return (_a = eachOption.colour) !== null && _a !== void 0 ? _a : ""; });
|
|
330
|
+
if (colours.some(Boolean))
|
|
331
|
+
column.listSelectionColour = colours;
|
|
332
|
+
else
|
|
333
|
+
delete column.listSelectionColour;
|
|
334
|
+
var labels = options.map(function (eachOption) { var _a; return (_a = eachOption.label) !== null && _a !== void 0 ? _a : ""; });
|
|
335
|
+
if (labels.some(Boolean))
|
|
336
|
+
column.listSelectionLabel = labels;
|
|
337
|
+
else
|
|
338
|
+
delete column.listSelectionLabel;
|
|
339
|
+
return column;
|
|
340
|
+
};
|
|
341
|
+
exports.handleWriteColumnOptions = handleWriteColumnOptions;
|
|
256
342
|
// INFO: the column's own type first, then those it may become
|
|
257
343
|
var handleGetEditableColumnTypes = function (type) {
|
|
258
344
|
var _a;
|
|
@@ -377,31 +463,41 @@ var NewTable = function (props) {
|
|
|
377
463
|
//=====================================================================================
|
|
378
464
|
var _4 = (0, react_2.useState)(""), filterModal = _4[0], setFilterModal = _4[1];
|
|
379
465
|
var _5 = (0, react_2.useState)(""), addColumnModal = _5[0], setAddColumnModal = _5[1];
|
|
466
|
+
// INFO: what a DataTemplate around the table lets a cell save
|
|
467
|
+
var columnTypeActions = (0, react_2.useContext)(context_1.ColumnTypeContext);
|
|
380
468
|
var _6 = (0, react_2.useState)(""), newColumnName = _6[0], setNewColumnName = _6[1];
|
|
381
469
|
var _7 = (0, react_2.useState)("string"), newColumnType = _7[0], setNewColumnType = _7[1];
|
|
382
470
|
var _8 = (0, react_2.useState)(""), newColumnRefSpace = _8[0], setNewColumnRefSpace = _8[1];
|
|
383
471
|
var _9 = (0, react_2.useState)(""), newColumnRefLabel = _9[0], setNewColumnRefLabel = _9[1];
|
|
384
|
-
var _10 = (0, react_2.useState)(
|
|
385
|
-
|
|
386
|
-
var
|
|
472
|
+
var _10 = (0, react_2.useState)([]), newColumnOptions = _10[0], setNewColumnOptions = _10[1];
|
|
473
|
+
// INFO: the option row whose colour palette is open
|
|
474
|
+
var _11 = (0, react_2.useState)(null), optionColourKey = _11[0], setOptionColourKey = _11[1];
|
|
475
|
+
var _12 = (0, react_2.useState)(false), newColumnRequired = _12[0], setNewColumnRequired = _12[1];
|
|
476
|
+
var _13 = (0, react_2.useState)(""), newColumnRatingMax = _13[0], setNewColumnRatingMax = _13[1];
|
|
477
|
+
var _14 = (0, react_2.useState)(""), newColumnButtonLabel = _14[0], setNewColumnButtonLabel = _14[1];
|
|
478
|
+
var _15 = (0, react_2.useState)(""), newColumnButtonColour = _15[0], setNewColumnButtonColour = _15[1];
|
|
479
|
+
var _16 = (0, react_2.useState)(""), newColumnButtonConfirm = _16[0], setNewColumnButtonConfirm = _16[1];
|
|
480
|
+
var _17 = (0, react_2.useState)(false), addingColumn = _17[0], setAddingColumn = _17[1];
|
|
387
481
|
// INFO: the formula as shown in the builder — column names, not ids
|
|
388
|
-
var
|
|
482
|
+
var _18 = (0, react_2.useState)(""), newColumnFormula = _18[0], setNewColumnFormula = _18[1];
|
|
389
483
|
var addColumnPopUpRef = (0, react_2.useRef)(null);
|
|
390
484
|
// INFO: the column being changed — empty while the panel adds a new one
|
|
391
|
-
var
|
|
485
|
+
var _19 = (0, react_2.useState)(null), editingColumn = _19[0], setEditingColumn = _19[1];
|
|
392
486
|
//=====================================================================================
|
|
393
487
|
// SECTION: Editable & Addable cells
|
|
394
488
|
//=====================================================================================
|
|
395
|
-
var
|
|
396
|
-
var
|
|
489
|
+
var _20 = (0, react_2.useState)(""), editDataRowId = _20[0], setEditDataRowId = _20[1];
|
|
490
|
+
var _21 = (0, react_2.useState)(""), editDataHeaderKey = _21[0], setEditDataHeaderKey = _21[1];
|
|
397
491
|
// INFO: an editable table used to mount an input in every cell — it read as a
|
|
398
492
|
// form, and a row click always landed on a child input. Only the hovered cell
|
|
399
493
|
// becomes its input now.
|
|
400
|
-
var
|
|
401
|
-
var
|
|
402
|
-
|
|
494
|
+
var _22 = (0, react_2.useState)(null), hoveredCell = _22[0], setHoveredCell = _22[1];
|
|
495
|
+
var _23 = (0, react_2.useState)(false), modalEditVisible = _23[0], setModalEditVisible = _23[1];
|
|
496
|
+
// INFO: whether the modal's signature pad has been drawn on
|
|
497
|
+
var _24 = (0, react_2.useState)(false), signatureSigning = _24[0], setSignatureSigning = _24[1];
|
|
498
|
+
var _25 = (0, react_2.useState)([]), collapsedGroupIds = _25[0], setCollapsedGroupIds = _25[1];
|
|
403
499
|
// INFO: rows shown per section when the sections do not page themselves
|
|
404
|
-
var
|
|
500
|
+
var _26 = (0, react_2.useState)({}), groupVisibleCounts = _26[0], setGroupVisibleCounts = _26[1];
|
|
405
501
|
// INFO: per-group scroll pagination. One sentinel element per band, observed
|
|
406
502
|
// by a single IntersectionObserver that fires props.onGroupLoadMore when a
|
|
407
503
|
// band's sentinel scrolls into view. The debounce guard stops repeat fires
|
|
@@ -417,25 +513,25 @@ var NewTable = function (props) {
|
|
|
417
513
|
var lastSelectedRowRef = (0, react_2.useRef)(null);
|
|
418
514
|
var dragSelectRef = (0, react_2.useRef)(null);
|
|
419
515
|
var suppressNextClickRef = (0, react_2.useRef)(false);
|
|
420
|
-
var
|
|
421
|
-
var
|
|
422
|
-
var
|
|
423
|
-
var
|
|
516
|
+
var _27 = (0, react_2.useState)(false), isDragSelecting = _27[0], setIsDragSelecting = _27[1];
|
|
517
|
+
var _28 = (0, react_2.useState)(0), copiedCount = _28[0], setCopiedCount = _28[1];
|
|
518
|
+
var _29 = (0, react_2.useState)({}), editDataValue = _29[0], setEditDataValue = _29[1];
|
|
519
|
+
var _30 = (0, react_2.useState)(false), editDataIsLoading = _30[0], setEditDataIsLoading = _30[1];
|
|
424
520
|
// INFO: true while the empty bottom row is being filled in; the row itself is
|
|
425
521
|
// always there in an addable table
|
|
426
|
-
var
|
|
427
|
-
var
|
|
522
|
+
var _31 = (0, react_2.useState)(false), addData = _31[0], setAddData = _31[1];
|
|
523
|
+
var _32 = (0, react_2.useState)({}), addDataValue = _32[0], setAddDataValue = _32[1];
|
|
428
524
|
// INFO: bumped after each saved row, so the next one starts with fresh
|
|
429
525
|
// inputs and its first cell takes the focus
|
|
430
|
-
var
|
|
431
|
-
var
|
|
526
|
+
var _33 = (0, react_2.useState)(0), addRowKey = _33[0], setAddRowKey = _33[1];
|
|
527
|
+
var _34 = (0, react_2.useState)({}), referencesOptions = _34[0], setReferencesOptions = _34[1];
|
|
432
528
|
// INFO: seeded options sit under the local map so a cell's own search
|
|
433
529
|
// results still win per key
|
|
434
530
|
var mergedReferencesOptions = __assign(__assign({}, ((_l = props.referencesOptions) !== null && _l !== void 0 ? _l : {})), referencesOptions);
|
|
435
|
-
var
|
|
436
|
-
var
|
|
531
|
+
var _35 = (0, react_2.useState)({}), referencesDetails = _35[0], setReferencesDetails = _35[1];
|
|
532
|
+
var _36 = (0, react_2.useState)(false), referenceLoading = _36[0], setReferenceLoading = _36[1];
|
|
437
533
|
// INFO: measured pixel widths for pinned columns without an explicit width.
|
|
438
|
-
var
|
|
534
|
+
var _37 = (0, react_2.useState)({}), measuredPinWidths = _37[0], setMeasuredPinWidths = _37[1];
|
|
439
535
|
var editDataValueRef = (0, react_2.useRef)({});
|
|
440
536
|
var editDataRowIdRef = (0, react_2.useRef)("");
|
|
441
537
|
var editDataHeaderKeyRef = (0, react_2.useRef)("");
|
|
@@ -807,7 +903,11 @@ var NewTable = function (props) {
|
|
|
807
903
|
commitAddRef.current = handleCommitAdd;
|
|
808
904
|
// INFO: a list column with a palette edits through the ordinary Select, whose
|
|
809
905
|
// options render as the same coloured tags — one dropdown for every cell
|
|
810
|
-
var handleColumnShowsTags = function (col) {
|
|
906
|
+
var handleColumnShowsTags = function (col) {
|
|
907
|
+
var _a;
|
|
908
|
+
return LIST_TYPES.includes((_a = col.type) !== null && _a !== void 0 ? _a : "string") &&
|
|
909
|
+
!!col.listSelectionColour;
|
|
910
|
+
};
|
|
811
911
|
var handleConvertColumnToDataStructure = function (cols) {
|
|
812
912
|
return cols.map(function (col) {
|
|
813
913
|
var _a;
|
|
@@ -927,6 +1027,7 @@ var NewTable = function (props) {
|
|
|
927
1027
|
};
|
|
928
1028
|
var handleModalEditClose = function () {
|
|
929
1029
|
setModalEditVisible(false);
|
|
1030
|
+
setSignatureSigning(false);
|
|
930
1031
|
editDataRowIdRef.current = "";
|
|
931
1032
|
editDataValueRef.current = {};
|
|
932
1033
|
setEditDataRowId("");
|
|
@@ -941,6 +1042,12 @@ var NewTable = function (props) {
|
|
|
941
1042
|
switch (_g.label) {
|
|
942
1043
|
case 0:
|
|
943
1044
|
columnId = editDataHeaderKey;
|
|
1045
|
+
return [4 /*yield*/, handleCheckFormInputRefs("edit")];
|
|
1046
|
+
case 1:
|
|
1047
|
+
// INFO: a signature hands over what was drawn only when its field is
|
|
1048
|
+
// checked, so the fields are checked before the value is read
|
|
1049
|
+
if (!(_g.sent()))
|
|
1050
|
+
return [2 /*return*/];
|
|
944
1051
|
value = editDataValueRef.current[columnId];
|
|
945
1052
|
isUntouchedFilesObj = value &&
|
|
946
1053
|
typeof value === "object" &&
|
|
@@ -950,12 +1057,12 @@ var NewTable = function (props) {
|
|
|
950
1057
|
((_d = (_c = value.remove) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) === 0 &&
|
|
951
1058
|
JSON.stringify(value.data) ===
|
|
952
1059
|
JSON.stringify((_f = (_e = originalDataRef.current) === null || _e === void 0 ? void 0 : _e[columnId]) !== null && _f !== void 0 ? _f : []);
|
|
953
|
-
if (!!isUntouchedFilesObj) return [3 /*break*/,
|
|
1060
|
+
if (!!isUntouchedFilesObj) return [3 /*break*/, 3];
|
|
954
1061
|
return [4 /*yield*/, handleEditDataOnBlur(columnId, editDataValueRef.current)];
|
|
955
|
-
case 1:
|
|
956
|
-
_g.sent();
|
|
957
|
-
_g.label = 2;
|
|
958
1062
|
case 2:
|
|
1063
|
+
_g.sent();
|
|
1064
|
+
_g.label = 3;
|
|
1065
|
+
case 3:
|
|
959
1066
|
handleModalEditClose();
|
|
960
1067
|
return [2 /*return*/];
|
|
961
1068
|
}
|
|
@@ -966,6 +1073,18 @@ var NewTable = function (props) {
|
|
|
966
1073
|
cloned[e.target.id] = e.target.value;
|
|
967
1074
|
handleUpdateChangeData(cloned);
|
|
968
1075
|
};
|
|
1076
|
+
var handleOnChangeMarkdown = function (id, value) {
|
|
1077
|
+
var cloned = handleGenerateClonedData();
|
|
1078
|
+
cloned[id] = value;
|
|
1079
|
+
handleUpdateChangeData(cloned);
|
|
1080
|
+
};
|
|
1081
|
+
// INFO: a drawn signature arrives as a data URL, uploaded by the save
|
|
1082
|
+
var handleSignatureComplete = function (dataURL, id) {
|
|
1083
|
+
var cloned = handleGenerateClonedData();
|
|
1084
|
+
if (dataURL)
|
|
1085
|
+
cloned[id] = dataURL;
|
|
1086
|
+
handleUpdateChangeData(cloned);
|
|
1087
|
+
};
|
|
969
1088
|
var handleOnChangeSelect = function (id, value) {
|
|
970
1089
|
var cloned = handleGenerateClonedData();
|
|
971
1090
|
cloned[id] = value;
|
|
@@ -1056,26 +1175,30 @@ var NewTable = function (props) {
|
|
|
1056
1175
|
}
|
|
1057
1176
|
});
|
|
1058
1177
|
}); };
|
|
1059
|
-
// INFO:
|
|
1060
|
-
//
|
|
1061
|
-
//
|
|
1062
|
-
// wins over the col.width
|
|
1063
|
-
|
|
1178
|
+
// INFO: the width of a column being dragged, keyed by column key, until the
|
|
1179
|
+
// drag is released — then a caller with onResizeColumn keeps it, otherwise
|
|
1180
|
+
// it stays here until the table unmounts. Tailwind cannot emit a runtime
|
|
1181
|
+
// w-[Npx], so a width drives an inline style and wins over the col.width
|
|
1182
|
+
// class.
|
|
1183
|
+
var _38 = (0, react_2.useState)({}), columnWidths = _38[0], setColumnWidths = _38[1];
|
|
1064
1184
|
var resizeRef = (0, react_2.useRef)(null);
|
|
1185
|
+
// INFO: a dragged width first, else the column's own fixed width in pixels
|
|
1186
|
+
// whatever form it is stored in ("180px", "w-[180px]", "w-48")
|
|
1187
|
+
var getColumnWidth = function (key) {
|
|
1188
|
+
if (columnWidths[key])
|
|
1189
|
+
return columnWidths[key];
|
|
1190
|
+
var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
|
|
1191
|
+
return (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
|
|
1192
|
+
};
|
|
1065
1193
|
// INFO: a consumer may deliberately set a column narrower than the default
|
|
1066
1194
|
// floor (a 40px icon column, say) — never force it wider than it was asked to
|
|
1067
1195
|
// be, so the floor drops to the configured width when that is smaller
|
|
1068
1196
|
var getColumnMinWidth = function (key) {
|
|
1069
1197
|
var col = flatColumns.find(function (eachCol) { return eachCol.key === key; });
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
return Math.min(MIN_COLUMN_WIDTH, parseInt(arbMatch[1], 10));
|
|
1075
|
-
var stdMatch = col.width.match(/w-(\d+)/);
|
|
1076
|
-
if (stdMatch)
|
|
1077
|
-
return Math.min(MIN_COLUMN_WIDTH, parseInt(stdMatch[1], 10) * 4);
|
|
1078
|
-
return MIN_COLUMN_WIDTH;
|
|
1198
|
+
var configured = (0, columnWidth_1.handleParseColumnWidth)(col === null || col === void 0 ? void 0 : col.width);
|
|
1199
|
+
return configured === undefined
|
|
1200
|
+
? MIN_COLUMN_WIDTH
|
|
1201
|
+
: Math.min(MIN_COLUMN_WIDTH, configured);
|
|
1079
1202
|
};
|
|
1080
1203
|
var handleResizeStart = function (event, key) {
|
|
1081
1204
|
var _a, _b, _c, _d, _e;
|
|
@@ -1096,8 +1219,23 @@ var NewTable = function (props) {
|
|
|
1096
1219
|
return (__assign(__assign({}, previous), (_a = {}, _a[resizing.key] = next, _a)));
|
|
1097
1220
|
});
|
|
1098
1221
|
};
|
|
1222
|
+
// INFO: reported once per drag, on release, and only when it moved
|
|
1099
1223
|
var handleResizeEnd = function () {
|
|
1224
|
+
var _a;
|
|
1225
|
+
var resizing = resizeRef.current;
|
|
1100
1226
|
resizeRef.current = null;
|
|
1227
|
+
if (!resizing || !((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.onResizeColumn))
|
|
1228
|
+
return;
|
|
1229
|
+
var width = columnWidths[resizing.key];
|
|
1230
|
+
if (!width || Math.round(width) === Math.round(resizing.startWidth))
|
|
1231
|
+
return;
|
|
1232
|
+
props.advSettings.onResizeColumn(resizing.key, Math.round(width));
|
|
1233
|
+
// INFO: the caller's width takes over in the same render, so a view
|
|
1234
|
+
// switched to later shows its own width rather than this drag's
|
|
1235
|
+
setColumnWidths(function (previous) {
|
|
1236
|
+
var _a = previous, _b = resizing.key, _released = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
1237
|
+
return rest;
|
|
1238
|
+
});
|
|
1101
1239
|
};
|
|
1102
1240
|
var handleDragStart = function (e, id) {
|
|
1103
1241
|
e.dataTransfer.setData("itemId", id);
|
|
@@ -1126,7 +1264,7 @@ var NewTable = function (props) {
|
|
|
1126
1264
|
});
|
|
1127
1265
|
};
|
|
1128
1266
|
var renderAddColumnPanel = function () {
|
|
1129
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
1267
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1130
1268
|
// INFO: a caller that renders its own form keeps full control; the
|
|
1131
1269
|
// built-in one only appears when it hands over onAddColumn instead
|
|
1132
1270
|
if ((_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.renderAddColumnElements)
|
|
@@ -1147,7 +1285,7 @@ var NewTable = function (props) {
|
|
|
1147
1285
|
react_2.default.createElement("span", { className: "font-mono font-medium" }, derivedId),
|
|
1148
1286
|
taken ? " — already used by another column" : "")) : ("The field id is generated from the name")))),
|
|
1149
1287
|
react_2.default.createElement(select_1.Select, { id: "newColumnType", label: "Type", value: newColumnType, darkMode: props.darkMode, options: editingColumn
|
|
1150
|
-
?
|
|
1288
|
+
? ALL_COLUMN_TYPES.filter(function (eachType) {
|
|
1151
1289
|
return (0, exports.handleGetEditableColumnTypes)(editingColumn.type).includes(eachType.key);
|
|
1152
1290
|
})
|
|
1153
1291
|
: ADD_COLUMN_TYPES, disabled: !!editingColumn &&
|
|
@@ -1170,15 +1308,14 @@ var NewTable = function (props) {
|
|
|
1170
1308
|
setNewColumnRefLabel("");
|
|
1171
1309
|
} }),
|
|
1172
1310
|
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); } }))),
|
|
1173
|
-
LIST_TYPES.includes(newColumnType) && (
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
}), 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 : ""); } })),
|
|
1311
|
+
LIST_TYPES.includes(newColumnType) && renderColumnOptions(),
|
|
1312
|
+
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 : ""); } })),
|
|
1313
|
+
newColumnType === "button" && (react_2.default.createElement(react_2.default.Fragment, null,
|
|
1314
|
+
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 : ""); } }),
|
|
1315
|
+
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); } }),
|
|
1316
|
+
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 : ""); } }))),
|
|
1180
1317
|
ASSET_TYPES.includes(newColumnType) && (react_2.default.createElement("p", { className: "-mt-2 text-xs text-gray-500" }, "Uploads are stored against this space automatically.")),
|
|
1181
|
-
newColumnType === "formula" && (react_2.default.createElement(builder_1.FormulaBuilder, { value: newColumnFormula, schema: handleGetFormulaSchema(), columnId: editingColumn === null || editingColumn === void 0 ? void 0 : editingColumn.id, previewRow: (
|
|
1318
|
+
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 })),
|
|
1182
1319
|
newColumnType !== "formula" && (react_2.default.createElement(checkbox_1.Checkbox, { id: "newColumnRequired",
|
|
1183
1320
|
// INFO: the checkbox itself is not a required field — without this it
|
|
1184
1321
|
// renders "Required *", which reads as a validation error on a toggle
|
|
@@ -1200,8 +1337,54 @@ var NewTable = function (props) {
|
|
|
1200
1337
|
addingColumn ||
|
|
1201
1338
|
!handleIsNewColumnReady(), onClick: handleSubmitNewColumn }))));
|
|
1202
1339
|
};
|
|
1340
|
+
var handleChangeOption = function (key, change) {
|
|
1341
|
+
return setNewColumnOptions(newColumnOptions.map(function (eachOption) {
|
|
1342
|
+
return eachOption.key === key ? __assign(__assign({}, eachOption), change) : eachOption;
|
|
1343
|
+
}));
|
|
1344
|
+
};
|
|
1345
|
+
var handleAddOption = function () {
|
|
1346
|
+
return setNewColumnOptions(__spreadArray(__spreadArray([], newColumnOptions, true), [
|
|
1347
|
+
{ key: handleNextOptionKey(), text: "", colour: "" },
|
|
1348
|
+
], false));
|
|
1349
|
+
};
|
|
1350
|
+
var handleRemoveOption = function (key) {
|
|
1351
|
+
setNewColumnOptions(newColumnOptions.filter(function (eachOption) { return eachOption.key !== key; }));
|
|
1352
|
+
setOptionColourKey(null);
|
|
1353
|
+
};
|
|
1354
|
+
// INFO: two options of one text could not be told apart in a cell
|
|
1355
|
+
var handleHasDuplicateOptions = function () {
|
|
1356
|
+
var texts = newColumnOptions
|
|
1357
|
+
.map(function (eachOption) { return eachOption.text.trim(); })
|
|
1358
|
+
.filter(Boolean);
|
|
1359
|
+
return new Set(texts).size !== texts.length;
|
|
1360
|
+
};
|
|
1361
|
+
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
|
|
1362
|
+
? "ring-2 ring-gray-500 ring-offset-1"
|
|
1363
|
+
: ""), onClick: function () {
|
|
1364
|
+
handleChangeOption(option.key, { colour: eachColour });
|
|
1365
|
+
setOptionColourKey(null);
|
|
1366
|
+
} })); }))); };
|
|
1367
|
+
var renderColumnOptions = function () { return (react_2.default.createElement("div", { className: "flex flex-col gap-y-2" },
|
|
1368
|
+
react_2.default.createElement("span", { className: "text-sm font-medium ".concat(props.darkMode ? "text-gray-200" : "text-gray-700") }, "Options"),
|
|
1369
|
+
newColumnOptions.map(function (eachOption, index) {
|
|
1370
|
+
var _a;
|
|
1371
|
+
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) },
|
|
1372
|
+
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
|
|
1373
|
+
? "border-gray-600 bg-gray-800 text-white"
|
|
1374
|
+
: "border-gray-300"), onChange: function (event) {
|
|
1375
|
+
return handleChangeOption(eachOption.key, { text: event.target.value });
|
|
1376
|
+
} }),
|
|
1377
|
+
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 () {
|
|
1378
|
+
return setOptionColourKey(optionColourKey === eachOption.key ? null : eachOption.key);
|
|
1379
|
+
} }),
|
|
1380
|
+
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); } },
|
|
1381
|
+
react_2.default.createElement(solid_2.XMarkIcon, { className: "h-4 w-4" })),
|
|
1382
|
+
optionColourKey === eachOption.key &&
|
|
1383
|
+
renderOptionColourPalette(eachOption, index)));
|
|
1384
|
+
}),
|
|
1385
|
+
react_2.default.createElement(textButton_1.TextButton, { text: "Add option", className: "self-start text-sm", onClick: handleAddOption }))); };
|
|
1203
1386
|
var handleEditColumnModal = function (columnId) {
|
|
1204
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1387
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1205
1388
|
var schema = (_b = (_a = props.advSettings) === null || _a === void 0 ? void 0 : _a.getColumnSchema) === null || _b === void 0 ? void 0 : _b.call(_a, columnId);
|
|
1206
1389
|
if (!schema)
|
|
1207
1390
|
return;
|
|
@@ -1210,13 +1393,24 @@ var NewTable = function (props) {
|
|
|
1210
1393
|
setNewColumnType((_d = schema.type) !== null && _d !== void 0 ? _d : "string");
|
|
1211
1394
|
setNewColumnRefSpace((_e = schema.referenceSpaceId) !== null && _e !== void 0 ? _e : "");
|
|
1212
1395
|
setNewColumnRefLabel((_f = schema.referenceLabel) !== null && _f !== void 0 ? _f : "");
|
|
1213
|
-
setNewColumnOptions(
|
|
1396
|
+
setNewColumnOptions((0, exports.handleReadColumnOptions)(schema));
|
|
1397
|
+
setOptionColourKey(null);
|
|
1214
1398
|
setNewColumnRequired(!schema.optional);
|
|
1399
|
+
setNewColumnRatingMax(schema.ratingMax ? String(schema.ratingMax) : "");
|
|
1400
|
+
setNewColumnButtonLabel((_g = schema.buttonLabel) !== null && _g !== void 0 ? _g : "");
|
|
1401
|
+
setNewColumnButtonColour((_h = schema.buttonColour) !== null && _h !== void 0 ? _h : "");
|
|
1402
|
+
setNewColumnButtonConfirm((_j = schema.buttonConfirm) !== null && _j !== void 0 ? _j : "");
|
|
1215
1403
|
setNewColumnFormula(schema.type === "formula"
|
|
1216
1404
|
? (0, formula_1.handleGetFormulaDisplay)(schema, handleGetFormulaSchema())
|
|
1217
1405
|
: "");
|
|
1218
1406
|
setAddColumnModal(columnId);
|
|
1219
1407
|
};
|
|
1408
|
+
var handleFitPanelToWindow = function (panel) {
|
|
1409
|
+
if (!panel)
|
|
1410
|
+
return;
|
|
1411
|
+
var top = panel.getBoundingClientRect().top;
|
|
1412
|
+
panel.style.maxHeight = "".concat(Math.max(240, window.innerHeight - top - 16), "px");
|
|
1413
|
+
};
|
|
1220
1414
|
var handleAddColumnModal = function (id) {
|
|
1221
1415
|
setAddColumnModal(id);
|
|
1222
1416
|
if (!id) {
|
|
@@ -1225,9 +1419,14 @@ var NewTable = function (props) {
|
|
|
1225
1419
|
setNewColumnType("string");
|
|
1226
1420
|
setNewColumnRefSpace("");
|
|
1227
1421
|
setNewColumnRefLabel("");
|
|
1228
|
-
setNewColumnOptions(
|
|
1422
|
+
setNewColumnOptions([]);
|
|
1423
|
+
setOptionColourKey(null);
|
|
1229
1424
|
setNewColumnRequired(false);
|
|
1230
1425
|
setNewColumnFormula("");
|
|
1426
|
+
setNewColumnRatingMax("");
|
|
1427
|
+
setNewColumnButtonLabel("");
|
|
1428
|
+
setNewColumnButtonColour("");
|
|
1429
|
+
setNewColumnButtonConfirm("");
|
|
1231
1430
|
}
|
|
1232
1431
|
};
|
|
1233
1432
|
// INFO: the stored field id is derived from what the user types rather than
|
|
@@ -1244,8 +1443,13 @@ var NewTable = function (props) {
|
|
|
1244
1443
|
.map(function (eachWord) { return eachWord.charAt(0).toUpperCase() + eachWord.slice(1); })
|
|
1245
1444
|
.join(""));
|
|
1246
1445
|
};
|
|
1446
|
+
// INFO: the record's key fields and the system columns are on every row
|
|
1447
|
+
// whether or not the table shows them, so a new column cannot claim them
|
|
1247
1448
|
var handleColumnIdTaken = function (id) {
|
|
1248
|
-
return
|
|
1449
|
+
return id === "id" ||
|
|
1450
|
+
id === "_id" ||
|
|
1451
|
+
(0, systemColumns_1.handleIsSystemColumn)(id) ||
|
|
1452
|
+
flatColumns.some(function (eachColumn) { return eachColumn.key === id; });
|
|
1249
1453
|
};
|
|
1250
1454
|
// INFO: every column a formula may read. The full model when the caller
|
|
1251
1455
|
// gives it — hidden columns are still on the row — else the shown columns.
|
|
@@ -1268,6 +1472,12 @@ var NewTable = function (props) {
|
|
|
1268
1472
|
// INFO: a reference with no target resolves nothing, so it cannot be saved
|
|
1269
1473
|
// half-built. Everything else is complete with a name and a type.
|
|
1270
1474
|
var handleIsNewColumnReady = function () {
|
|
1475
|
+
if (LIST_TYPES.includes(newColumnType) && handleHasDuplicateOptions())
|
|
1476
|
+
return false;
|
|
1477
|
+
if (newColumnType === "number" &&
|
|
1478
|
+
newColumnRatingMax.trim() &&
|
|
1479
|
+
handleParseRatingMax(newColumnRatingMax) === undefined)
|
|
1480
|
+
return false;
|
|
1271
1481
|
if (REFERENCE_TYPES.includes(newColumnType))
|
|
1272
1482
|
return !!newColumnRefSpace && !!newColumnRefLabel;
|
|
1273
1483
|
// INFO: an illegal formula would show "Error" in every row
|
|
@@ -1279,25 +1489,60 @@ var NewTable = function (props) {
|
|
|
1279
1489
|
}
|
|
1280
1490
|
return true;
|
|
1281
1491
|
};
|
|
1492
|
+
// INFO: a number column shows as stars only with a whole 1 to 10; blank
|
|
1493
|
+
// leaves it a plain number
|
|
1494
|
+
var handleParseRatingMax = function (value) {
|
|
1495
|
+
var parsed = Number(value);
|
|
1496
|
+
return value.trim() &&
|
|
1497
|
+
Number.isInteger(parsed) &&
|
|
1498
|
+
parsed >= 1 &&
|
|
1499
|
+
parsed <= buttonCell_1.MAX_RATING
|
|
1500
|
+
? parsed
|
|
1501
|
+
: undefined;
|
|
1502
|
+
};
|
|
1503
|
+
// INFO: the panel's rating and button settings on the column — kept only on
|
|
1504
|
+
// the type they belong to, and a blank one is left off rather than saved empty
|
|
1505
|
+
var handleApplyColumnSettings = function (column) {
|
|
1506
|
+
var ratingMax = newColumnType === "number"
|
|
1507
|
+
? handleParseRatingMax(newColumnRatingMax)
|
|
1508
|
+
: undefined;
|
|
1509
|
+
if (ratingMax)
|
|
1510
|
+
column.ratingMax = ratingMax;
|
|
1511
|
+
else
|
|
1512
|
+
delete column.ratingMax;
|
|
1513
|
+
var buttonSettings = [
|
|
1514
|
+
["buttonLabel", newColumnButtonLabel],
|
|
1515
|
+
["buttonColour", newColumnButtonColour],
|
|
1516
|
+
["buttonConfirm", newColumnButtonConfirm],
|
|
1517
|
+
];
|
|
1518
|
+
buttonSettings.forEach(function (_a) {
|
|
1519
|
+
var eachKey = _a[0], eachValue = _a[1];
|
|
1520
|
+
if (newColumnType === "button" && eachValue.trim())
|
|
1521
|
+
column[eachKey] = eachValue.trim();
|
|
1522
|
+
else
|
|
1523
|
+
delete column[eachKey];
|
|
1524
|
+
});
|
|
1525
|
+
return column;
|
|
1526
|
+
};
|
|
1282
1527
|
var handleSubmitNewColumn = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1283
1528
|
var id, column;
|
|
1284
|
-
var _a, _b;
|
|
1285
|
-
return __generator(this, function (
|
|
1286
|
-
switch (
|
|
1529
|
+
var _a, _b, _c;
|
|
1530
|
+
return __generator(this, function (_d) {
|
|
1531
|
+
switch (_d.label) {
|
|
1287
1532
|
case 0:
|
|
1288
1533
|
if (!editingColumn) return [3 /*break*/, 2];
|
|
1289
1534
|
return [4 /*yield*/, handleSubmitEditedColumn(editingColumn)];
|
|
1290
1535
|
case 1:
|
|
1291
|
-
|
|
1536
|
+
_d.sent();
|
|
1292
1537
|
return [2 /*return*/];
|
|
1293
1538
|
case 2:
|
|
1294
1539
|
id = handleDeriveColumnId(newColumnName);
|
|
1295
1540
|
if (!id || handleColumnIdTaken(id) || !handleIsNewColumnReady())
|
|
1296
1541
|
return [2 /*return*/];
|
|
1297
1542
|
setAddingColumn(true);
|
|
1298
|
-
|
|
1543
|
+
_d.label = 3;
|
|
1299
1544
|
case 3:
|
|
1300
|
-
|
|
1545
|
+
_d.trys.push([3, , 5, 6]);
|
|
1301
1546
|
column = {
|
|
1302
1547
|
id: id,
|
|
1303
1548
|
name: newColumnName.trim(),
|
|
@@ -1312,18 +1557,19 @@ var NewTable = function (props) {
|
|
|
1312
1557
|
column.referenceLabel = newColumnRefLabel;
|
|
1313
1558
|
}
|
|
1314
1559
|
if (LIST_TYPES.includes(newColumnType))
|
|
1315
|
-
column
|
|
1316
|
-
.split(",")
|
|
1317
|
-
.map(function (eachOption) { return eachOption.trim(); })
|
|
1318
|
-
.filter(Boolean);
|
|
1560
|
+
(0, exports.handleWriteColumnOptions)(column, newColumnOptions);
|
|
1319
1561
|
if (newColumnType === "formula") {
|
|
1320
1562
|
column.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1321
1563
|
column.optional = true;
|
|
1322
1564
|
}
|
|
1565
|
+
handleApplyColumnSettings(column);
|
|
1323
1566
|
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))];
|
|
1324
1567
|
case 4:
|
|
1325
|
-
|
|
1568
|
+
_d.sent();
|
|
1326
1569
|
handleAddColumnModal("");
|
|
1570
|
+
// INFO: the column is on the table now; the panel left open showed an
|
|
1571
|
+
// empty form that read as the add not having happened
|
|
1572
|
+
(_c = addColumnPopUpRef.current) === null || _c === void 0 ? void 0 : _c.handleOnClose();
|
|
1327
1573
|
return [3 /*break*/, 6];
|
|
1328
1574
|
case 5:
|
|
1329
1575
|
setAddingColumn(false);
|
|
@@ -1335,23 +1581,23 @@ var NewTable = function (props) {
|
|
|
1335
1581
|
// INFO: the column keeps everything the panel does not show; settings that
|
|
1336
1582
|
// belong to a type it no longer has are dropped with it
|
|
1337
1583
|
var handleSubmitEditedColumn = function (original) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1338
|
-
var
|
|
1339
|
-
var _a, _b, _c
|
|
1340
|
-
return __generator(this, function (
|
|
1341
|
-
switch (
|
|
1584
|
+
var source, column_1;
|
|
1585
|
+
var _a, _b, _c;
|
|
1586
|
+
return __generator(this, function (_d) {
|
|
1587
|
+
switch (_d.label) {
|
|
1342
1588
|
case 0:
|
|
1343
1589
|
if (!newColumnName.trim() || !handleIsNewColumnReady())
|
|
1344
1590
|
return [2 /*return*/];
|
|
1345
1591
|
setAddingColumn(true);
|
|
1346
|
-
|
|
1592
|
+
_d.label = 1;
|
|
1347
1593
|
case 1:
|
|
1348
|
-
|
|
1349
|
-
|
|
1594
|
+
_d.trys.push([1, , 3, 4]);
|
|
1595
|
+
source = original;
|
|
1350
1596
|
column_1 = __assign(__assign({}, original), { name: newColumnName.trim(), type: newColumnType, optional: !newColumnRequired });
|
|
1351
1597
|
if (newColumnType !== original.type)
|
|
1352
1598
|
((_a = TYPE_ONLY_KEYS[original.type]) !== null && _a !== void 0 ? _a : []).forEach(function (eachKey) { return delete column_1[eachKey]; });
|
|
1353
1599
|
if (REFERENCE_TYPES.includes(newColumnType)) {
|
|
1354
|
-
if (newColumnRefSpace !==
|
|
1600
|
+
if (newColumnRefSpace !== source.referenceSpaceId)
|
|
1355
1601
|
REFERENCE_TARGET_KEYS.forEach(function (eachKey) { return delete column_1[eachKey]; });
|
|
1356
1602
|
column_1.referenceSpaceId = newColumnRefSpace;
|
|
1357
1603
|
column_1.referenceLabel = newColumnRefLabel;
|
|
@@ -1362,25 +1608,7 @@ var NewTable = function (props) {
|
|
|
1362
1608
|
REFERENCE_TARGET_KEYS.forEach(function (eachKey) { return delete column_1[eachKey]; });
|
|
1363
1609
|
}
|
|
1364
1610
|
if (LIST_TYPES.includes(newColumnType)) {
|
|
1365
|
-
|
|
1366
|
-
// INFO: unchanged text keeps the stored options exactly — an option
|
|
1367
|
-
// holding a comma would otherwise come back split in two
|
|
1368
|
-
if (newColumnOptions !== handleJoinOptions(previous_1)) {
|
|
1369
|
-
next_1 = handleSplitOptions(newColumnOptions);
|
|
1370
|
-
column_1.listSelection = next_1;
|
|
1371
|
-
// INFO: colours and labels line up with the options by position, so
|
|
1372
|
-
// each follows its own option rather than the slot it sat in
|
|
1373
|
-
["listSelectionColour", "listSelectionLabel"].forEach(function (eachKey) {
|
|
1374
|
-
var values = source_1[eachKey];
|
|
1375
|
-
if (!values)
|
|
1376
|
-
return;
|
|
1377
|
-
var rebuilt = next_1.map(function (eachOption) { var _a; return (_a = values[previous_1.indexOf(eachOption)]) !== null && _a !== void 0 ? _a : ""; });
|
|
1378
|
-
if (rebuilt.some(Boolean))
|
|
1379
|
-
column_1[eachKey] = rebuilt;
|
|
1380
|
-
else
|
|
1381
|
-
delete column_1[eachKey];
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1611
|
+
(0, exports.handleWriteColumnOptions)(column_1, newColumnOptions);
|
|
1384
1612
|
}
|
|
1385
1613
|
else {
|
|
1386
1614
|
delete column_1.listSelection;
|
|
@@ -1391,9 +1619,10 @@ var NewTable = function (props) {
|
|
|
1391
1619
|
column_1.formulaExpression = (0, formula_1.handleFormulaToStorage)(newColumnFormula.trim(), handleGetFormulaSchema());
|
|
1392
1620
|
column_1.optional = true;
|
|
1393
1621
|
}
|
|
1394
|
-
|
|
1622
|
+
handleApplyColumnSettings(column_1);
|
|
1623
|
+
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))];
|
|
1395
1624
|
case 2:
|
|
1396
|
-
|
|
1625
|
+
_d.sent();
|
|
1397
1626
|
handleAddColumnModal("");
|
|
1398
1627
|
return [3 /*break*/, 4];
|
|
1399
1628
|
case 3:
|
|
@@ -1632,18 +1861,13 @@ var NewTable = function (props) {
|
|
|
1632
1861
|
// Falls back to measured DOM width for columns without explicit width.
|
|
1633
1862
|
var parsePinWidth = function (key) {
|
|
1634
1863
|
var _a;
|
|
1635
|
-
// INFO: a dragged width wins over the
|
|
1636
|
-
|
|
1637
|
-
|
|
1864
|
+
// INFO: a dragged or fixed width wins over the measured fallback
|
|
1865
|
+
var fixedWidth = getColumnWidth(key);
|
|
1866
|
+
if (fixedWidth)
|
|
1867
|
+
return fixedWidth;
|
|
1638
1868
|
var col = flatColumns.find(function (c) { return c.key === key; });
|
|
1639
1869
|
if (!(col === null || col === void 0 ? void 0 : col.width))
|
|
1640
1870
|
return (_a = measuredPinWidths[key]) !== null && _a !== void 0 ? _a : DEFAULT_PIN_WIDTH;
|
|
1641
|
-
var arbMatch = col.width.match(/\[(\d+)px\]/);
|
|
1642
|
-
if (arbMatch)
|
|
1643
|
-
return parseInt(arbMatch[1], 10);
|
|
1644
|
-
var stdMatch = col.width.match(/w-(\d+)/);
|
|
1645
|
-
if (stdMatch)
|
|
1646
|
-
return parseInt(stdMatch[1], 10) * 4;
|
|
1647
1871
|
return DEFAULT_PIN_WIDTH;
|
|
1648
1872
|
};
|
|
1649
1873
|
var style;
|
|
@@ -2035,7 +2259,7 @@ var NewTable = function (props) {
|
|
|
2035
2259
|
flatColumns.map(function (col, colIndex) {
|
|
2036
2260
|
var _a, _b, _c;
|
|
2037
2261
|
var renderDataCell = function () {
|
|
2038
|
-
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;
|
|
2262
|
+
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;
|
|
2039
2263
|
// INFO: a coloured list cell is this table's to render, so it takes
|
|
2040
2264
|
// the raw value even when a display row is supplied. The list view
|
|
2041
2265
|
// builds those rows and puts a Tag in for a coloured value — an
|
|
@@ -2043,12 +2267,25 @@ var NewTable = function (props) {
|
|
|
2043
2267
|
// the column came out as a pill that could not be edited in place.
|
|
2044
2268
|
// Only the cell is redirected: the display rows still carry the Tag
|
|
2045
2269
|
// for the read view, the kanban and the grid.
|
|
2046
|
-
var cellValue = spaceRow &&
|
|
2270
|
+
var cellValue = spaceRow &&
|
|
2271
|
+
!(handleColumnShowsTags(col) &&
|
|
2272
|
+
(col.type === "list" || ((_a = props.editable) === null || _a === void 0 ? void 0 : _a.active)))
|
|
2047
2273
|
? spaceRow[col.key]
|
|
2048
2274
|
: resolveValue(row, col.key);
|
|
2049
2275
|
// INFO: first col with type "string" is never made editable
|
|
2050
|
-
var resolvedColType = (
|
|
2276
|
+
var resolvedColType = (_b = col.type) !== null && _b !== void 0 ? _b : "string";
|
|
2051
2277
|
var isActionColumn = col.key === "update" && !col.type;
|
|
2278
|
+
// INFO: a timeline is picked in its cell, as stars and timers are
|
|
2279
|
+
// used there, by whoever may update the record
|
|
2280
|
+
if (resolvedColType === "dateRange" &&
|
|
2281
|
+
columnTypeActions.canUpdate &&
|
|
2282
|
+
columnTypeActions.onUpdateCell &&
|
|
2283
|
+
!col.disabled)
|
|
2284
|
+
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key,
|
|
2285
|
+
// INFO: no padding — the cell's own button carries it, so the
|
|
2286
|
+
// whole cell is the click target
|
|
2287
|
+
className: "!p-0 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 },
|
|
2288
|
+
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) })));
|
|
2052
2289
|
// INFO: a cell whose value is already a React element (row action
|
|
2053
2290
|
// buttons, a custom control) is rendered as-is even in an editable
|
|
2054
2291
|
// table — wrapping it in an inline editor would swallow it
|
|
@@ -2057,12 +2294,13 @@ var NewTable = function (props) {
|
|
|
2057
2294
|
// so it stays read-only in an editable table too — without this an
|
|
2058
2295
|
// admin-locked (often system-filled) column was editable on hover
|
|
2059
2296
|
var isColumnLocked = !!col.disabled;
|
|
2060
|
-
|
|
2297
|
+
// INFO: a thumbnail or a file name is still the cell of a modal
|
|
2298
|
+
// field — the click opens its editor rather than the record
|
|
2299
|
+
var isModalEdit = ((_g = props.editable) === null || _g === void 0 ? void 0 : _g.active) &&
|
|
2061
2300
|
!isColumnLocked &&
|
|
2062
2301
|
!isActionColumn &&
|
|
2063
|
-
!isElementCell &&
|
|
2064
2302
|
utils_1.supportedModalEditList.includes(resolvedColType);
|
|
2065
|
-
var isObjectEdit = ((
|
|
2303
|
+
var isObjectEdit = ((_h = props.editable) === null || _h === void 0 ? void 0 : _h.active) &&
|
|
2066
2304
|
!isColumnLocked &&
|
|
2067
2305
|
!isActionColumn &&
|
|
2068
2306
|
!isElementCell &&
|
|
@@ -2074,12 +2312,12 @@ var NewTable = function (props) {
|
|
|
2074
2312
|
cellValue !== null &&
|
|
2075
2313
|
!(cellValue instanceof Date) &&
|
|
2076
2314
|
utils_1.primitiveInlineEditList.includes(resolvedColType);
|
|
2077
|
-
var isEditable = ((
|
|
2315
|
+
var isEditable = ((_j = props.editable) === null || _j === void 0 ? void 0 : _j.active) &&
|
|
2078
2316
|
!isColumnLocked &&
|
|
2079
2317
|
!isActionColumn &&
|
|
2080
2318
|
!isElementCell &&
|
|
2081
2319
|
!isUneditableShape &&
|
|
2082
|
-
!(((
|
|
2320
|
+
!(((_l = (_k = props.selectedIds) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0) > 0 || props.selectAll) &&
|
|
2083
2321
|
utils_1.supportedInlineEditList.includes(resolvedColType);
|
|
2084
2322
|
var rowData = editDataRowId === row.id ? editDataValue : row;
|
|
2085
2323
|
// INFO: a list column with a palette paints the whole cell —
|
|
@@ -2092,17 +2330,17 @@ var NewTable = function (props) {
|
|
|
2092
2330
|
// INFO: an editable table renders the coloured cell as its Select in
|
|
2093
2331
|
// every row (filled while closed) so the control never swaps in and
|
|
2094
2332
|
// out; the plain block is for read-only tables and locked columns
|
|
2095
|
-
if (fillColour && (!((
|
|
2333
|
+
if (fillColour && (!((_m = props.editable) === null || _m === void 0 ? void 0 : _m.active) || isColumnLocked)) {
|
|
2096
2334
|
// INFO: a read-only table shows the same filled Select as an
|
|
2097
2335
|
// editable one, just disabled — the cell looks identical in both
|
|
2098
2336
|
// modes and the row click still navigates
|
|
2099
|
-
var readOnlyDS = __assign(__assign({}, col), { id: col.key, name: col.title, type: (
|
|
2337
|
+
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 });
|
|
2100
2338
|
// INFO: navigate on click only for a genuinely read-only table. This
|
|
2101
2339
|
// branch is ALSO entered for a locked column inside an EDITABLE
|
|
2102
2340
|
// table (isColumnLocked) — there a click must leave the Select alone,
|
|
2103
2341
|
// not navigate — so the overlay is gated on !editable.active.
|
|
2104
|
-
var shouldNavigateOnClick = !((
|
|
2105
|
-
return (react_2.default.createElement("td", { key: col.key, className: "p-0 align-middle ".concat((
|
|
2342
|
+
var shouldNavigateOnClick = !((_p = props.editable) === null || _p === void 0 ? void 0 : _p.active);
|
|
2343
|
+
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 },
|
|
2106
2344
|
react_2.default.createElement("div", { className: "relative w-max whitespace-nowrap p-[1px]" },
|
|
2107
2345
|
renderFormCell(row, readOnlyDS, null, {
|
|
2108
2346
|
active: true,
|
|
@@ -2124,7 +2362,7 @@ var NewTable = function (props) {
|
|
|
2124
2362
|
// INFO: share the column width source with the read-only/edit cell
|
|
2125
2363
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
2126
2364
|
// same column resolve to different widths and the column looks ragged
|
|
2127
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((
|
|
2365
|
+
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 },
|
|
2128
2366
|
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) {
|
|
2129
2367
|
var _a;
|
|
2130
2368
|
e.stopPropagation();
|
|
@@ -2141,7 +2379,7 @@ var NewTable = function (props) {
|
|
|
2141
2379
|
// INFO: share the column width source with the read-only/edit cell
|
|
2142
2380
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
2143
2381
|
// same column resolve to different widths and the column looks ragged
|
|
2144
|
-
className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(col.width ? "".concat(col.width, " flex-shrink-0") : getPinProps(col.key, false) ? "" : "whitespace-nowrap", " ").concat((
|
|
2382
|
+
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 },
|
|
2145
2383
|
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) {
|
|
2146
2384
|
e.stopPropagation();
|
|
2147
2385
|
handleModalEditOnClick(row.id, col.key, row);
|
|
@@ -2154,7 +2392,7 @@ var NewTable = function (props) {
|
|
|
2154
2392
|
// filled pill, so there is nothing to swap to.
|
|
2155
2393
|
if (isEditable &&
|
|
2156
2394
|
(handleColumnShowsTags(col) || handleIsCellLive(row.id, col.key))) {
|
|
2157
|
-
var bareOverride = (
|
|
2395
|
+
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);
|
|
2158
2396
|
if (!bareOverride)
|
|
2159
2397
|
return renderEditDataInputs(colIndex, col, rowData, row.id, rowBgClass, isRowHoverable);
|
|
2160
2398
|
}
|
|
@@ -2162,7 +2400,7 @@ var NewTable = function (props) {
|
|
|
2162
2400
|
// INFO: pinned columns use whitespace-normal so text wraps within the fixed width
|
|
2163
2401
|
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)
|
|
2164
2402
|
? col.key
|
|
2165
|
-
: 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((
|
|
2403
|
+
: 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))));
|
|
2166
2404
|
};
|
|
2167
2405
|
var cell = renderDataCell();
|
|
2168
2406
|
if (colIndex !== 0 || !props.onRowActivity)
|
|
@@ -2427,7 +2665,10 @@ var NewTable = function (props) {
|
|
|
2427
2665
|
// padding. The button (36px) then fits the 56px pinned width.
|
|
2428
2666
|
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 },
|
|
2429
2667
|
react_2.default.createElement("div", { className: "hidden flex-row items-center md:flex" },
|
|
2430
|
-
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:
|
|
2668
|
+
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:
|
|
2669
|
+
// INFO: a button or list column's settings run past a short
|
|
2670
|
+
// screen, so the panel ends at the window's edge and scrolls
|
|
2671
|
+
react_2.default.createElement("div", { ref: handleFitPanelToWindow, className: "w-80 overflow-y-auto p-4 normal-case tracking-normal" }, renderAddColumnPanel()) })),
|
|
2431
2672
|
react_2.default.createElement("div", { className: "flex flex-row items-center md:hidden" },
|
|
2432
2673
|
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"); } }))));
|
|
2433
2674
|
};
|
|
@@ -2445,14 +2686,14 @@ var NewTable = function (props) {
|
|
|
2445
2686
|
: undefined }, renderSelectAll())),
|
|
2446
2687
|
flatColumns.map(function (col) {
|
|
2447
2688
|
var _a, _b, _c, _d;
|
|
2448
|
-
return (react_2.default.createElement("th", { key: col.key, className: "group/th relative ".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: __assign(__assign({}, (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style), (
|
|
2689
|
+
return (react_2.default.createElement("th", { key: col.key, className: "group/th relative ".concat(cellPadding, " text-left text-xs font-semibold uppercase tracking-wide ").concat(cursorClassname, " ").concat((_b = (_a = getPinProps(col.key, true)) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ""), style: __assign(__assign({}, (_c = getPinProps(col.key, true)) === null || _c === void 0 ? void 0 : _c.style), (getColumnWidth(col.key)
|
|
2449
2690
|
? {
|
|
2450
|
-
width:
|
|
2451
|
-
minWidth:
|
|
2452
|
-
maxWidth:
|
|
2691
|
+
width: getColumnWidth(col.key),
|
|
2692
|
+
minWidth: getColumnWidth(col.key),
|
|
2693
|
+
maxWidth: getColumnWidth(col.key),
|
|
2453
2694
|
}
|
|
2454
2695
|
: {})), draggable: draggable, onDragStart: function (e) { return handleDragStart(e, col.key); }, onDrop: droppable ? function (e) { return handleDrop(e, col.key); } : undefined, onDragOver: handleDragOver },
|
|
2455
|
-
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat(
|
|
2696
|
+
react_2.default.createElement("div", { className: "group/header flex flex-row items-center ".concat(getColumnWidth(col.key) ? "" : ((_d = col.width) !== null && _d !== void 0 ? _d : "")) },
|
|
2456
2697
|
col.title,
|
|
2457
2698
|
renderHeaderIcons(col)),
|
|
2458
2699
|
react_2.default.createElement("span", { "data-testid": "table-column-resize-".concat(col.key), className: "group/grip absolute inset-y-0 -right-1 z-10 flex w-2 cursor-col-resize touch-none select-none items-stretch justify-center", draggable: false, onPointerDown: function (event) { return handleResizeStart(event, col.key); }, onPointerMove: handleResizeMove, onPointerUp: handleResizeEnd, onPointerCancel: handleResizeEnd, onClick: function (event) { return event.stopPropagation(); } },
|
|
@@ -2694,6 +2935,8 @@ var NewTable = function (props) {
|
|
|
2694
2935
|
handleOnChangeDate: handleOnChangeDate,
|
|
2695
2936
|
handleOnChangeFile: handleOnChangeFile,
|
|
2696
2937
|
handleOnChangeFiles: handleOnChangeFiles,
|
|
2938
|
+
handleOnChangeMarkdown: handleOnChangeMarkdown,
|
|
2939
|
+
handleSignatureComplete: handleSignatureComplete,
|
|
2697
2940
|
}, true, undefined, {
|
|
2698
2941
|
id: editDataRowId,
|
|
2699
2942
|
type: "list",
|
|
@@ -2711,7 +2954,7 @@ var NewTable = function (props) {
|
|
|
2711
2954
|
imageEndpoint: (_b = (_a = props.devSettings) === null || _a === void 0 ? void 0 : _a.imageEndpoint) !== null && _b !== void 0 ? _b : "",
|
|
2712
2955
|
imageBucketName: (_c = props.devSettings) === null || _c === void 0 ? void 0 : _c.bucketName,
|
|
2713
2956
|
maxFileSize: (_d = props.devSettings) === null || _d === void 0 ? void 0 : _d.maxFileSize,
|
|
2714
|
-
}),
|
|
2957
|
+
}, undefined, { signing: signatureSigning, setSigning: setSignatureSigning }),
|
|
2715
2958
|
react_2.default.createElement("div", { className: "flex justify-end gap-3", "data-testid": "table-modal-editor-actions" },
|
|
2716
2959
|
react_2.default.createElement(button_1.Button, { text: "Cancel", type: "light", onClick: handleModalEditClose }),
|
|
2717
2960
|
react_2.default.createElement(button_1.Button, { text: editDataIsLoading ? "Saving" : "Save", type: "normal", disable: editDataIsLoading, onClick: handleModalEditSave }))));
|