@universe-platform/ui 0.1.0-beta.76 → 0.1.0-beta.78
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +34 -24
- package/dist/index.mjs +34 -24
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -283,7 +283,7 @@ declare function parseLinkValue(val: CellValue<'LINK'> | string): {
|
|
|
283
283
|
label: string;
|
|
284
284
|
};
|
|
285
285
|
declare function resolveProtocol(url: string): string;
|
|
286
|
-
declare function LinkPickerCell({ value, onChange, readOnly }: LinkPickerCellProps): react_jsx_runtime.JSX.Element;
|
|
286
|
+
declare function LinkPickerCell({ value, onChange, column, readOnly }: LinkPickerCellProps): react_jsx_runtime.JSX.Element;
|
|
287
287
|
|
|
288
288
|
interface RelationPickerCellProps {
|
|
289
289
|
value: CellValue<'RELATION'> | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -283,7 +283,7 @@ declare function parseLinkValue(val: CellValue<'LINK'> | string): {
|
|
|
283
283
|
label: string;
|
|
284
284
|
};
|
|
285
285
|
declare function resolveProtocol(url: string): string;
|
|
286
|
-
declare function LinkPickerCell({ value, onChange, readOnly }: LinkPickerCellProps): react_jsx_runtime.JSX.Element;
|
|
286
|
+
declare function LinkPickerCell({ value, onChange, column, readOnly }: LinkPickerCellProps): react_jsx_runtime.JSX.Element;
|
|
287
287
|
|
|
288
288
|
interface RelationPickerCellProps {
|
|
289
289
|
value: CellValue<'RELATION'> | string;
|
package/dist/index.js
CHANGED
|
@@ -2152,6 +2152,7 @@ function DrivePickerCell({
|
|
|
2152
2152
|
readOnly = false,
|
|
2153
2153
|
onUpload
|
|
2154
2154
|
}) {
|
|
2155
|
+
var _a, _b;
|
|
2155
2156
|
const [isOpening, setIsOpening] = (0, import_react3.useState)(false);
|
|
2156
2157
|
const [isUploading, setIsUploading] = (0, import_react3.useState)(false);
|
|
2157
2158
|
const [uploadingCount, setUploadingCount] = (0, import_react3.useState)(0);
|
|
@@ -2172,8 +2173,8 @@ function DrivePickerCell({
|
|
|
2172
2173
|
}, [value]);
|
|
2173
2174
|
(0, import_react3.useEffect)(() => {
|
|
2174
2175
|
const handleMessage = (event) => {
|
|
2175
|
-
var
|
|
2176
|
-
if (((
|
|
2176
|
+
var _a2, _b2, _c;
|
|
2177
|
+
if (((_a2 = event.data) == null ? void 0 : _a2.type) === "DRIVE_UPLOAD_SUCCESS" && ((_b2 = event.data) == null ? void 0 : _b2.payload) && ((_c = event.data) == null ? void 0 : _c.cellContextId) === cellContextId) {
|
|
2177
2178
|
const incoming = Array.isArray(event.data.payload) ? event.data.payload : [event.data.payload];
|
|
2178
2179
|
const normalized = incoming.map((item, idx) => ({
|
|
2179
2180
|
fileId: item.fileId || item.id || `file-${Date.now()}-${idx}`,
|
|
@@ -2209,10 +2210,10 @@ function DrivePickerCell({
|
|
|
2209
2210
|
const customResult = await onUpload(files);
|
|
2210
2211
|
if (Array.isArray(customResult) && customResult.length > 0) {
|
|
2211
2212
|
const newFiles = customResult.map((res, idx) => {
|
|
2212
|
-
var
|
|
2213
|
+
var _a2;
|
|
2213
2214
|
return {
|
|
2214
2215
|
fileId: res.fileId || res.id || `file-${Date.now()}-${idx}`,
|
|
2215
|
-
fileName: res.fileName || res.name || ((
|
|
2216
|
+
fileName: res.fileName || res.name || ((_a2 = files[idx]) == null ? void 0 : _a2.name) || "Unnamed file",
|
|
2216
2217
|
fileUrl: res.fileUrl || res.url || res.link || "",
|
|
2217
2218
|
url: res.url || res.fileUrl || res.link || ""
|
|
2218
2219
|
};
|
|
@@ -2404,8 +2405,8 @@ function DrivePickerCell({
|
|
|
2404
2405
|
await new Promise((resolve) => {
|
|
2405
2406
|
let timer = null;
|
|
2406
2407
|
const handlePopupMessage = (event) => {
|
|
2407
|
-
var
|
|
2408
|
-
if (((
|
|
2408
|
+
var _a2, _b2;
|
|
2409
|
+
if (((_a2 = event.data) == null ? void 0 : _a2.type) === "DRIVE_UPLOAD_SUCCESS" && ((_b2 = event.data) == null ? void 0 : _b2.cellContextId) === cellContextId) {
|
|
2409
2410
|
window.removeEventListener("message", handlePopupMessage);
|
|
2410
2411
|
if (timer) clearInterval(timer);
|
|
2411
2412
|
resolve();
|
|
@@ -2463,6 +2464,8 @@ function DrivePickerCell({
|
|
|
2463
2464
|
}
|
|
2464
2465
|
);
|
|
2465
2466
|
};
|
|
2467
|
+
const fixedLabel = String((_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.fixedLabel) != null ? _b : "").trim();
|
|
2468
|
+
const labelFor = (file, idx) => fixedLabel ? fileList.length > 1 ? `${fixedLabel} ${idx + 1}` : fixedLabel : file.fileName || "Unnamed file";
|
|
2466
2469
|
if (fileList.length > 0) {
|
|
2467
2470
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-wrap items-center w-full py-1 px-2 gap-1.5", children: [
|
|
2468
2471
|
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -2486,10 +2489,10 @@ function DrivePickerCell({
|
|
|
2486
2489
|
target: "_blank",
|
|
2487
2490
|
rel: "noopener noreferrer",
|
|
2488
2491
|
className: `inline-flex items-center gap-1.5 px-2 py-1 rounded-md text-xs font-medium text-blue-700 bg-blue-50 hover:bg-blue-100 transition-colors truncate ${readOnly ? "max-w-full" : "max-w-[calc(100%-28px)]"}`,
|
|
2489
|
-
title: file.fileName || "Open file",
|
|
2492
|
+
title: fixedLabel ? labelFor(file, idx) : file.fileName || "Open file",
|
|
2490
2493
|
children: [
|
|
2491
2494
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.FileText, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
2492
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "truncate", children: file
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "truncate", children: labelFor(file, idx) })
|
|
2493
2496
|
]
|
|
2494
2497
|
}
|
|
2495
2498
|
),
|
|
@@ -3635,14 +3638,16 @@ function resolveProtocol(url) {
|
|
|
3635
3638
|
}
|
|
3636
3639
|
return `https://${trimmed}`;
|
|
3637
3640
|
}
|
|
3638
|
-
function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
3641
|
+
function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
3642
|
+
var _a, _b;
|
|
3639
3643
|
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
3640
3644
|
const containerRef = (0, import_react7.useRef)(null);
|
|
3641
3645
|
const urlInputRef = (0, import_react7.useRef)(null);
|
|
3642
3646
|
const { targetRef, handleMouseEnter, handleMouseLeave, renderTooltip } = useSmartTooltip();
|
|
3643
3647
|
const [popoverPos, setPopoverPos] = (0, import_react7.useState)({ top: 0, right: 0 });
|
|
3644
3648
|
const currentLink = parseLinkValue(value);
|
|
3645
|
-
const
|
|
3649
|
+
const fixedLabel = String((_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.fixedLabel) != null ? _b : "").trim();
|
|
3650
|
+
const displayLabel = fixedLabel || currentLink.label && currentLink.label.trim() || currentLink.url;
|
|
3646
3651
|
const targetHref = resolveProtocol(currentLink.url);
|
|
3647
3652
|
const [draftUrl, setDraftUrl] = (0, import_react7.useState)(currentLink.url);
|
|
3648
3653
|
const [draftLabel, setDraftLabel] = (0, import_react7.useState)(currentLink.label);
|
|
@@ -3682,12 +3687,11 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3682
3687
|
const handleSaveAndClose = (0, import_react7.useCallback)(() => {
|
|
3683
3688
|
const rawUrl = draftUrlRef.current.trim();
|
|
3684
3689
|
const rawLabel = draftLabelRef.current.trim();
|
|
3685
|
-
if (!rawUrl) {
|
|
3690
|
+
if (!rawUrl && !rawLabel) {
|
|
3686
3691
|
onChange(null);
|
|
3687
3692
|
} else {
|
|
3688
|
-
const resolved = resolveProtocol(rawUrl);
|
|
3689
3693
|
onChange({
|
|
3690
|
-
url:
|
|
3694
|
+
url: rawUrl ? resolveProtocol(rawUrl) : "",
|
|
3691
3695
|
label: rawLabel
|
|
3692
3696
|
});
|
|
3693
3697
|
}
|
|
@@ -3699,8 +3703,8 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3699
3703
|
updatePopoverPosition();
|
|
3700
3704
|
setIsOpen(true);
|
|
3701
3705
|
setTimeout(() => {
|
|
3702
|
-
var
|
|
3703
|
-
(
|
|
3706
|
+
var _a2;
|
|
3707
|
+
(_a2 = urlInputRef.current) == null ? void 0 : _a2.focus();
|
|
3704
3708
|
}, 50);
|
|
3705
3709
|
};
|
|
3706
3710
|
(0, import_react7.useEffect)(() => {
|
|
@@ -3735,6 +3739,9 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3735
3739
|
};
|
|
3736
3740
|
if (readOnly) {
|
|
3737
3741
|
if (!currentLink.url) {
|
|
3742
|
+
if (fixedLabel || currentLink.label) {
|
|
3743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-2 py-1 flex items-center h-full text-slate-600 text-sm truncate", children: fixedLabel || currentLink.label });
|
|
3744
|
+
}
|
|
3738
3745
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-2 py-1 flex items-center h-full text-slate-400 text-xs italic", children: "-" });
|
|
3739
3746
|
}
|
|
3740
3747
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
@@ -3802,9 +3809,9 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3802
3809
|
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3803
3810
|
"span",
|
|
3804
3811
|
{
|
|
3805
|
-
className: "text-slate-400 italic text-sm flex-1 cursor-pointer select-none",
|
|
3812
|
+
className: fixedLabel || currentLink.label ? "text-slate-600 text-sm flex-1 cursor-pointer select-none truncate" : "text-slate-400 italic text-sm flex-1 cursor-pointer select-none",
|
|
3806
3813
|
onClick: handleOpen,
|
|
3807
|
-
children: "\u05E8\u05D9\u05E7"
|
|
3814
|
+
children: fixedLabel || currentLink.label || "\u05E8\u05D9\u05E7"
|
|
3808
3815
|
}
|
|
3809
3816
|
),
|
|
3810
3817
|
renderTooltip(displayLabel),
|
|
@@ -3854,7 +3861,7 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3854
3861
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
3855
3862
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "block text-xs font-medium text-slate-700 mb-1", children: [
|
|
3856
3863
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL ",
|
|
3857
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-
|
|
3864
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400 font-normal", children: "(\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
|
|
3858
3865
|
] }),
|
|
3859
3866
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3860
3867
|
"input",
|
|
@@ -3875,7 +3882,7 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3875
3882
|
}
|
|
3876
3883
|
)
|
|
3877
3884
|
] }),
|
|
3878
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
3885
|
+
!fixedLabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
3879
3886
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "block text-xs font-medium text-slate-700 mb-1", children: [
|
|
3880
3887
|
"\u05D8\u05E7\u05E1\u05D8 \u05DC\u05EA\u05E6\u05D5\u05D2\u05D4 ",
|
|
3881
3888
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-slate-400 font-normal", children: "(\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
|
|
@@ -3899,7 +3906,7 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3899
3906
|
] })
|
|
3900
3907
|
] }),
|
|
3901
3908
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between pt-2 border-t border-slate-100", children: [
|
|
3902
|
-
currentLink.url ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3909
|
+
currentLink.url || currentLink.label ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3903
3910
|
"button",
|
|
3904
3911
|
{
|
|
3905
3912
|
type: "button",
|
|
@@ -5363,13 +5370,16 @@ var CELL_RENDERERS = {
|
|
|
5363
5370
|
},
|
|
5364
5371
|
TIME: ({ value }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TimePickerCell, { value, onChange: () => {
|
|
5365
5372
|
}, readOnly: true }),
|
|
5366
|
-
LINK: ({ value }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LinkPickerCell, { value, onChange: () => {
|
|
5367
|
-
}, readOnly: true }),
|
|
5373
|
+
LINK: ({ value, column }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LinkPickerCell, { value, onChange: () => {
|
|
5374
|
+
}, column, readOnly: true }),
|
|
5368
5375
|
BOOLEAN: ({ value }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center justify-center w-full h-full p-2", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "checkbox", checked: !!value, readOnly: true, className: "w-4 h-4 rounded border-slate-300 text-brand" }) }),
|
|
5369
|
-
GOOGLE_DRIVE_FILE: ({ value }) => {
|
|
5376
|
+
GOOGLE_DRIVE_FILE: ({ value, column }) => {
|
|
5377
|
+
var _a, _b;
|
|
5370
5378
|
const files = Array.isArray(value) ? value : value ? [value] : [];
|
|
5371
5379
|
if (files.length === 0) return null;
|
|
5372
|
-
|
|
5380
|
+
const fixedLabel = String((_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.fixedLabel) != null ? _b : "").trim();
|
|
5381
|
+
const labelFor = (file, idx) => fixedLabel ? files.length > 1 ? `${fixedLabel} ${idx + 1}` : fixedLabel : file.fileName || file.name || "";
|
|
5382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col gap-0.5 py-1 px-2 h-full justify-center", children: files.map((file, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-sm truncate", title: labelFor(file, idx), children: labelFor(file, idx) }, file.fileId || idx)) });
|
|
5373
5383
|
},
|
|
5374
5384
|
RELATION: ({ value, column, context }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RelationPickerCell, { value, column, context, readOnly: true, onChange: () => {
|
|
5375
5385
|
} }),
|
package/dist/index.mjs
CHANGED
|
@@ -1937,6 +1937,7 @@ function DrivePickerCell({
|
|
|
1937
1937
|
readOnly = false,
|
|
1938
1938
|
onUpload
|
|
1939
1939
|
}) {
|
|
1940
|
+
var _a, _b;
|
|
1940
1941
|
const [isOpening, setIsOpening] = useState2(false);
|
|
1941
1942
|
const [isUploading, setIsUploading] = useState2(false);
|
|
1942
1943
|
const [uploadingCount, setUploadingCount] = useState2(0);
|
|
@@ -1957,8 +1958,8 @@ function DrivePickerCell({
|
|
|
1957
1958
|
}, [value]);
|
|
1958
1959
|
useEffect(() => {
|
|
1959
1960
|
const handleMessage = (event) => {
|
|
1960
|
-
var
|
|
1961
|
-
if (((
|
|
1961
|
+
var _a2, _b2, _c;
|
|
1962
|
+
if (((_a2 = event.data) == null ? void 0 : _a2.type) === "DRIVE_UPLOAD_SUCCESS" && ((_b2 = event.data) == null ? void 0 : _b2.payload) && ((_c = event.data) == null ? void 0 : _c.cellContextId) === cellContextId) {
|
|
1962
1963
|
const incoming = Array.isArray(event.data.payload) ? event.data.payload : [event.data.payload];
|
|
1963
1964
|
const normalized = incoming.map((item, idx) => ({
|
|
1964
1965
|
fileId: item.fileId || item.id || `file-${Date.now()}-${idx}`,
|
|
@@ -1994,10 +1995,10 @@ function DrivePickerCell({
|
|
|
1994
1995
|
const customResult = await onUpload(files);
|
|
1995
1996
|
if (Array.isArray(customResult) && customResult.length > 0) {
|
|
1996
1997
|
const newFiles = customResult.map((res, idx) => {
|
|
1997
|
-
var
|
|
1998
|
+
var _a2;
|
|
1998
1999
|
return {
|
|
1999
2000
|
fileId: res.fileId || res.id || `file-${Date.now()}-${idx}`,
|
|
2000
|
-
fileName: res.fileName || res.name || ((
|
|
2001
|
+
fileName: res.fileName || res.name || ((_a2 = files[idx]) == null ? void 0 : _a2.name) || "Unnamed file",
|
|
2001
2002
|
fileUrl: res.fileUrl || res.url || res.link || "",
|
|
2002
2003
|
url: res.url || res.fileUrl || res.link || ""
|
|
2003
2004
|
};
|
|
@@ -2189,8 +2190,8 @@ function DrivePickerCell({
|
|
|
2189
2190
|
await new Promise((resolve) => {
|
|
2190
2191
|
let timer = null;
|
|
2191
2192
|
const handlePopupMessage = (event) => {
|
|
2192
|
-
var
|
|
2193
|
-
if (((
|
|
2193
|
+
var _a2, _b2;
|
|
2194
|
+
if (((_a2 = event.data) == null ? void 0 : _a2.type) === "DRIVE_UPLOAD_SUCCESS" && ((_b2 = event.data) == null ? void 0 : _b2.cellContextId) === cellContextId) {
|
|
2194
2195
|
window.removeEventListener("message", handlePopupMessage);
|
|
2195
2196
|
if (timer) clearInterval(timer);
|
|
2196
2197
|
resolve();
|
|
@@ -2248,6 +2249,8 @@ function DrivePickerCell({
|
|
|
2248
2249
|
}
|
|
2249
2250
|
);
|
|
2250
2251
|
};
|
|
2252
|
+
const fixedLabel = String((_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.fixedLabel) != null ? _b : "").trim();
|
|
2253
|
+
const labelFor = (file, idx) => fixedLabel ? fileList.length > 1 ? `${fixedLabel} ${idx + 1}` : fixedLabel : file.fileName || "Unnamed file";
|
|
2251
2254
|
if (fileList.length > 0) {
|
|
2252
2255
|
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center w-full py-1 px-2 gap-1.5", children: [
|
|
2253
2256
|
!readOnly && /* @__PURE__ */ jsx2(
|
|
@@ -2271,10 +2274,10 @@ function DrivePickerCell({
|
|
|
2271
2274
|
target: "_blank",
|
|
2272
2275
|
rel: "noopener noreferrer",
|
|
2273
2276
|
className: `inline-flex items-center gap-1.5 px-2 py-1 rounded-md text-xs font-medium text-blue-700 bg-blue-50 hover:bg-blue-100 transition-colors truncate ${readOnly ? "max-w-full" : "max-w-[calc(100%-28px)]"}`,
|
|
2274
|
-
title: file.fileName || "Open file",
|
|
2277
|
+
title: fixedLabel ? labelFor(file, idx) : file.fileName || "Open file",
|
|
2275
2278
|
children: [
|
|
2276
2279
|
/* @__PURE__ */ jsx2(FileText, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
2277
|
-
/* @__PURE__ */ jsx2("span", { className: "truncate", children: file
|
|
2280
|
+
/* @__PURE__ */ jsx2("span", { className: "truncate", children: labelFor(file, idx) })
|
|
2278
2281
|
]
|
|
2279
2282
|
}
|
|
2280
2283
|
),
|
|
@@ -3420,14 +3423,16 @@ function resolveProtocol(url) {
|
|
|
3420
3423
|
}
|
|
3421
3424
|
return `https://${trimmed}`;
|
|
3422
3425
|
}
|
|
3423
|
-
function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
3426
|
+
function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
3427
|
+
var _a, _b;
|
|
3424
3428
|
const [isOpen, setIsOpen] = useState6(false);
|
|
3425
3429
|
const containerRef = useRef6(null);
|
|
3426
3430
|
const urlInputRef = useRef6(null);
|
|
3427
3431
|
const { targetRef, handleMouseEnter, handleMouseLeave, renderTooltip } = useSmartTooltip();
|
|
3428
3432
|
const [popoverPos, setPopoverPos] = useState6({ top: 0, right: 0 });
|
|
3429
3433
|
const currentLink = parseLinkValue(value);
|
|
3430
|
-
const
|
|
3434
|
+
const fixedLabel = String((_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.fixedLabel) != null ? _b : "").trim();
|
|
3435
|
+
const displayLabel = fixedLabel || currentLink.label && currentLink.label.trim() || currentLink.url;
|
|
3431
3436
|
const targetHref = resolveProtocol(currentLink.url);
|
|
3432
3437
|
const [draftUrl, setDraftUrl] = useState6(currentLink.url);
|
|
3433
3438
|
const [draftLabel, setDraftLabel] = useState6(currentLink.label);
|
|
@@ -3467,12 +3472,11 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3467
3472
|
const handleSaveAndClose = useCallback5(() => {
|
|
3468
3473
|
const rawUrl = draftUrlRef.current.trim();
|
|
3469
3474
|
const rawLabel = draftLabelRef.current.trim();
|
|
3470
|
-
if (!rawUrl) {
|
|
3475
|
+
if (!rawUrl && !rawLabel) {
|
|
3471
3476
|
onChange(null);
|
|
3472
3477
|
} else {
|
|
3473
|
-
const resolved = resolveProtocol(rawUrl);
|
|
3474
3478
|
onChange({
|
|
3475
|
-
url:
|
|
3479
|
+
url: rawUrl ? resolveProtocol(rawUrl) : "",
|
|
3476
3480
|
label: rawLabel
|
|
3477
3481
|
});
|
|
3478
3482
|
}
|
|
@@ -3484,8 +3488,8 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3484
3488
|
updatePopoverPosition();
|
|
3485
3489
|
setIsOpen(true);
|
|
3486
3490
|
setTimeout(() => {
|
|
3487
|
-
var
|
|
3488
|
-
(
|
|
3491
|
+
var _a2;
|
|
3492
|
+
(_a2 = urlInputRef.current) == null ? void 0 : _a2.focus();
|
|
3489
3493
|
}, 50);
|
|
3490
3494
|
};
|
|
3491
3495
|
useEffect5(() => {
|
|
@@ -3520,6 +3524,9 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3520
3524
|
};
|
|
3521
3525
|
if (readOnly) {
|
|
3522
3526
|
if (!currentLink.url) {
|
|
3527
|
+
if (fixedLabel || currentLink.label) {
|
|
3528
|
+
return /* @__PURE__ */ jsx6("span", { className: "px-2 py-1 flex items-center h-full text-slate-600 text-sm truncate", children: fixedLabel || currentLink.label });
|
|
3529
|
+
}
|
|
3523
3530
|
return /* @__PURE__ */ jsx6("span", { className: "px-2 py-1 flex items-center h-full text-slate-400 text-xs italic", children: "-" });
|
|
3524
3531
|
}
|
|
3525
3532
|
return /* @__PURE__ */ jsxs6(
|
|
@@ -3587,9 +3594,9 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3587
3594
|
) : /* @__PURE__ */ jsx6(
|
|
3588
3595
|
"span",
|
|
3589
3596
|
{
|
|
3590
|
-
className: "text-slate-400 italic text-sm flex-1 cursor-pointer select-none",
|
|
3597
|
+
className: fixedLabel || currentLink.label ? "text-slate-600 text-sm flex-1 cursor-pointer select-none truncate" : "text-slate-400 italic text-sm flex-1 cursor-pointer select-none",
|
|
3591
3598
|
onClick: handleOpen,
|
|
3592
|
-
children: "\u05E8\u05D9\u05E7"
|
|
3599
|
+
children: fixedLabel || currentLink.label || "\u05E8\u05D9\u05E7"
|
|
3593
3600
|
}
|
|
3594
3601
|
),
|
|
3595
3602
|
renderTooltip(displayLabel),
|
|
@@ -3639,7 +3646,7 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3639
3646
|
/* @__PURE__ */ jsxs6("div", { children: [
|
|
3640
3647
|
/* @__PURE__ */ jsxs6("label", { className: "block text-xs font-medium text-slate-700 mb-1", children: [
|
|
3641
3648
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL ",
|
|
3642
|
-
/* @__PURE__ */ jsx6("span", { className: "text-
|
|
3649
|
+
/* @__PURE__ */ jsx6("span", { className: "text-slate-400 font-normal", children: "(\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
|
|
3643
3650
|
] }),
|
|
3644
3651
|
/* @__PURE__ */ jsx6(
|
|
3645
3652
|
"input",
|
|
@@ -3660,7 +3667,7 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3660
3667
|
}
|
|
3661
3668
|
)
|
|
3662
3669
|
] }),
|
|
3663
|
-
/* @__PURE__ */ jsxs6("div", { children: [
|
|
3670
|
+
!fixedLabel && /* @__PURE__ */ jsxs6("div", { children: [
|
|
3664
3671
|
/* @__PURE__ */ jsxs6("label", { className: "block text-xs font-medium text-slate-700 mb-1", children: [
|
|
3665
3672
|
"\u05D8\u05E7\u05E1\u05D8 \u05DC\u05EA\u05E6\u05D5\u05D2\u05D4 ",
|
|
3666
3673
|
/* @__PURE__ */ jsx6("span", { className: "text-slate-400 font-normal", children: "(\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
|
|
@@ -3684,7 +3691,7 @@ function LinkPickerCell({ value, onChange, readOnly = false }) {
|
|
|
3684
3691
|
] })
|
|
3685
3692
|
] }),
|
|
3686
3693
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between pt-2 border-t border-slate-100", children: [
|
|
3687
|
-
currentLink.url ? /* @__PURE__ */ jsxs6(
|
|
3694
|
+
currentLink.url || currentLink.label ? /* @__PURE__ */ jsxs6(
|
|
3688
3695
|
"button",
|
|
3689
3696
|
{
|
|
3690
3697
|
type: "button",
|
|
@@ -5148,13 +5155,16 @@ var CELL_RENDERERS = {
|
|
|
5148
5155
|
},
|
|
5149
5156
|
TIME: ({ value }) => /* @__PURE__ */ jsx12(TimePickerCell, { value, onChange: () => {
|
|
5150
5157
|
}, readOnly: true }),
|
|
5151
|
-
LINK: ({ value }) => /* @__PURE__ */ jsx12(LinkPickerCell, { value, onChange: () => {
|
|
5152
|
-
}, readOnly: true }),
|
|
5158
|
+
LINK: ({ value, column }) => /* @__PURE__ */ jsx12(LinkPickerCell, { value, onChange: () => {
|
|
5159
|
+
}, column, readOnly: true }),
|
|
5153
5160
|
BOOLEAN: ({ value }) => /* @__PURE__ */ jsx12("div", { className: "flex items-center justify-center w-full h-full p-2", children: /* @__PURE__ */ jsx12("input", { type: "checkbox", checked: !!value, readOnly: true, className: "w-4 h-4 rounded border-slate-300 text-brand" }) }),
|
|
5154
|
-
GOOGLE_DRIVE_FILE: ({ value }) => {
|
|
5161
|
+
GOOGLE_DRIVE_FILE: ({ value, column }) => {
|
|
5162
|
+
var _a, _b;
|
|
5155
5163
|
const files = Array.isArray(value) ? value : value ? [value] : [];
|
|
5156
5164
|
if (files.length === 0) return null;
|
|
5157
|
-
|
|
5165
|
+
const fixedLabel = String((_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.fixedLabel) != null ? _b : "").trim();
|
|
5166
|
+
const labelFor = (file, idx) => fixedLabel ? files.length > 1 ? `${fixedLabel} ${idx + 1}` : fixedLabel : file.fileName || file.name || "";
|
|
5167
|
+
return /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-0.5 py-1 px-2 h-full justify-center", children: files.map((file, idx) => /* @__PURE__ */ jsx12("span", { className: "text-sm truncate", title: labelFor(file, idx), children: labelFor(file, idx) }, file.fileId || idx)) });
|
|
5158
5168
|
},
|
|
5159
5169
|
RELATION: ({ value, column, context }) => /* @__PURE__ */ jsx12(RelationPickerCell, { value, column, context, readOnly: true, onChange: () => {
|
|
5160
5170
|
} }),
|