@universe-platform/ui 0.1.0-beta.77 → 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.js +25 -17
- package/dist/index.mjs +25 -17
- package/package.json +1 -1
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
|
),
|
|
@@ -3684,12 +3687,11 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3684
3687
|
const handleSaveAndClose = (0, import_react7.useCallback)(() => {
|
|
3685
3688
|
const rawUrl = draftUrlRef.current.trim();
|
|
3686
3689
|
const rawLabel = draftLabelRef.current.trim();
|
|
3687
|
-
if (!rawUrl) {
|
|
3690
|
+
if (!rawUrl && !rawLabel) {
|
|
3688
3691
|
onChange(null);
|
|
3689
3692
|
} else {
|
|
3690
|
-
const resolved = resolveProtocol(rawUrl);
|
|
3691
3693
|
onChange({
|
|
3692
|
-
url:
|
|
3694
|
+
url: rawUrl ? resolveProtocol(rawUrl) : "",
|
|
3693
3695
|
label: rawLabel
|
|
3694
3696
|
});
|
|
3695
3697
|
}
|
|
@@ -3737,6 +3739,9 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3737
3739
|
};
|
|
3738
3740
|
if (readOnly) {
|
|
3739
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
|
+
}
|
|
3740
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: "-" });
|
|
3741
3746
|
}
|
|
3742
3747
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
@@ -3804,9 +3809,9 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3804
3809
|
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3805
3810
|
"span",
|
|
3806
3811
|
{
|
|
3807
|
-
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",
|
|
3808
3813
|
onClick: handleOpen,
|
|
3809
|
-
children: "\u05E8\u05D9\u05E7"
|
|
3814
|
+
children: fixedLabel || currentLink.label || "\u05E8\u05D9\u05E7"
|
|
3810
3815
|
}
|
|
3811
3816
|
),
|
|
3812
3817
|
renderTooltip(displayLabel),
|
|
@@ -3856,7 +3861,7 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3856
3861
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
3857
3862
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "block text-xs font-medium text-slate-700 mb-1", children: [
|
|
3858
3863
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL ",
|
|
3859
|
-
/* @__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)" })
|
|
3860
3865
|
] }),
|
|
3861
3866
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3862
3867
|
"input",
|
|
@@ -3901,7 +3906,7 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3901
3906
|
] })
|
|
3902
3907
|
] }),
|
|
3903
3908
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between pt-2 border-t border-slate-100", children: [
|
|
3904
|
-
currentLink.url ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3909
|
+
currentLink.url || currentLink.label ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3905
3910
|
"button",
|
|
3906
3911
|
{
|
|
3907
3912
|
type: "button",
|
|
@@ -5368,10 +5373,13 @@ var CELL_RENDERERS = {
|
|
|
5368
5373
|
LINK: ({ value, column }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LinkPickerCell, { value, onChange: () => {
|
|
5369
5374
|
}, column, readOnly: true }),
|
|
5370
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" }) }),
|
|
5371
|
-
GOOGLE_DRIVE_FILE: ({ value }) => {
|
|
5376
|
+
GOOGLE_DRIVE_FILE: ({ value, column }) => {
|
|
5377
|
+
var _a, _b;
|
|
5372
5378
|
const files = Array.isArray(value) ? value : value ? [value] : [];
|
|
5373
5379
|
if (files.length === 0) return null;
|
|
5374
|
-
|
|
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)) });
|
|
5375
5383
|
},
|
|
5376
5384
|
RELATION: ({ value, column, context }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RelationPickerCell, { value, column, context, readOnly: true, onChange: () => {
|
|
5377
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
|
),
|
|
@@ -3469,12 +3472,11 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3469
3472
|
const handleSaveAndClose = useCallback5(() => {
|
|
3470
3473
|
const rawUrl = draftUrlRef.current.trim();
|
|
3471
3474
|
const rawLabel = draftLabelRef.current.trim();
|
|
3472
|
-
if (!rawUrl) {
|
|
3475
|
+
if (!rawUrl && !rawLabel) {
|
|
3473
3476
|
onChange(null);
|
|
3474
3477
|
} else {
|
|
3475
|
-
const resolved = resolveProtocol(rawUrl);
|
|
3476
3478
|
onChange({
|
|
3477
|
-
url:
|
|
3479
|
+
url: rawUrl ? resolveProtocol(rawUrl) : "",
|
|
3478
3480
|
label: rawLabel
|
|
3479
3481
|
});
|
|
3480
3482
|
}
|
|
@@ -3522,6 +3524,9 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3522
3524
|
};
|
|
3523
3525
|
if (readOnly) {
|
|
3524
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
|
+
}
|
|
3525
3530
|
return /* @__PURE__ */ jsx6("span", { className: "px-2 py-1 flex items-center h-full text-slate-400 text-xs italic", children: "-" });
|
|
3526
3531
|
}
|
|
3527
3532
|
return /* @__PURE__ */ jsxs6(
|
|
@@ -3589,9 +3594,9 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3589
3594
|
) : /* @__PURE__ */ jsx6(
|
|
3590
3595
|
"span",
|
|
3591
3596
|
{
|
|
3592
|
-
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",
|
|
3593
3598
|
onClick: handleOpen,
|
|
3594
|
-
children: "\u05E8\u05D9\u05E7"
|
|
3599
|
+
children: fixedLabel || currentLink.label || "\u05E8\u05D9\u05E7"
|
|
3595
3600
|
}
|
|
3596
3601
|
),
|
|
3597
3602
|
renderTooltip(displayLabel),
|
|
@@ -3641,7 +3646,7 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3641
3646
|
/* @__PURE__ */ jsxs6("div", { children: [
|
|
3642
3647
|
/* @__PURE__ */ jsxs6("label", { className: "block text-xs font-medium text-slate-700 mb-1", children: [
|
|
3643
3648
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL ",
|
|
3644
|
-
/* @__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)" })
|
|
3645
3650
|
] }),
|
|
3646
3651
|
/* @__PURE__ */ jsx6(
|
|
3647
3652
|
"input",
|
|
@@ -3686,7 +3691,7 @@ function LinkPickerCell({ value, onChange, column, readOnly = false }) {
|
|
|
3686
3691
|
] })
|
|
3687
3692
|
] }),
|
|
3688
3693
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between pt-2 border-t border-slate-100", children: [
|
|
3689
|
-
currentLink.url ? /* @__PURE__ */ jsxs6(
|
|
3694
|
+
currentLink.url || currentLink.label ? /* @__PURE__ */ jsxs6(
|
|
3690
3695
|
"button",
|
|
3691
3696
|
{
|
|
3692
3697
|
type: "button",
|
|
@@ -5153,10 +5158,13 @@ var CELL_RENDERERS = {
|
|
|
5153
5158
|
LINK: ({ value, column }) => /* @__PURE__ */ jsx12(LinkPickerCell, { value, onChange: () => {
|
|
5154
5159
|
}, column, readOnly: true }),
|
|
5155
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" }) }),
|
|
5156
|
-
GOOGLE_DRIVE_FILE: ({ value }) => {
|
|
5161
|
+
GOOGLE_DRIVE_FILE: ({ value, column }) => {
|
|
5162
|
+
var _a, _b;
|
|
5157
5163
|
const files = Array.isArray(value) ? value : value ? [value] : [];
|
|
5158
5164
|
if (files.length === 0) return null;
|
|
5159
|
-
|
|
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)) });
|
|
5160
5168
|
},
|
|
5161
5169
|
RELATION: ({ value, column, context }) => /* @__PURE__ */ jsx12(RelationPickerCell, { value, column, context, readOnly: true, onChange: () => {
|
|
5162
5170
|
} }),
|