blixify-ui-web 1.3.1 → 1.3.3

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.
Files changed (26) hide show
  1. package/lib/components/data/dataTemplate/activityModal.d.ts.map +1 -1
  2. package/lib/components/data/dataTemplate/activityModal.js +33 -6
  3. package/lib/components/data/dataTemplate/activityModal.js.map +1 -1
  4. package/lib/components/data/dataTemplate/activityPerson.d.ts +28 -0
  5. package/lib/components/data/dataTemplate/activityPerson.d.ts.map +1 -0
  6. package/lib/components/data/dataTemplate/activityPerson.js +227 -0
  7. package/lib/components/data/dataTemplate/activityPerson.js.map +1 -0
  8. package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
  9. package/lib/components/data/dataTemplate/index.js +96 -2
  10. package/lib/components/data/dataTemplate/index.js.map +1 -1
  11. package/lib/components/data/dataTemplate/model.d.ts +2 -0
  12. package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
  13. package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +3 -0
  14. package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
  15. package/lib/components/data/dataTemplate/viewStatePersistence.js +18 -1
  16. package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
  17. package/lib/components/display/newTable/cellCopyButton.d.ts +12 -0
  18. package/lib/components/display/newTable/cellCopyButton.d.ts.map +1 -0
  19. package/lib/components/display/newTable/cellCopyButton.js +168 -0
  20. package/lib/components/display/newTable/cellCopyButton.js.map +1 -0
  21. package/lib/components/display/newTable/index.d.ts +1 -0
  22. package/lib/components/display/newTable/index.d.ts.map +1 -1
  23. package/lib/components/display/newTable/index.js +72 -5
  24. package/lib/components/display/newTable/index.js.map +1 -1
  25. package/lib/tail.css +2 -2
  26. package/package.json +1 -1
@@ -128,6 +128,7 @@ var modal_1 = require("../modal");
128
128
  var newPagination_1 = require("../newPagination");
129
129
  var recordActions_1 = require("../recordActions");
130
130
  var scrollShadow_1 = require("../scrollShadow");
131
+ var cellCopyButton_1 = require("./cellCopyButton");
131
132
  var columnMenu_1 = require("./columnMenu");
132
133
  var columnWidth_1 = require("./columnWidth");
133
134
  var columnWindow_1 = require("./columnWindow");
@@ -399,6 +400,18 @@ var TITLE_ACTIONS_PADDING_CLASS = {
399
400
  };
400
401
  // INFO: the eye's width plus its gap from the strips
401
402
  var EYE_ROOM = 40;
403
+ // INFO: types whose cell shows a formatted form of the stored value (a date's
404
+ // ISO string, a range object, a computed number). Their copy icon
405
+ // copies the text as shown; other types copy the full stored value, as their
406
+ // shown text can be cut short with "..." or carry an avatar's initials.
407
+ var COPY_AS_SHOWN_TYPES = [
408
+ "date",
409
+ "dateRange",
410
+ "math",
411
+ "formula",
412
+ "object",
413
+ "roles",
414
+ ];
402
415
  // INFO: the title text a narrowed title column always keeps beside its actions
403
416
  var MIN_TITLE_TEXT_WIDTH = 48;
404
417
  // INFO: the cell padding's left side (!px-6)
@@ -3354,6 +3367,50 @@ var NewTable = function (rawProps) {
3354
3367
  });
3355
3368
  } },
3356
3369
  react_2.default.createElement(solid_2.XMarkIcon, { className: "h-3.5 w-3.5", "aria-hidden": "true" }))); };
3370
+ // INFO: a filled cell's copy icon. It sits left of the cell's "x" when the
3371
+ // cell has one, and left of the title cell's row actions on the first column.
3372
+ var renderCellCopyButton = function (col, colIndex, row, spaceRow, hasClearButton, inline) {
3373
+ var _a, _b;
3374
+ if (inline === void 0) { inline = false; }
3375
+ if (props.enableCellCopy === false)
3376
+ return null;
3377
+ if (col.key === "update" && !col.type)
3378
+ return null;
3379
+ // INFO: a rating reads as stars and a timer as a running clock, so
3380
+ // neither is worth copying
3381
+ if (col.ratingMax || col.type === "timeTracking")
3382
+ return null;
3383
+ // INFO: a yes/no is too short to be worth copying, and markdown is left
3384
+ // out — its cell shows a one-line preview, not the body
3385
+ if (col.type === "boolean" || col.type === "markdown")
3386
+ return null;
3387
+ var rawValue = resolveValue(row, col.key);
3388
+ // INFO: an address is stored as { name, lat, lng } — its name is the
3389
+ // address as written
3390
+ var value = col.type === "address"
3391
+ ? typeof (rawValue === null || rawValue === void 0 ? void 0 : rawValue.name) === "string"
3392
+ ? rawValue.name
3393
+ : ""
3394
+ : resolveValueToString(col.key, spaceRow, row);
3395
+ // INFO: a display row that holds an element (a person's name for a user
3396
+ // id, a formatted date) is copied as shown — its stored value is an id or
3397
+ // a raw form the reader never sees. A list's chips are left out: drawn
3398
+ // side by side they read without commas, while its stored picks already
3399
+ // copy as "A, B". An address always copies its stored name.
3400
+ var fromDisplay = col.type !== "address" &&
3401
+ (COPY_AS_SHOWN_TYPES.includes((_a = col.type) !== null && _a !== void 0 ? _a : "string") ||
3402
+ (!LIST_TYPES.includes((_b = col.type) !== null && _b !== void 0 ? _b : "string") &&
3403
+ react_2.default.isValidElement(resolveValue(spaceRow, col.key))));
3404
+ var hasValue = fromDisplay
3405
+ ? !!value.trim() || !handleIsEmptyCellValue(rawValue)
3406
+ : !!value.trim();
3407
+ if (!hasValue)
3408
+ return null;
3409
+ var titleOffset = colIndex === 0 && hasRowActions
3410
+ ? titleStripsWidth + 4 + (props.onRowOpen ? EYE_ROOM : 0)
3411
+ : 6;
3412
+ return (react_2.default.createElement(cellCopyButton_1.CellCopyButton, { value: value, fromDisplay: fromDisplay, label: typeof col.title === "string" ? col.title : col.key, darkMode: props.darkMode, right: titleOffset + (hasClearButton ? 24 : 0), inline: inline }));
3413
+ };
3357
3414
  var renderActionStrip = function (testId, right, children) { return (react_2.default.createElement("div", { "data-testid": testId, className: "absolute inset-y-0 z-20 flex items-center justify-center border-l ".concat(borderColor), style: { right: right, width: ACTION_STRIP_WIDTH } }, children)); };
