blixify-ui-web 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/action/iconButton/index.d.ts +1 -0
- package/lib/components/action/iconButton/index.d.ts.map +1 -1
- package/lib/components/action/iconButton/index.js +14 -1
- package/lib/components/action/iconButton/index.js.map +1 -1
- package/lib/components/data/dataTemplate/chartView.d.ts +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +96 -2
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts +3 -0
- package/lib/components/data/dataTemplate/viewStatePersistence.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js +18 -1
- package/lib/components/data/dataTemplate/viewStatePersistence.js.map +1 -1
- package/lib/components/display/hoverTooltip/index.d.ts +1 -0
- package/lib/components/display/hoverTooltip/index.d.ts.map +1 -1
- package/lib/components/display/hoverTooltip/index.js +27 -6
- package/lib/components/display/hoverTooltip/index.js.map +1 -1
- package/lib/components/display/modal/hotkey.d.ts +14 -0
- package/lib/components/display/modal/hotkey.d.ts.map +1 -0
- package/lib/components/display/modal/hotkey.js +61 -0
- package/lib/components/display/modal/hotkey.js.map +1 -0
- package/lib/components/display/modal/index.d.ts +17 -2
- package/lib/components/display/modal/index.d.ts.map +1 -1
- package/lib/components/display/modal/index.js +64 -3
- package/lib/components/display/modal/index.js.map +1 -1
- package/lib/components/display/newTable/cellCopyButton.d.ts +12 -0
- package/lib/components/display/newTable/cellCopyButton.d.ts.map +1 -0
- package/lib/components/display/newTable/cellCopyButton.js +173 -0
- package/lib/components/display/newTable/cellCopyButton.js.map +1 -0
- package/lib/components/display/newTable/index.d.ts +1 -0
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +102 -26
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/tail.css +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.CellCopyButton = void 0;
|
|
63
|
+
var outline_1 = require("@heroicons/react/24/outline");
|
|
64
|
+
var react_1 = __importStar(require("react"));
|
|
65
|
+
var hoverTooltip_1 = require("../hoverTooltip");
|
|
66
|
+
// INFO: the field takes the focus to be selected, so the focus goes back to
|
|
67
|
+
// where it was after — an open editor elsewhere would save on losing it
|
|
68
|
+
var handleCopyByCommand = function (value) {
|
|
69
|
+
var _a;
|
|
70
|
+
var focused = document.activeElement;
|
|
71
|
+
var field = document.createElement("textarea");
|
|
72
|
+
field.value = value;
|
|
73
|
+
field.setAttribute("readonly", "");
|
|
74
|
+
field.style.position = "fixed";
|
|
75
|
+
field.style.opacity = "0";
|
|
76
|
+
document.body.appendChild(field);
|
|
77
|
+
field.select();
|
|
78
|
+
try {
|
|
79
|
+
return document.execCommand("copy");
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
document.body.removeChild(field);
|
|
86
|
+
(_a = focused === null || focused === void 0 ? void 0 : focused.focus) === null || _a === void 0 ? void 0 : _a.call(focused, { preventScroll: true });
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// INFO: the text a cell shows, read from a copy of it: avatar initials and
|
|
90
|
+
// other aria-hidden decoration dropped, and a value cut short with "..." put
|
|
91
|
+
// back whole from its data-full-text. The copy is laid out off screen so its
|
|
92
|
+
// innerText keeps the breaks between blocks, which become spaces.
|
|
93
|
+
var handleShownText = function (shown) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
var clone = shown.cloneNode(true);
|
|
96
|
+
clone
|
|
97
|
+
.querySelectorAll('[aria-hidden="true"]')
|
|
98
|
+
.forEach(function (each) { return each.remove(); });
|
|
99
|
+
clone.querySelectorAll("[data-full-text]").forEach(function (each) {
|
|
100
|
+
var _a;
|
|
101
|
+
each.textContent = (_a = each.dataset.fullText) !== null && _a !== void 0 ? _a : each.textContent;
|
|
102
|
+
});
|
|
103
|
+
clone.className = "";
|
|
104
|
+
clone.style.cssText = "position:fixed;left:-9999px;top:0;";
|
|
105
|
+
document.body.appendChild(clone);
|
|
106
|
+
// INFO: innerText is undefined where nothing is laid out (jsdom)
|
|
107
|
+
var text = (_b = (_a = clone.innerText) !== null && _a !== void 0 ? _a : clone.textContent) !== null && _b !== void 0 ? _b : "";
|
|
108
|
+
document.body.removeChild(clone);
|
|
109
|
+
return text.replace(/\s*\n\s*/g, " ").trim();
|
|
110
|
+
};
|
|
111
|
+
// INFO: a cell's copy icon, shown while a mouse hovers the cell (group/copy on
|
|
112
|
+
// the <td>). It keeps its own "copied" state so a click redraws this button
|
|
113
|
+
// alone, not the table. Its click stops at the button, so it neither opens the
|
|
114
|
+
// cell's editor nor the row's read view.
|
|
115
|
+
var CellCopyButton = function (props) {
|
|
116
|
+
var _a;
|
|
117
|
+
var _b = (0, react_1.useState)(false), copied = _b[0], setCopied = _b[1];
|
|
118
|
+
var timerRef = (0, react_1.useRef)(undefined);
|
|
119
|
+
(0, react_1.useEffect)(function () { return function () { return clearTimeout(timerRef.current); }; }, []);
|
|
120
|
+
var handleCopy = function (button) { return __awaiter(void 0, void 0, void 0, function () {
|
|
121
|
+
var shownCell, shown, text, done, err_1;
|
|
122
|
+
var _a;
|
|
123
|
+
return __generator(this, function (_b) {
|
|
124
|
+
switch (_b.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
shownCell = props.fromDisplay
|
|
127
|
+
? (_a = button.closest("td")) === null || _a === void 0 ? void 0 : _a.querySelector("[data-cell-value]")
|
|
128
|
+
: null;
|
|
129
|
+
shown = shownCell ? handleShownText(shownCell) : "";
|
|
130
|
+
text = shown || props.value;
|
|
131
|
+
done = false;
|
|
132
|
+
_b.label = 1;
|
|
133
|
+
case 1:
|
|
134
|
+
_b.trys.push([1, 3, , 4]);
|
|
135
|
+
return [4 /*yield*/, navigator.clipboard.writeText(text)];
|
|
136
|
+
case 2:
|
|
137
|
+
_b.sent();
|
|
138
|
+
done = true;
|
|
139
|
+
return [3 /*break*/, 4];
|
|
140
|
+
case 3:
|
|
141
|
+
err_1 = _b.sent();
|
|
142
|
+
// INFO: the Clipboard API is refused in an insecure context or an
|
|
143
|
+
// iframe without clipboard-write (Storybook, an embedded app) — the
|
|
144
|
+
// older copy command still works from a click there
|
|
145
|
+
done = handleCopyByCommand(text);
|
|
146
|
+
return [3 /*break*/, 4];
|
|
147
|
+
case 4:
|
|
148
|
+
if (!done)
|
|
149
|
+
return [2 /*return*/];
|
|
150
|
+
setCopied(true);
|
|
151
|
+
clearTimeout(timerRef.current);
|
|
152
|
+
timerRef.current = setTimeout(function () { return setCopied(false); }, 1500);
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); };
|
|
157
|
+
var Icon = copied ? outline_1.CheckIcon : outline_1.DocumentDuplicateIcon;
|
|
158
|
+
// INFO: the tooltip's wrapper takes the button's place — pinned to the
|
|
159
|
+
// cell's edge and shown on the cell's hover — so the tooltip anchors on the
|
|
160
|
+
// icon itself, not on an empty wrapper beside it
|
|
161
|
+
return (react_1.default.createElement(hoverTooltip_1.HoverTooltip, { text: copied ? "Copied" : "Copy", className: "".concat(props.inline ? "flex flex-shrink-0 ".concat(copied ? "" : "invisible [@media(hover:hover)_and_(pointer:fine)]:group-hover/copy:visible") : "absolute top-1/2 z-[3] -translate-y-1/2 ".concat(copied ? "flex" : "hidden [@media(hover:hover)_and_(pointer:fine)]:group-hover/copy:flex")), style: props.inline ? undefined : { right: (_a = props.right) !== null && _a !== void 0 ? _a : 6 } },
|
|
162
|
+
react_1.default.createElement("button", { type: "button", "aria-label": copied ? "Copied" : "Copy ".concat(props.label), "data-testid": "cell-copy", className: "flex h-5 w-5 items-center justify-center rounded ".concat(props.darkMode ? "bg-gray-700 text-gray-300 hover:bg-gray-600" : "bg-gray-100 text-gray-500 hover:bg-gray-200", " ").concat(copied ? (props.darkMode ? "!text-green-400" : "!text-green-600") : ""),
|
|
163
|
+
// INFO: keeps the focus where it is, so an open editor elsewhere is
|
|
164
|
+
// not blurred by the click
|
|
165
|
+
onMouseDown: function (e) { return e.preventDefault(); }, onClick: function (e) {
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
handleCopy(e.currentTarget);
|
|
169
|
+
} },
|
|
170
|
+
react_1.default.createElement(Icon, { className: "h-3.5 w-3.5", "aria-hidden": "true" }))));
|
|
171
|
+
};
|
|
172
|
+
exports.CellCopyButton = CellCopyButton;
|
|
173
|
+
//# sourceMappingURL=cellCopyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cellCopyButton.js","sourceRoot":"","sources":["../../../../src/components/display/newTable/cellCopyButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA+E;AAC/E,6CAA2D;AAC3D,gDAA+C;AAqB/C,4EAA4E;AAC5E,wEAAwE;AACxE,IAAM,mBAAmB,GAAG,UAAC,KAAa;;IACxC,IAAM,OAAO,GAAG,QAAQ,CAAC,aAAmC,CAAC;IAC7D,IAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACjD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACnC,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC/B,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,KAAK,CAAC,MAAM,EAAE,CAAC;IACf,IAAI,CAAC;QACH,OAAO,QAA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,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAC9B,CAAC;YAED,8BAAC,IAAI,IAAC,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,CAC5C,CACI,CAChB,CAAC;AACJ,CAAC,CAAC;AAxDW,QAAA,cAAc,kBAwDzB"}
|
|
@@ -173,6 +173,7 @@ export interface NewTableProps extends LinkProps, DeleteableProps, EditableProps
|
|
|
173
173
|
};
|
|
174
174
|
onMoveRowToGroup?: (rowId: string, groupId: string) => void | Promise<void>;
|
|
175
175
|
enableCopy?: boolean;
|
|
176
|
+
enableCellCopy?: boolean;
|
|
176
177
|
gridLines?: NewTableGridLines;
|
|
177
178
|
}
|
|
178
179
|
export type NewTableGridLines = "horizontal" | "all";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/display/newTable/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,EACZ,YAAY,EAQb,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EACZ,MAAM,+BAA+B,CAAC;AAiBvC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAe5C,OAAO,EAAc,MAAM,EAAU,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAQ,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAiBvD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/display/newTable/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,EACZ,YAAY,EAQb,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EACZ,MAAM,+BAA+B,CAAC;AAiBvC,OAAO,EAAE,IAAI,EAAE,MAAM,s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AAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAyBD,eAAO,MAAM,uBAAuB,WAAY,GAAG,KAAG,YAAY,EAM7D,CAAC;AAIN,eAAO,MAAM,wBAAwB,WAAY,GAAG,QAAQ,YAAY,EAAE,QAazE,CAAC;AAGF,eAAO,MAAM,4BAA4B,SAAU,MAAM,aAGxD,CAAC;AA6LF,eAAO,MAAM,QAAQ,aAAc,aAAa,sBAwjN/C,CAAC"}
|
|
@@ -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)
|
|
@@ -3344,16 +3357,64 @@ var NewTable = function (rawProps) {
|
|
|
3344
3357
|
// has no hover to reveal the button by. On a cell that is read it shows while
|
|
3345
3358
|
// the cell is hovered; on an open text, number or date field it stays, over
|
|
3346
3359
|
// the field's right edge.
|
|
3347
|
-
var renderClearCellButton = function (col, rowId, rowData, onHover) { return (
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
})
|
|
3355
|
-
|
|
3356
|
-
|
|
3360
|
+
var renderClearCellButton = function (col, rowId, rowData, onHover) { return (
|
|
3361
|
+
// INFO: the tooltip's wrapper is pinned to the cell's edge in the button's
|
|
3362
|
+
// place, so the tooltip points at the "x"
|
|
3363
|
+
react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: "Clear", className: "absolute right-1.5 top-1/2 z-[3] hidden -translate-y-1/2 ".concat(onHover ? "[@media(hover:hover)_and_(pointer:fine)]:group-hover/clear:flex" : "[@media(hover:hover)_and_(pointer:fine)]:flex") },
|
|
3364
|
+
react_2.default.createElement("button", { type: "button", "aria-label": "Clear ".concat(typeof col.title === "string" ? col.title : col.key), "data-testid": "cell-clear", className: "flex h-5 w-5 items-center justify-center rounded ".concat(props.darkMode ? "bg-gray-700 text-gray-300 hover:bg-gray-600" : "bg-gray-100 text-gray-500 hover:bg-gray-200"),
|
|
3365
|
+
// INFO: a field being typed in keeps its focus, or its blur would save
|
|
3366
|
+
// the value being cleared and close the cell under the click
|
|
3367
|
+
onMouseDown: function (e) { return e.preventDefault(); }, onClick: function (e) {
|
|
3368
|
+
e.stopPropagation();
|
|
3369
|
+
handleOpenAfterLeaving(e.currentTarget, function () {
|
|
3370
|
+
handleClearCell(rowId, col, rowData);
|
|
3371
|
+
});
|
|
3372
|
+
} },
|
|
3373
|
+
react_2.default.createElement(solid_2.XMarkIcon, { className: "h-3.5 w-3.5", "aria-hidden": "true" })))); };
|
|
3374
|
+
// INFO: a filled cell's copy icon. It sits left of the cell's "x" when the
|
|
3375
|
+
// cell has one, and left of the title cell's row actions on the first column.
|
|
3376
|
+
var renderCellCopyButton = function (col, colIndex, row, spaceRow, hasClearButton, inline) {
|
|
3377
|
+
var _a, _b;
|
|
3378
|
+
if (inline === void 0) { inline = false; }
|
|
3379
|
+
if (props.enableCellCopy === false)
|
|
3380
|
+
return null;
|
|
3381
|
+
if (col.key === "update" && !col.type)
|
|
3382
|
+
return null;
|
|
3383
|
+
// INFO: a rating reads as stars and a timer as a running clock, so
|
|
3384
|
+
// neither is worth copying
|
|
3385
|
+
if (col.ratingMax || col.type === "timeTracking")
|
|
3386
|
+
return null;
|
|
3387
|
+
// INFO: a yes/no is too short to be worth copying, and markdown is left
|
|
3388
|
+
// out — its cell shows a one-line preview, not the body
|
|
3389
|
+
if (col.type === "boolean" || col.type === "markdown")
|
|
3390
|
+
return null;
|
|
3391
|
+
var rawValue = resolveValue(row, col.key);
|
|
3392
|
+
// INFO: an address is stored as { name, lat, lng } — its name is the
|
|
3393
|
+
// address as written
|
|
3394
|
+
var value = col.type === "address"
|
|
3395
|
+
? typeof (rawValue === null || rawValue === void 0 ? void 0 : rawValue.name) === "string"
|
|
3396
|
+
? rawValue.name
|
|
3397
|
+
: ""
|
|
3398
|
+
: resolveValueToString(col.key, spaceRow, row);
|
|
3399
|
+
// INFO: a display row that holds an element (a person's name for a user
|
|
3400
|
+
// id, a formatted date) is copied as shown — its stored value is an id or
|
|
3401
|
+
// a raw form the reader never sees. A list's chips are left out: drawn
|
|
3402
|
+
// side by side they read without commas, while its stored picks already
|
|
3403
|
+
// copy as "A, B". An address always copies its stored name.
|
|
3404
|
+
var fromDisplay = col.type !== "address" &&
|
|
3405
|
+
(COPY_AS_SHOWN_TYPES.includes((_a = col.type) !== null && _a !== void 0 ? _a : "string") ||
|
|
3406
|
+
(!LIST_TYPES.includes((_b = col.type) !== null && _b !== void 0 ? _b : "string") &&
|
|
3407
|
+
react_2.default.isValidElement(resolveValue(spaceRow, col.key))));
|
|
3408
|
+
var hasValue = fromDisplay
|
|
3409
|
+
? !!value.trim() || !handleIsEmptyCellValue(rawValue)
|
|
3410
|
+
: !!value.trim();
|
|
3411
|
+
if (!hasValue)
|
|
3412
|
+
return null;
|
|
3413
|
+
var titleOffset = colIndex === 0 && hasRowActions
|
|
3414
|
+
? titleStripsWidth + 4 + (props.onRowOpen ? EYE_ROOM : 0)
|
|
3415
|
+
: 6;
|
|
3416
|
+
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 }));
|
|
3417
|
+
};
|
|
3357
3418
|
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
3419
|
var renderActivityButton = function (id, positioned) {
|
|
3359
3420
|
var _a, _b;
|
|
@@ -3453,13 +3514,14 @@ var NewTable = function (rawProps) {
|
|
|
3453
3514
|
var _a;
|
|
3454
3515
|
if (!((_a = props.deleteable) === null || _a === void 0 ? void 0 : _a.active))
|
|
3455
3516
|
return null;
|
|
3456
|
-
return (react_2.default.createElement(
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3517
|
+
return (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: "Delete row", className: "inline-flex" },
|
|
3518
|
+
react_2.default.createElement("button", { type: "button", "aria-label": "Delete row", onClick: function (e) {
|
|
3519
|
+
var _a;
|
|
3520
|
+
e.preventDefault();
|
|
3521
|
+
e.stopPropagation();
|
|
3522
|
+
(_a = props.deleteable) === null || _a === void 0 ? void 0 : _a.onDeleteData(rowId);
|
|
3523
|
+
}, className: "text-red-500 hover:text-red-700 hover:bg-red-50 p-1 rounded" },
|
|
3524
|
+
react_2.default.createElement(outline_1.TrashIcon, { className: "h-4 w-4", "aria-hidden": "true" }))));
|
|
3463
3525
|
};
|
|
3464
3526
|
// INFO: the header emits a cell for the add-column control, so every row must
|
|
3465
3527
|
// emit one too or the body ends up a column narrower than the header and each
|
|
@@ -3571,8 +3633,10 @@ var NewTable = function (rawProps) {
|
|
|
3571
3633
|
renderAddColumnCell(),
|
|
3572
3634
|
react_2.default.createElement("td", { className: "".concat(gridLines === "all" ? editCellPadding : cellPadding, " text-sm ").concat(handleGetActionCellPin(false).className), style: handleGetActionCellPin(false).style },
|
|
3573
3635
|
react_2.default.createElement("div", { className: "flex flex-row ".concat(gridLines === "all" ? "gap-1" : "gap-2") },
|
|
3574
|
-
react_2.default.createElement(
|
|
3575
|
-
|
|
3636
|
+
react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: "Save row", className: "inline-flex" },
|
|
3637
|
+
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-confirm", size: gridLines === "all" ? "small" : undefined, darkMode: gridLines === "all" ? props.darkMode : undefined, icon: react_2.default.createElement(solid_2.CheckIcon, { className: "".concat(gridLines === "all" ? "h-4 w-4" : "h-5 w-5", " text-green-500") }), onClick: function () { return handleCommitAdd(false); } })),
|
|
3638
|
+
react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: "Cancel", className: "inline-flex" },
|
|
3639
|
+
react_2.default.createElement(iconButton_1.IconButton, { testId: "table-add-row-cancel", size: gridLines === "all" ? "small" : undefined, darkMode: gridLines === "all" ? props.darkMode : undefined, icon: react_2.default.createElement(solid_2.XMarkIcon, { className: "".concat(gridLines === "all" ? "h-4 w-4" : "h-5 w-5", " text-red-500") }), onClick: handleCancelAdd }))))));
|
|
3576
3640
|
};
|
|
3577
3641
|
// INFO: an empty add row lightens on hover; its pinned cells, which carry
|
|
3578
3642
|
// their own background, follow it
|
|
@@ -4162,9 +4226,13 @@ var NewTable = function (rawProps) {
|
|
|
4162
4226
|
// INFO: an empty cell under gridLines="all" is blank,
|
|
4163
4227
|
// as every other empty cell of the grid is
|
|
4164
4228
|
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))),
|
|
4165
|
-
react_2.default.createElement(
|
|
4229
|
+
react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: "Edit", className: "inline-flex flex-shrink-0" },
|
|
4230
|
+
react_2.default.createElement(outline_1.PencilIcon, { "aria-hidden": "true", className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" })))));
|
|
4166
4231
|
}
|
|
4167
4232
|
if (isModalEdit) {
|
|
4233
|
+
// INFO: of the modal-edited types, an address (its name) has
|
|
4234
|
+
// text to copy
|
|
4235
|
+
var isCopyableModalCell = resolvedColType === "address";
|
|
4168
4236
|
return (react_2.default.createElement("td", { key: col.key, "data-cell-key": col.key, "data-pin-key": leftPinned.includes(col.key) ||
|
|
4169
4237
|
rightPinned.includes(col.key)
|
|
4170
4238
|
? col.key
|
|
@@ -4172,7 +4240,9 @@ var NewTable = function (rawProps) {
|
|
|
4172
4240
|
// INFO: share the column width source with the read-only/edit cell
|
|
4173
4241
|
// variants, otherwise an "Add" placeholder and a filled value in the
|
|
4174
4242
|
// same column resolve to different widths and the column looks ragged
|
|
4175
|
-
|
|
4243
|
+
// INFO: an address cell also carries the copy icon, shown
|
|
4244
|
+
// while the cell is hovered
|
|
4245
|
+
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
4246
|
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
4247
|
e.stopPropagation();
|
|
4178
4248
|
handleModalEditOnClick(row.id, col.key, row);
|
|
@@ -4181,7 +4251,10 @@ var NewTable = function (rawProps) {
|
|
|
4181
4251
|
// INFO: an empty cell under gridLines="all" is blank,
|
|
4182
4252
|
// as every other empty cell of the grid is
|
|
4183
4253
|
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))),
|
|
4184
|
-
|
|
4254
|
+
isCopyableModalCell &&
|
|
4255
|
+
renderCellCopyButton(col, colIndex, row, spaceRow, false, true),
|
|
4256
|
+
react_2.default.createElement(hoverTooltip_1.HoverTooltip, { text: "Edit", className: "inline-flex flex-shrink-0" },
|
|
4257
|
+
react_2.default.createElement(outline_1.PencilIcon, { "aria-hidden": "true", className: "w-3.5 h-3.5 text-gray-400 opacity-0 group-hover/modaledit:opacity-100 flex-shrink-0" })))));
|
|
4185
4258
|
}
|
|
4186
4259
|
// INFO: a multi-select shows its picks as one line of tags until it is
|
|
4187
4260
|
// clicked — its editor stacks the input over the tags, which made every
|
|
@@ -4221,7 +4294,7 @@ var NewTable = function (rawProps) {
|
|
|
4221
4294
|
var isTagClearable = gridLines === "all" &&
|
|
4222
4295
|
!isLabelPickerColumn &&
|
|
4223
4296
|
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: "
|
|
4297
|
+
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
4298
|
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
4299
|
e.stopPropagation();
|
|
4227
4300
|
handleOpenCell_1(e.currentTarget);
|
|
@@ -4234,6 +4307,7 @@ var NewTable = function (rawProps) {
|
|
|
4234
4307
|
} }, renderTagLine(col, isLabelPickerColumn ? pickedValue : cellValue)),
|
|
4235
4308
|
isTagClearable &&
|
|
4236
4309
|
renderClearCellButton(col, row.id, rowData, true),
|
|
4310
|
+
renderCellCopyButton(col, colIndex, row, spaceRow, isTagClearable),
|
|
4237
4311
|
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
4312
|
key: String(key),
|
|
4239
4313
|
color: handleGetListColour(col, key),
|
|
@@ -4293,7 +4367,7 @@ var NewTable = function (rawProps) {
|
|
|
4293
4367
|
!isActionColumn;
|
|
4294
4368
|
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
4369
|
? col.key
|
|
4296
|
-
: undefined, className: "
|
|
4370
|
+
: 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
4371
|
? ""
|
|
4298
4372
|
: undefined, "data-cell-locked": isLockedGridCell ? "" : undefined,
|
|
4299
4373
|
// INFO: bubble phase, so a button in the cell (the title's
|
|
@@ -4325,9 +4399,11 @@ var NewTable = function (rawProps) {
|
|
|
4325
4399
|
});
|
|
4326
4400
|
}
|
|
4327
4401
|
: undefined },
|
|
4328
|
-
handleIsReadCellFixed(col) ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { as: "div", className: "w-0 min-w-full truncate", onlyWhenClipped: true },
|
|
4402
|
+
handleIsReadCellFixed(col) ? (react_2.default.createElement(hoverTooltip_1.HoverTooltip, { as: "div", className: "w-0 min-w-full truncate", onlyWhenClipped: true },
|
|
4403
|
+
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
4404
|
isReadClearable &&
|
|
4330
|
-
renderClearCellButton(col, row.id, rowData, true)
|
|
4405
|
+
renderClearCellButton(col, row.id, rowData, true),
|
|
4406
|
+
renderCellCopyButton(col, colIndex, row, spaceRow, !!isReadClearable)));
|
|
4331
4407
|
if (!isEditable || bareOverride)
|
|
4332
4408
|
return readCell;
|
|
4333
4409
|
if (isClickToEditCell)
|