3358
3415
  var renderActivityButton = function (id, positioned) {
3359
3416
  var _a, _b;
@@ -4165,6 +4222,9 @@ var NewTable = function (rawProps) {
4165
4222
  react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
4166
4223
  }
4167
4224
  if (isModalEdit) {
4225
+ // INFO: of the modal-edited types, an address (its name) has
4226
+ // text to copy
4227
+ var isCopyableModalCell = resolvedColType === "address";
4168
4228
  return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) ||
4169
4229
  rightPinned.includes(col.key)
4170
4230
  ? col.key
@@ -4172,7 +4232,9 @@ var NewTable = function (rawProps) {
4172
4232
  // INFO: share the column width source with the read-only/edit cell
4173
4233
  // variants, otherwise an "Add" placeholder and a filled value in the
4174
4234
  // same column resolve to different widths and the column looks ragged
4175
- className: "".concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_y = (_x = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _x === void 0 ? void 0 : _x.className) !== null && _y !== void 0 ? _y : ""), style: (_z = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _z === void 0 ? void 0 : _z.style },
4235
+ // INFO: an address cell also carries the copy icon, shown
4236
+ // while the cell is hovered
4237
+ className: "".concat(isCopyableModalCell ? "group/copy" : "", " ").concat(cellPadding, " text-sm ").concat(cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat((_y = (_x = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _x === void 0 ? void 0 : _x.className) !== null && _y !== void 0 ? _y : ""), style: (_z = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _z === void 0 ? void 0 : _z.style },
4176
4238
  react_2.default.createElement("div", { className: "cursor-pointer group/modaledit flex items-center gap-x-2 min-h-6 ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), "data-testid": "table-modal-edit-".concat(col.key), onClick: function (e) {
4177
4239
  e.stopPropagation();
4178
4240
  handleModalEditOnClick(row.id, col.key, row);
@@ -4181,6 +4243,8 @@ var NewTable = function (rawProps) {
4181
4243
  // INFO: an empty cell under gridLines="all" is blank,
4182
4244
  // as every other empty cell of the grid is
4183
4245
  gridLines === "all" ? null : (react_2.default.createElement("span", { className: "text-gray-400 italic" }, "Add"))) : (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { className: "min-w-0 truncate", onlyWhenClipped: true }, (0, readModule_1.renderEachRowDataBasedOnDataType)(col.key, cellValue, props.bareSettings, true, props.disableEllipsisOnLongWord))),
4246
+ isCopyableModalCell &&
4247
+ renderCellCopyButton(col, colIndex, row, spaceRow, false, true),
4184
4248
  react_2.default.createElement(outline_1.PencilIcon, { className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" }))));
4185
4249
  }
4186
4250
  // INFO: a multi-select shows its picks as one line of tags until it is
@@ -4221,7 +4285,7 @@ var NewTable = function (rawProps) {
4221
4285
  var isTagClearable = gridLines === "all" &&
4222
4286
  !isLabelPickerColumn &&
4223
4287
  handleIsCellClearable(col, pickedValue, rowData);
4224
- return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": handleGetPinKey(col.key), className: "".concat(isTagClearable ? "group/clear ".concat(tagPinClass.includes("sticky") ? "" : "relative") : "", " ").concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(handleReadCellWidthClass(col), " text-sm ").concat(cellFontColor, " ").concat(tagPinClass, " ").concat(isPicking ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : ""), style: (_4 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _4 === void 0 ? void 0 : _4.style },
4288
+ return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": handleGetPinKey(col.key), className: "group/copy ".concat(tagPinClass.includes("sticky") ? "" : "relative", " ").concat(isTagClearable ? "group/clear" : "", " ").concat(editCellPadding, " ").concat(handleCellMinWidth(col.type), " ").concat(handleReadCellWidthClass(col), " text-sm ").concat(cellFontColor, " ").concat(tagPinClass, " ").concat(isPicking ? "!shadow-[inset_0_0_0_2px_#9ca3af]" : ""), style: (_4 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _4 === void 0 ? void 0 : _4.style },
4225
4289
  react_2.default.createElement("div", { "data-testid": "table-tag-line-".concat(col.key), role: "button", "aria-haspopup": isLabelPickerColumn ? "dialog" : undefined, "aria-expanded": isLabelPickerColumn ? isPicking : undefined, tabIndex: 0, "aria-label": "Edit ".concat(col.title), className: "flex h-[34px] cursor-pointer items-center gap-1 overflow-hidden whitespace-nowrap ".concat(handleIsReadCellFixed(col) ? "w-0 min-w-full" : ""), onClick: function (e) {
4226
4290
  e.stopPropagation();
4227
4291
  handleOpenCell_1(e.currentTarget);
@@ -4234,6 +4298,7 @@ var NewTable = function (rawProps) {
4234
4298
  } }, renderTagLine(col, isLabelPickerColumn ? pickedValue : cellValue)),
4235
4299
  isTagClearable &&
4236
4300
  renderClearCellButton(col, row.id, rowData, true),
4301
+ renderCellCopyButton(col, colIndex, row, spaceRow, isTagClearable),
4237
4302
  isPicking && labelPickerAnchor && (react_2.default.createElement(labelPicker_1.LabelPicker, { anchor: labelPickerAnchor, darkMode: props.darkMode, required: (0, updateModule_1.handleIsFieldRequired)(col, rowData), allowNewValue: !!col.listNewValue, options: ((_5 = col.listSelection) !== null && _5 !== void 0 ? _5 : []).map(function (key) { return ({
4238
4303
  key: String(key),
4239
4304
  color: handleGetListColour(col, key),
@@ -4293,7 +4358,7 @@ var NewTable = function (rawProps) {
4293
4358
  !isActionColumn;
4294
4359
  var readCell = (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) || rightPinned.includes(col.key)
4295
4360
  ? col.key
4296
- : undefined, className: "".concat(isReadClearable ? "group/clear ".concat(readPinClass.includes("sticky") ? "" : "relative") : "", " ").concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " ").concat(isLockedGridCell ? "cursor-default" : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat(readPinClass), style: (_12 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _12 === void 0 ? void 0 : _12.style, "data-row-link-cell": props.newTabUrl && props.onClickRow && !isLockedGridCell
4361
+ : undefined, className: "group/copy ".concat(readPinClass.includes("sticky") ? "" : "relative", " ").concat(isReadClearable ? "group/clear" : "", " ").concat(cellPadding, " ").concat(isEditable ? "".concat(editCellMinHeight, " align-middle ").concat(handleCellMinWidth(col.type)) : "", " ").concat(isLockedGridCell ? "cursor-default" : "", " text-sm ").concat(colIndex === 0 && props.onClickRow ? titleFontColor : cellFontColor, " ").concat(handleReadCellWidthClass(col), " ").concat(readPinClass), style: (_12 = getPinProps(col.key, false, rowBgClass, isRowHoverable)) === null || _12 === void 0 ? void 0 : _12.style, "data-row-link-cell": props.newTabUrl && props.onClickRow && !isLockedGridCell
4297
4362
  ? ""
4298
4363
  : undefined, "data-cell-locked": isLockedGridCell ? "" : undefined,
4299
4364
  // INFO: bubble phase, so a button in the cell (the title's
@@ -4325,9 +4390,11 @@ var NewTable = function (rawProps) {
4325
4390
  });
4326
4391
  }
4327
4392
  : undefined },
4328
- handleIsReadCellFixed(col) ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { as: "div", className: "w-0 min-w-full truncate", onlyWhenClipped: true }, renderReadCellValue(col, row, cellValue, isLockedGridCell, spaceRow))) : (renderReadCellValue(col, row, cellValue, isLockedGridCell, spaceRow)),
4393
+ handleIsReadCellFixed(col) ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { as: "div", className: "w-0 min-w-full truncate", onlyWhenClipped: true },
4394
+ react_2.default.createElement("span", { "data-cell-value": "", className: "contents" }, renderReadCellValue(col, row, cellValue, isLockedGridCell, spaceRow)))) : (react_2.default.createElement("span", { "data-cell-value": "", className: "contents" }, renderReadCellValue(col, row, cellValue, isLockedGridCell, spaceRow))),
4329
4395
  isReadClearable &&
4330
- renderClearCellButton(col, row.id, rowData, true)));
4396
+ renderClearCellButton(col, row.id, rowData, true),
4397
+ renderCellCopyButton(col, colIndex, row, spaceRow, !!isReadClearable)));
4331
4398
  if (!isEditable || bareOverride)
4332
4399
  return readCell;
4333
4400
  if (isClickToEditCell)