@underverse-ui/underverse 1.0.72 → 1.0.74
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/api-reference.json +1 -1
- package/dist/index.cjs +392 -283
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +393 -284
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20337,46 +20337,52 @@ function DataTableHeader({
|
|
|
20337
20337
|
const titleContent = /* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-1", children: [
|
|
20338
20338
|
/* @__PURE__ */ jsx63("span", { className: cn("font-medium whitespace-nowrap select-text", headerTitleClass), children: col.title }),
|
|
20339
20339
|
col.sortable && /* @__PURE__ */ jsx63(
|
|
20340
|
-
|
|
20340
|
+
Tooltip,
|
|
20341
20341
|
{
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20342
|
+
placement: "top",
|
|
20343
|
+
content: /* @__PURE__ */ jsx63("span", { className: "text-xs font-medium", children: `Sort by ${String(col.title)}` }),
|
|
20344
|
+
children: /* @__PURE__ */ jsx63(
|
|
20345
|
+
"button",
|
|
20346
|
+
{
|
|
20347
|
+
className: cn(
|
|
20348
|
+
"p-1 rounded-lg transition-all duration-200 hover:bg-accent",
|
|
20349
|
+
sort?.key === col.key ? "opacity-100 bg-accent" : "opacity-60 hover:opacity-100"
|
|
20350
|
+
),
|
|
20351
|
+
onClick: () => {
|
|
20352
|
+
setCurPage(1);
|
|
20353
|
+
setSort((current) => {
|
|
20354
|
+
if (!current || current.key !== col.key) return { key: col.key, order: "asc" };
|
|
20355
|
+
if (current.order === "asc") return { key: col.key, order: "desc" };
|
|
20356
|
+
return null;
|
|
20357
|
+
});
|
|
20358
|
+
},
|
|
20359
|
+
"aria-label": "Sort",
|
|
20360
|
+
children: /* @__PURE__ */ jsxs53("svg", { viewBox: "0 0 20 20", fill: "none", className: cn("inline-block", sortIconClass), children: [
|
|
20361
|
+
/* @__PURE__ */ jsx63(
|
|
20362
|
+
"path",
|
|
20363
|
+
{
|
|
20364
|
+
d: "M7 8l3-3 3 3",
|
|
20365
|
+
stroke: "currentColor",
|
|
20366
|
+
strokeWidth: "1.5",
|
|
20367
|
+
strokeLinecap: "round",
|
|
20368
|
+
strokeLinejoin: "round",
|
|
20369
|
+
opacity: sort?.key === col.key && sort.order === "asc" ? 1 : 0.4
|
|
20370
|
+
}
|
|
20371
|
+
),
|
|
20372
|
+
/* @__PURE__ */ jsx63(
|
|
20373
|
+
"path",
|
|
20374
|
+
{
|
|
20375
|
+
d: "M7 12l3 3 3-3",
|
|
20376
|
+
stroke: "currentColor",
|
|
20377
|
+
strokeWidth: "1.5",
|
|
20378
|
+
strokeLinecap: "round",
|
|
20379
|
+
strokeLinejoin: "round",
|
|
20380
|
+
opacity: sort?.key === col.key && sort.order === "desc" ? 1 : 0.4
|
|
20381
|
+
}
|
|
20382
|
+
)
|
|
20383
|
+
] })
|
|
20384
|
+
}
|
|
20385
|
+
)
|
|
20380
20386
|
}
|
|
20381
20387
|
)
|
|
20382
20388
|
] });
|
|
@@ -20384,18 +20390,24 @@ function DataTableHeader({
|
|
|
20384
20390
|
Popover,
|
|
20385
20391
|
{
|
|
20386
20392
|
placement: "bottom-start",
|
|
20387
|
-
trigger: /* @__PURE__ */ jsx63(
|
|
20388
|
-
|
|
20393
|
+
trigger: /* @__PURE__ */ jsx63("span", { className: "inline-flex", children: /* @__PURE__ */ jsx63(
|
|
20394
|
+
Tooltip,
|
|
20389
20395
|
{
|
|
20390
|
-
|
|
20391
|
-
|
|
20392
|
-
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20396
|
+
placement: "top",
|
|
20397
|
+
content: /* @__PURE__ */ jsx63("span", { className: "text-xs font-medium", children: `Filter by ${String(col.title)}` }),
|
|
20398
|
+
children: /* @__PURE__ */ jsx63(
|
|
20399
|
+
"button",
|
|
20400
|
+
{
|
|
20401
|
+
className: cn(
|
|
20402
|
+
"p-1.5 rounded-lg transition-all duration-200 hover:bg-accent",
|
|
20403
|
+
filters[col.key] ? "bg-accent text-primary" : "text-muted-foreground"
|
|
20404
|
+
),
|
|
20405
|
+
"aria-label": "Filter",
|
|
20406
|
+
children: /* @__PURE__ */ jsx63(FilterIcon, { className: "w-4 h-4" })
|
|
20407
|
+
}
|
|
20408
|
+
)
|
|
20397
20409
|
}
|
|
20398
|
-
),
|
|
20410
|
+
) }),
|
|
20399
20411
|
children: /* @__PURE__ */ jsxs53("div", { className: "p-3 w-64 space-y-3", children: [
|
|
20400
20412
|
/* @__PURE__ */ jsxs53("div", { className: "flex items-center justify-between", children: [
|
|
20401
20413
|
/* @__PURE__ */ jsx63("div", { className: "text-sm font-medium", children: col.title }),
|
|
@@ -22475,16 +22487,22 @@ var EmojiList = forwardRef14((props, ref) => {
|
|
|
22475
22487
|
] }) }),
|
|
22476
22488
|
/* @__PURE__ */ jsxs63("div", { className: "p-3", children: [
|
|
22477
22489
|
/* @__PURE__ */ jsx74("div", { className: "grid grid-cols-8 gap-1", children: props.items.slice(0, 64).map((item, index) => /* @__PURE__ */ jsx74(
|
|
22478
|
-
|
|
22490
|
+
Tooltip,
|
|
22479
22491
|
{
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
"
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22492
|
+
placement: "top",
|
|
22493
|
+
content: /* @__PURE__ */ jsx74("span", { className: "text-xs font-medium", children: item.name.replace(/_/g, " ") }),
|
|
22494
|
+
children: /* @__PURE__ */ jsx74(
|
|
22495
|
+
"button",
|
|
22496
|
+
{
|
|
22497
|
+
type: "button",
|
|
22498
|
+
onClick: () => props.command(item),
|
|
22499
|
+
className: cn(
|
|
22500
|
+
"w-9 h-9 flex items-center justify-center rounded-lg text-xl transition-colors",
|
|
22501
|
+
selectedIndex === index ? "bg-primary/10 ring-2 ring-primary/30" : "hover:bg-accent"
|
|
22502
|
+
),
|
|
22503
|
+
children: item.emoji
|
|
22504
|
+
}
|
|
22505
|
+
)
|
|
22488
22506
|
},
|
|
22489
22507
|
item.name
|
|
22490
22508
|
)) }),
|
|
@@ -23147,7 +23165,7 @@ var EditorColorPalette = ({
|
|
|
23147
23165
|
label
|
|
23148
23166
|
}) => /* @__PURE__ */ jsxs65("div", { className: "p-2", children: [
|
|
23149
23167
|
/* @__PURE__ */ jsx76("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider px-2", children: label }),
|
|
23150
|
-
/* @__PURE__ */ jsx76("div", { className: "grid grid-cols-4 gap-1.5 mt-2", children: colors.map((c) => /* @__PURE__ */ jsxs65(
|
|
23168
|
+
/* @__PURE__ */ jsx76("div", { className: "grid grid-cols-4 gap-1.5 mt-2", children: colors.map((c) => /* @__PURE__ */ jsx76(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx76("span", { className: "text-xs font-medium", children: c.name }), children: /* @__PURE__ */ jsxs65(
|
|
23151
23169
|
"button",
|
|
23152
23170
|
{
|
|
23153
23171
|
type: "button",
|
|
@@ -23158,14 +23176,12 @@ var EditorColorPalette = ({
|
|
|
23158
23176
|
currentColor === c.color ? "border-primary ring-2 ring-primary/20" : "border-border/50 hover:border-primary/50"
|
|
23159
23177
|
),
|
|
23160
23178
|
style: { backgroundColor: c.color || "transparent" },
|
|
23161
|
-
title: c.name,
|
|
23162
23179
|
children: [
|
|
23163
23180
|
c.color === "" && /* @__PURE__ */ jsx76(X18, { className: "w-4 h-4 text-muted-foreground" }),
|
|
23164
23181
|
c.color === "inherit" && /* @__PURE__ */ jsx76("span", { className: "text-xs font-medium", children: "A" })
|
|
23165
23182
|
]
|
|
23166
|
-
}
|
|
23167
|
-
|
|
23168
|
-
)) })
|
|
23183
|
+
}
|
|
23184
|
+
) }, c.name)) })
|
|
23169
23185
|
] });
|
|
23170
23186
|
|
|
23171
23187
|
// src/components/UEditor/image-commands.ts
|
|
@@ -23360,17 +23376,17 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
23360
23376
|
};
|
|
23361
23377
|
|
|
23362
23378
|
// src/components/UEditor/emoji-picker.tsx
|
|
23363
|
-
import {
|
|
23364
|
-
import {
|
|
23379
|
+
import { Dumbbell as Dumbbell2, Flag as Flag2, Hash as Hash2, Leaf as Leaf2, Lightbulb as Lightbulb2, Search as Search7, Smile as Smile3, Utensils as Utensils2, X as X20 } from "lucide-react";
|
|
23380
|
+
import { useEffect as useEffect33, useMemo as useMemo23, useRef as useRef29, useState as useState43 } from "react";
|
|
23365
23381
|
import { jsx as jsx78, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
23366
23382
|
var CATEGORY_ICONS2 = {
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23383
|
+
smileys_people: Smile3,
|
|
23384
|
+
animals_nature: Leaf2,
|
|
23385
|
+
food_drink: Utensils2,
|
|
23386
|
+
activity: Dumbbell2,
|
|
23387
|
+
objects: Lightbulb2,
|
|
23388
|
+
symbols: Hash2,
|
|
23389
|
+
flags: Flag2
|
|
23374
23390
|
};
|
|
23375
23391
|
var EmojiPicker2 = ({ onSelect, onClose }) => {
|
|
23376
23392
|
const t = useSmartTranslations("UEditor");
|
|
@@ -23384,9 +23400,7 @@ var EmojiPicker2 = ({ onSelect, onClose }) => {
|
|
|
23384
23400
|
const query = search.toLowerCase();
|
|
23385
23401
|
return EMOJI_LIST.map((category) => ({
|
|
23386
23402
|
...category,
|
|
23387
|
-
emojis: category.emojis.filter(
|
|
23388
|
-
(emoji) => emoji.name.toLowerCase().includes(query) || emoji.emoji.includes(search)
|
|
23389
|
-
)
|
|
23403
|
+
emojis: category.emojis.filter((emoji) => emoji.name.toLowerCase().includes(query) || emoji.emoji.includes(search))
|
|
23390
23404
|
})).filter((category) => category.emojis.length > 0);
|
|
23391
23405
|
}, [search]);
|
|
23392
23406
|
const handleEmojiClick = (emoji) => {
|
|
@@ -23454,26 +23468,40 @@ var EmojiPicker2 = ({ onSelect, onClose }) => {
|
|
|
23454
23468
|
)
|
|
23455
23469
|
}
|
|
23456
23470
|
),
|
|
23457
|
-
search && /* @__PURE__ */ jsx78(
|
|
23458
|
-
"button",
|
|
23459
|
-
{
|
|
23460
|
-
onClick: () => setSearch(""),
|
|
23461
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
23462
|
-
children: /* @__PURE__ */ jsx78(X20, { className: "w-4 h-4" })
|
|
23463
|
-
}
|
|
23464
|
-
)
|
|
23471
|
+
search && /* @__PURE__ */ jsx78("button", { onClick: () => setSearch(""), className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx78(X20, { className: "w-4 h-4" }) })
|
|
23465
23472
|
] }) }),
|
|
23466
|
-
/* @__PURE__ */ jsx78(
|
|
23467
|
-
|
|
23468
|
-
{
|
|
23469
|
-
|
|
23470
|
-
className: "
|
|
23471
|
-
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
|
|
23476
|
-
|
|
23473
|
+
/* @__PURE__ */ jsx78("div", { ref: scrollContainerRef, className: "overflow-y-auto px-3 py-2 shrink", style: { height: "20rem" }, children: search ? (
|
|
23474
|
+
// Search Results
|
|
23475
|
+
filteredCategories.length > 0 ? filteredCategories.map((category) => /* @__PURE__ */ jsxs67("div", { className: "mb-4", children: [
|
|
23476
|
+
/* @__PURE__ */ jsx78("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1", children: category.name }),
|
|
23477
|
+
/* @__PURE__ */ jsx78("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ jsx78(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx78("span", { className: "text-xs font-medium", children: emoji.name.replace(/_/g, " ") }), children: /* @__PURE__ */ jsx78(
|
|
23478
|
+
"button",
|
|
23479
|
+
{
|
|
23480
|
+
onClick: () => handleEmojiClick(emoji.emoji),
|
|
23481
|
+
className: cn(
|
|
23482
|
+
"w-9 h-9 flex items-center justify-center rounded-lg",
|
|
23483
|
+
"text-2xl hover:bg-accent transition-colors",
|
|
23484
|
+
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
23485
|
+
),
|
|
23486
|
+
children: emoji.emoji
|
|
23487
|
+
}
|
|
23488
|
+
) }, emoji.name)) })
|
|
23489
|
+
] }, category.id)) : /* @__PURE__ */ jsxs67("div", { className: "flex flex-col items-center justify-center h-full text-center", children: [
|
|
23490
|
+
/* @__PURE__ */ jsx78("div", { className: "text-4xl mb-2", children: "\u{1F50D}" }),
|
|
23491
|
+
/* @__PURE__ */ jsx78("div", { className: "text-sm font-medium text-muted-foreground", children: t("emojiPicker.noResults") }),
|
|
23492
|
+
/* @__PURE__ */ jsx78("div", { className: "text-xs text-muted-foreground mt-1", children: t("emojiPicker.tryDifferentSearch") })
|
|
23493
|
+
] })
|
|
23494
|
+
) : (
|
|
23495
|
+
// All Categories - Messenger Style
|
|
23496
|
+
/* @__PURE__ */ jsx78("div", { className: "space-y-4", children: EMOJI_LIST.map((category) => /* @__PURE__ */ jsxs67(
|
|
23497
|
+
"div",
|
|
23498
|
+
{
|
|
23499
|
+
ref: (el) => {
|
|
23500
|
+
categoryRefs.current[category.id] = el;
|
|
23501
|
+
},
|
|
23502
|
+
children: [
|
|
23503
|
+
/* @__PURE__ */ jsx78("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1 z-10", children: category.name }),
|
|
23504
|
+
/* @__PURE__ */ jsx78("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ jsx78(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx78("span", { className: "text-xs font-medium", children: emoji.name.replace(/_/g, " ") }), children: /* @__PURE__ */ jsx78(
|
|
23477
23505
|
"button",
|
|
23478
23506
|
{
|
|
23479
23507
|
onClick: () => handleEmojiClick(emoji.emoji),
|
|
@@ -23482,47 +23510,14 @@ var EmojiPicker2 = ({ onSelect, onClose }) => {
|
|
|
23482
23510
|
"text-2xl hover:bg-accent transition-colors",
|
|
23483
23511
|
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
23484
23512
|
),
|
|
23485
|
-
title: emoji.name.replace(/_/g, " "),
|
|
23486
23513
|
children: emoji.emoji
|
|
23487
|
-
}
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
] })
|
|
23495
|
-
) : (
|
|
23496
|
-
// All Categories - Messenger Style
|
|
23497
|
-
/* @__PURE__ */ jsx78("div", { className: "space-y-4", children: EMOJI_LIST.map((category) => /* @__PURE__ */ jsxs67(
|
|
23498
|
-
"div",
|
|
23499
|
-
{
|
|
23500
|
-
ref: (el) => {
|
|
23501
|
-
categoryRefs.current[category.id] = el;
|
|
23502
|
-
},
|
|
23503
|
-
children: [
|
|
23504
|
-
/* @__PURE__ */ jsx78("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1 z-10", children: category.name }),
|
|
23505
|
-
/* @__PURE__ */ jsx78("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ jsx78(
|
|
23506
|
-
"button",
|
|
23507
|
-
{
|
|
23508
|
-
onClick: () => handleEmojiClick(emoji.emoji),
|
|
23509
|
-
className: cn(
|
|
23510
|
-
"w-9 h-9 flex items-center justify-center rounded-lg",
|
|
23511
|
-
"text-2xl hover:bg-accent transition-colors",
|
|
23512
|
-
"focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
23513
|
-
),
|
|
23514
|
-
title: emoji.name.replace(/_/g, " "),
|
|
23515
|
-
children: emoji.emoji
|
|
23516
|
-
},
|
|
23517
|
-
emoji.name
|
|
23518
|
-
)) })
|
|
23519
|
-
]
|
|
23520
|
-
},
|
|
23521
|
-
category.id
|
|
23522
|
-
)) })
|
|
23523
|
-
)
|
|
23524
|
-
}
|
|
23525
|
-
),
|
|
23514
|
+
}
|
|
23515
|
+
) }, emoji.name)) })
|
|
23516
|
+
]
|
|
23517
|
+
},
|
|
23518
|
+
category.id
|
|
23519
|
+
)) })
|
|
23520
|
+
) }),
|
|
23526
23521
|
!search && /* @__PURE__ */ jsx78("div", { className: "flex items-center justify-around px-2 py-2 border-t bg-muted/30 shrink-0", children: EMOJI_LIST.map((category) => {
|
|
23527
23522
|
const IconComponent = CATEGORY_ICONS2[category.id] || Smile3;
|
|
23528
23523
|
return /* @__PURE__ */ jsx78(
|
|
@@ -23533,8 +23528,7 @@ var EmojiPicker2 = ({ onSelect, onClose }) => {
|
|
|
23533
23528
|
"p-2 rounded-lg transition-colors",
|
|
23534
23529
|
activeCategory === category.id ? "text-primary bg-primary/10" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
23535
23530
|
),
|
|
23536
|
-
|
|
23537
|
-
children: /* @__PURE__ */ jsx78(IconComponent, { className: "w-5 h-5" })
|
|
23531
|
+
children: /* @__PURE__ */ jsx78(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx78("span", { className: "text-xs font-medium", children: category.name }), children: /* @__PURE__ */ jsx78("span", { className: "inline-flex", children: /* @__PURE__ */ jsx78(IconComponent, { className: "w-5 h-5" }) }) })
|
|
23538
23532
|
},
|
|
23539
23533
|
category.id
|
|
23540
23534
|
);
|
|
@@ -29037,12 +29031,23 @@ function buildLayout(editor, surface, cell) {
|
|
|
29037
29031
|
}
|
|
29038
29032
|
const surfaceRect = surface.getBoundingClientRect();
|
|
29039
29033
|
const tableRect = table.getBoundingClientRect();
|
|
29034
|
+
const wrapperElement = table.closest(".tableWrapper");
|
|
29035
|
+
const wrapper = wrapperElement instanceof HTMLElement ? wrapperElement : null;
|
|
29036
|
+
const wrapperRect = wrapper?.getBoundingClientRect() ?? tableRect;
|
|
29040
29037
|
const tableLeft = tableRect.left - surfaceRect.left + surface.scrollLeft;
|
|
29041
29038
|
const tableTop = tableRect.top - surfaceRect.top + surface.scrollTop;
|
|
29042
29039
|
const avgRowHeight = metricOrFallback(tableRect.height / rows.length, FALLBACK_TABLE_ROW_HEIGHT);
|
|
29043
29040
|
const avgColumnWidth = metricOrFallback(tableRect.width / referenceCells.length, FALLBACK_TABLE_COLUMN_WIDTH);
|
|
29044
29041
|
const tableWidth = metricOrFallback(tableRect.width, avgColumnWidth * referenceCells.length);
|
|
29045
29042
|
const tableHeight = metricOrFallback(tableRect.height, avgRowHeight * rows.length);
|
|
29043
|
+
const wrapperLeft = wrapperRect.left - surfaceRect.left + surface.scrollLeft;
|
|
29044
|
+
const wrapperTop = wrapperRect.top - surfaceRect.top + surface.scrollTop;
|
|
29045
|
+
const wrapperWidth = metricOrFallback(wrapperRect.width, tableWidth);
|
|
29046
|
+
const wrapperHeight = metricOrFallback(wrapperRect.height, tableHeight);
|
|
29047
|
+
const viewportWidth = metricOrFallback(wrapper?.clientWidth ?? wrapperRect.width, tableWidth);
|
|
29048
|
+
const viewportHeight = metricOrFallback(wrapper?.clientHeight ?? wrapperRect.height, tableHeight);
|
|
29049
|
+
const verticalScrollbarWidth = Math.max(0, Math.round(wrapperWidth - viewportWidth));
|
|
29050
|
+
const horizontalScrollbarHeight = Math.max(0, Math.round(wrapperHeight - viewportHeight));
|
|
29046
29051
|
const rowHandles = rows.map((tableRow, index) => {
|
|
29047
29052
|
const rowRect = tableRow.getBoundingClientRect();
|
|
29048
29053
|
const anchorCell = tableRow.cells.item(0) ?? cornerCell;
|
|
@@ -29077,6 +29082,14 @@ function buildLayout(editor, surface, cell) {
|
|
|
29077
29082
|
tableTop,
|
|
29078
29083
|
tableWidth,
|
|
29079
29084
|
tableHeight,
|
|
29085
|
+
wrapperLeft,
|
|
29086
|
+
wrapperTop,
|
|
29087
|
+
wrapperWidth,
|
|
29088
|
+
wrapperHeight,
|
|
29089
|
+
viewportWidth,
|
|
29090
|
+
viewportHeight,
|
|
29091
|
+
horizontalScrollbarHeight,
|
|
29092
|
+
verticalScrollbarWidth,
|
|
29080
29093
|
avgRowHeight,
|
|
29081
29094
|
avgColumnWidth,
|
|
29082
29095
|
rowHandles,
|
|
@@ -29119,6 +29132,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
29119
29132
|
const [layout, setLayout] = React74.useState(null);
|
|
29120
29133
|
const [dragPreview, setDragPreview] = React74.useState(null);
|
|
29121
29134
|
const [hoverState, setHoverState] = React74.useState(DEFAULT_HOVER_STATE);
|
|
29135
|
+
const [openMenuKey, setOpenMenuKey] = React74.useState(null);
|
|
29122
29136
|
const layoutRef = React74.useRef(null);
|
|
29123
29137
|
const dragStateRef = React74.useRef(null);
|
|
29124
29138
|
React74.useEffect(() => {
|
|
@@ -29160,11 +29174,21 @@ function TableControls({ editor, containerRef }) {
|
|
|
29160
29174
|
const surfaceRect = surface.getBoundingClientRect();
|
|
29161
29175
|
const relativeX = event.clientX - surfaceRect.left + surface.scrollLeft;
|
|
29162
29176
|
const relativeY = event.clientY - surfaceRect.top + surface.scrollTop;
|
|
29163
|
-
const
|
|
29164
|
-
const
|
|
29165
|
-
const
|
|
29166
|
-
const
|
|
29167
|
-
const
|
|
29177
|
+
const targetElement = resolveElement(event.target);
|
|
29178
|
+
const directRowHandle = targetElement?.closest?.("[data-row-handle-index]");
|
|
29179
|
+
const directColumnHandle = targetElement?.closest?.("[data-column-handle-index]");
|
|
29180
|
+
const directTableMenu = targetElement?.closest?.("[data-table-control='table-menu']");
|
|
29181
|
+
const directAddColumn = targetElement?.closest?.("[data-table-control='add-column']");
|
|
29182
|
+
const directAddRow = targetElement?.closest?.("[data-table-control='add-row']");
|
|
29183
|
+
const directRowHandleIndex = directRowHandle instanceof HTMLElement ? Number.parseInt(directRowHandle.dataset.rowHandleIndex ?? "", 10) : Number.NaN;
|
|
29184
|
+
const directColumnHandleIndex = directColumnHandle instanceof HTMLElement ? Number.parseInt(directColumnHandle.dataset.columnHandleIndex ?? "", 10) : Number.NaN;
|
|
29185
|
+
const visibleTableWidth2 = Math.min(activeLayout.tableWidth, activeLayout.viewportWidth);
|
|
29186
|
+
const visibleTableHeight2 = Math.min(activeLayout.tableHeight, activeLayout.viewportHeight);
|
|
29187
|
+
const rowHandleIndex = Number.isFinite(directRowHandleIndex) ? directRowHandleIndex : activeLayout.rowHandles.find((rowHandle) => relativeX >= activeLayout.tableLeft - ROW_HANDLE_HOVER_WIDTH && relativeX <= activeLayout.tableLeft && Math.abs(relativeY - rowHandle.center) <= HANDLE_HOVER_RADIUS)?.index ?? null;
|
|
29188
|
+
const columnHandleIndex = Number.isFinite(directColumnHandleIndex) ? directColumnHandleIndex : activeLayout.columnHandles.find((columnHandle) => relativeY >= activeLayout.tableTop - COLUMN_HANDLE_HOVER_HEIGHT && relativeY <= activeLayout.tableTop && Math.abs(relativeX - columnHandle.center) <= HANDLE_HOVER_RADIUS)?.index ?? null;
|
|
29189
|
+
const menuVisible = Boolean(directTableMenu) || relativeX >= activeLayout.tableLeft - MENU_HOVER_PADDING && relativeX <= activeLayout.tableLeft + 42 && relativeY >= activeLayout.tableTop - COLUMN_HANDLE_HOVER_HEIGHT && relativeY <= activeLayout.tableTop + MENU_HOVER_PADDING;
|
|
29190
|
+
const addColumnVisible = Boolean(directAddColumn) || relativeX >= activeLayout.wrapperLeft + visibleTableWidth2 && relativeX <= activeLayout.wrapperLeft + visibleTableWidth2 + ADD_COLUMN_HOVER_WIDTH && relativeY >= activeLayout.wrapperTop && relativeY <= activeLayout.wrapperTop + visibleTableHeight2;
|
|
29191
|
+
const addRowVisible = Boolean(directAddRow) || relativeY >= activeLayout.wrapperTop + activeLayout.wrapperHeight && relativeY <= activeLayout.wrapperTop + activeLayout.wrapperHeight + ADD_ROW_HOVER_HEIGHT && relativeX >= activeLayout.wrapperLeft && relativeX <= activeLayout.wrapperLeft + visibleTableWidth2;
|
|
29168
29192
|
setHoverState((prev) => {
|
|
29169
29193
|
if (prev.menuVisible === menuVisible && prev.addColumnVisible === addColumnVisible && prev.addRowVisible === addRowVisible && prev.rowHandleIndex === rowHandleIndex && prev.columnHandleIndex === columnHandleIndex) {
|
|
29170
29194
|
return prev;
|
|
@@ -29202,6 +29226,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
29202
29226
|
proseMirror.addEventListener("mouseover", handleMouseOver);
|
|
29203
29227
|
proseMirror.addEventListener("mouseleave", handleMouseLeave);
|
|
29204
29228
|
proseMirror.addEventListener("focusin", handleFocusIn);
|
|
29229
|
+
surface.addEventListener("mouseover", handleSurfaceMouseMove);
|
|
29205
29230
|
surface.addEventListener("mousemove", handleSurfaceMouseMove);
|
|
29206
29231
|
surface.addEventListener("scroll", refreshCurrentLayout, { passive: true });
|
|
29207
29232
|
window.addEventListener("resize", refreshCurrentLayout);
|
|
@@ -29212,6 +29237,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
29212
29237
|
proseMirror.removeEventListener("mouseover", handleMouseOver);
|
|
29213
29238
|
proseMirror.removeEventListener("mouseleave", handleMouseLeave);
|
|
29214
29239
|
proseMirror.removeEventListener("focusin", handleFocusIn);
|
|
29240
|
+
surface.removeEventListener("mouseover", handleSurfaceMouseMove);
|
|
29215
29241
|
surface.removeEventListener("mousemove", handleSurfaceMouseMove);
|
|
29216
29242
|
surface.removeEventListener("scroll", refreshCurrentLayout);
|
|
29217
29243
|
window.removeEventListener("resize", refreshCurrentLayout);
|
|
@@ -29309,6 +29335,9 @@ function TableControls({ editor, containerRef }) {
|
|
|
29309
29335
|
}, [runAtCornerCell, syncFromSelection]);
|
|
29310
29336
|
const canExpandTable = Boolean(layout);
|
|
29311
29337
|
const controlsVisible = dragPreview !== null;
|
|
29338
|
+
const tableMenuOpen = openMenuKey === "table";
|
|
29339
|
+
const getRowMenuKey = React74.useCallback((index) => `row:${index}`, []);
|
|
29340
|
+
const getColumnMenuKey = React74.useCallback((index) => `column:${index}`, []);
|
|
29312
29341
|
React74.useEffect(() => {
|
|
29313
29342
|
const handleMouseMove = (event) => {
|
|
29314
29343
|
const dragState = dragStateRef.current;
|
|
@@ -29512,62 +29541,77 @@ function TableControls({ editor, containerRef }) {
|
|
|
29512
29541
|
const menuLeft = Math.max(8, layout.tableLeft);
|
|
29513
29542
|
const rowHandleLeft = Math.max(8, layout.tableLeft - 66);
|
|
29514
29543
|
const columnHandleTop = Math.max(8, layout.tableTop - 14);
|
|
29515
|
-
const
|
|
29516
|
-
const
|
|
29517
|
-
const
|
|
29518
|
-
const
|
|
29544
|
+
const visibleTableWidth = Math.min(layout.tableWidth, layout.viewportWidth);
|
|
29545
|
+
const visibleTableHeight = Math.min(layout.tableHeight, layout.viewportHeight);
|
|
29546
|
+
const columnRailTop = layout.wrapperTop;
|
|
29547
|
+
const columnRailLeft = layout.wrapperLeft + visibleTableWidth + 8;
|
|
29548
|
+
const rowRailTop = layout.wrapperTop + layout.wrapperHeight + 8;
|
|
29549
|
+
const rowRailLeft = layout.wrapperLeft;
|
|
29519
29550
|
const expandPreviewWidth = dragPreview?.kind === "add-column" ? layout.tableWidth + dragPreview.previewCols * layout.avgColumnWidth : layout.tableWidth;
|
|
29520
29551
|
const expandPreviewHeight = dragPreview?.kind === "add-row" ? layout.tableHeight + dragPreview.previewRows * layout.avgRowHeight : layout.tableHeight;
|
|
29521
29552
|
const dragStatusText = dragPreview?.kind === "row" ? `${t("tableMenu.dragRow")} ${dragPreview.originIndex + 1} -> ${dragPreview.targetIndex + 1}` : dragPreview?.kind === "column" ? `${t("tableMenu.dragColumn")} ${dragPreview.originIndex + 1} -> ${dragPreview.targetIndex + 1}` : dragPreview?.kind === "add-row" ? `+${dragPreview.previewRows}R` : dragPreview?.kind === "add-column" ? `+${dragPreview.previewCols}C` : null;
|
|
29522
29553
|
return /* @__PURE__ */ jsxs71(Fragment27, { children: [
|
|
29523
29554
|
layout.rowHandles.map((rowHandle) => {
|
|
29524
|
-
const
|
|
29555
|
+
const menuKey = getRowMenuKey(rowHandle.index);
|
|
29556
|
+
const visible = controlsVisible || hoverState.rowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
29525
29557
|
if (!visible) return null;
|
|
29526
29558
|
return /* @__PURE__ */ jsx81(
|
|
29527
29559
|
"div",
|
|
29528
29560
|
{
|
|
29529
29561
|
className: "absolute z-30",
|
|
29562
|
+
"data-row-handle-index": rowHandle.index,
|
|
29530
29563
|
style: {
|
|
29531
29564
|
top: Math.max(8, rowHandle.center - 12),
|
|
29532
29565
|
left: rowHandleLeft
|
|
29533
29566
|
},
|
|
29534
29567
|
children: /* @__PURE__ */ jsx81(
|
|
29535
|
-
|
|
29568
|
+
Tooltip,
|
|
29536
29569
|
{
|
|
29537
29570
|
placement: "right",
|
|
29538
|
-
|
|
29539
|
-
|
|
29540
|
-
|
|
29571
|
+
content: /* @__PURE__ */ jsx81("span", { className: "text-xs font-medium", children: `${t("tableMenu.dragRow")} ${rowHandle.index + 1}` }),
|
|
29572
|
+
children: /* @__PURE__ */ jsx81("span", { className: "inline-flex", children: /* @__PURE__ */ jsx81(
|
|
29573
|
+
DropdownMenu,
|
|
29541
29574
|
{
|
|
29542
|
-
|
|
29543
|
-
|
|
29544
|
-
|
|
29545
|
-
|
|
29546
|
-
event.preventDefault();
|
|
29547
|
-
event.stopPropagation();
|
|
29548
|
-
dragStateRef.current = {
|
|
29549
|
-
kind: "row",
|
|
29550
|
-
originIndex: rowHandle.index,
|
|
29551
|
-
targetIndex: rowHandle.index,
|
|
29552
|
-
anchorPos: rowHandle.cellPos
|
|
29553
|
-
};
|
|
29554
|
-
setDragPreview({
|
|
29555
|
-
kind: "row",
|
|
29556
|
-
originIndex: rowHandle.index,
|
|
29557
|
-
targetIndex: rowHandle.index,
|
|
29558
|
-
targetStart: rowHandle.start,
|
|
29559
|
-
targetSize: rowHandle.size
|
|
29560
|
-
});
|
|
29561
|
-
document.body.style.cursor = "grabbing";
|
|
29575
|
+
placement: "right",
|
|
29576
|
+
isOpen: openMenuKey === menuKey,
|
|
29577
|
+
onOpenChange: (open) => {
|
|
29578
|
+
setOpenMenuKey((prev) => open ? menuKey : prev === menuKey ? null : prev);
|
|
29562
29579
|
},
|
|
29563
|
-
|
|
29564
|
-
|
|
29565
|
-
"
|
|
29566
|
-
|
|
29567
|
-
|
|
29568
|
-
|
|
29580
|
+
items: getRowHandleMenuItems(rowHandle),
|
|
29581
|
+
trigger: /* @__PURE__ */ jsx81(
|
|
29582
|
+
"button",
|
|
29583
|
+
{
|
|
29584
|
+
type: "button",
|
|
29585
|
+
"aria-label": `${t("tableMenu.dragRow")} ${rowHandle.index + 1}`,
|
|
29586
|
+
onMouseDown: (event) => {
|
|
29587
|
+
event.preventDefault();
|
|
29588
|
+
event.stopPropagation();
|
|
29589
|
+
setOpenMenuKey(null);
|
|
29590
|
+
dragStateRef.current = {
|
|
29591
|
+
kind: "row",
|
|
29592
|
+
originIndex: rowHandle.index,
|
|
29593
|
+
targetIndex: rowHandle.index,
|
|
29594
|
+
anchorPos: rowHandle.cellPos
|
|
29595
|
+
};
|
|
29596
|
+
setDragPreview({
|
|
29597
|
+
kind: "row",
|
|
29598
|
+
originIndex: rowHandle.index,
|
|
29599
|
+
targetIndex: rowHandle.index,
|
|
29600
|
+
targetStart: rowHandle.start,
|
|
29601
|
+
targetSize: rowHandle.size
|
|
29602
|
+
});
|
|
29603
|
+
document.body.style.cursor = "grabbing";
|
|
29604
|
+
},
|
|
29605
|
+
className: cn(
|
|
29606
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-full",
|
|
29607
|
+
"border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur",
|
|
29608
|
+
"transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground"
|
|
29609
|
+
),
|
|
29610
|
+
children: /* @__PURE__ */ jsx81(GripVertical3, { className: "h-3.5 w-3.5" })
|
|
29611
|
+
}
|
|
29612
|
+
)
|
|
29569
29613
|
}
|
|
29570
|
-
)
|
|
29614
|
+
) })
|
|
29571
29615
|
}
|
|
29572
29616
|
)
|
|
29573
29617
|
},
|
|
@@ -29575,147 +29619,187 @@ function TableControls({ editor, containerRef }) {
|
|
|
29575
29619
|
);
|
|
29576
29620
|
}),
|
|
29577
29621
|
layout.columnHandles.map((columnHandle) => {
|
|
29578
|
-
const
|
|
29622
|
+
const menuKey = getColumnMenuKey(columnHandle.index);
|
|
29623
|
+
const visible = controlsVisible || hoverState.columnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
29579
29624
|
if (!visible) return null;
|
|
29580
29625
|
return /* @__PURE__ */ jsx81(
|
|
29581
29626
|
"div",
|
|
29582
29627
|
{
|
|
29583
29628
|
className: "absolute z-30",
|
|
29629
|
+
"data-column-handle-index": columnHandle.index,
|
|
29584
29630
|
style: {
|
|
29585
29631
|
top: columnHandleTop,
|
|
29586
29632
|
left: Math.max(8, columnHandle.center - 12)
|
|
29587
29633
|
},
|
|
29588
29634
|
children: /* @__PURE__ */ jsx81(
|
|
29589
|
-
|
|
29635
|
+
Tooltip,
|
|
29590
29636
|
{
|
|
29591
|
-
placement: "
|
|
29592
|
-
|
|
29593
|
-
|
|
29594
|
-
|
|
29637
|
+
placement: "top",
|
|
29638
|
+
content: /* @__PURE__ */ jsx81("span", { className: "text-xs font-medium", children: `${t("tableMenu.dragColumn")} ${columnHandle.index + 1}` }),
|
|
29639
|
+
children: /* @__PURE__ */ jsx81("span", { className: "inline-flex", children: /* @__PURE__ */ jsx81(
|
|
29640
|
+
DropdownMenu,
|
|
29595
29641
|
{
|
|
29596
|
-
|
|
29597
|
-
|
|
29598
|
-
|
|
29599
|
-
|
|
29600
|
-
event.preventDefault();
|
|
29601
|
-
event.stopPropagation();
|
|
29602
|
-
dragStateRef.current = {
|
|
29603
|
-
kind: "column",
|
|
29604
|
-
originIndex: columnHandle.index,
|
|
29605
|
-
targetIndex: columnHandle.index,
|
|
29606
|
-
anchorPos: columnHandle.cellPos
|
|
29607
|
-
};
|
|
29608
|
-
setDragPreview({
|
|
29609
|
-
kind: "column",
|
|
29610
|
-
originIndex: columnHandle.index,
|
|
29611
|
-
targetIndex: columnHandle.index,
|
|
29612
|
-
targetStart: columnHandle.start,
|
|
29613
|
-
targetSize: columnHandle.size
|
|
29614
|
-
});
|
|
29615
|
-
document.body.style.cursor = "grabbing";
|
|
29642
|
+
placement: "bottom-start",
|
|
29643
|
+
isOpen: openMenuKey === menuKey,
|
|
29644
|
+
onOpenChange: (open) => {
|
|
29645
|
+
setOpenMenuKey((prev) => open ? menuKey : prev === menuKey ? null : prev);
|
|
29616
29646
|
},
|
|
29617
|
-
|
|
29618
|
-
|
|
29619
|
-
"
|
|
29620
|
-
|
|
29621
|
-
|
|
29622
|
-
|
|
29647
|
+
items: getColumnHandleMenuItems(columnHandle),
|
|
29648
|
+
trigger: /* @__PURE__ */ jsx81(
|
|
29649
|
+
"button",
|
|
29650
|
+
{
|
|
29651
|
+
type: "button",
|
|
29652
|
+
"aria-label": `${t("tableMenu.dragColumn")} ${columnHandle.index + 1}`,
|
|
29653
|
+
onMouseDown: (event) => {
|
|
29654
|
+
event.preventDefault();
|
|
29655
|
+
event.stopPropagation();
|
|
29656
|
+
setOpenMenuKey(null);
|
|
29657
|
+
dragStateRef.current = {
|
|
29658
|
+
kind: "column",
|
|
29659
|
+
originIndex: columnHandle.index,
|
|
29660
|
+
targetIndex: columnHandle.index,
|
|
29661
|
+
anchorPos: columnHandle.cellPos
|
|
29662
|
+
};
|
|
29663
|
+
setDragPreview({
|
|
29664
|
+
kind: "column",
|
|
29665
|
+
originIndex: columnHandle.index,
|
|
29666
|
+
targetIndex: columnHandle.index,
|
|
29667
|
+
targetStart: columnHandle.start,
|
|
29668
|
+
targetSize: columnHandle.size
|
|
29669
|
+
});
|
|
29670
|
+
document.body.style.cursor = "grabbing";
|
|
29671
|
+
},
|
|
29672
|
+
className: cn(
|
|
29673
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-full",
|
|
29674
|
+
"border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur",
|
|
29675
|
+
"transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground"
|
|
29676
|
+
),
|
|
29677
|
+
children: /* @__PURE__ */ jsx81(GripHorizontal, { className: "h-3.5 w-3.5" })
|
|
29678
|
+
}
|
|
29679
|
+
)
|
|
29623
29680
|
}
|
|
29624
|
-
)
|
|
29681
|
+
) })
|
|
29625
29682
|
}
|
|
29626
29683
|
)
|
|
29627
29684
|
},
|
|
29628
29685
|
`column-handle-${columnHandle.index}`
|
|
29629
29686
|
);
|
|
29630
29687
|
}),
|
|
29631
|
-
(controlsVisible || hoverState.menuVisible) && /* @__PURE__ */ jsx81(
|
|
29688
|
+
(controlsVisible || hoverState.menuVisible || tableMenuOpen) && /* @__PURE__ */ jsx81(
|
|
29632
29689
|
"div",
|
|
29633
29690
|
{
|
|
29634
29691
|
className: "absolute z-30",
|
|
29692
|
+
"data-table-control": "table-menu",
|
|
29635
29693
|
style: {
|
|
29636
29694
|
top: menuTop,
|
|
29637
29695
|
left: menuLeft
|
|
29638
29696
|
},
|
|
29639
29697
|
children: /* @__PURE__ */ jsx81(
|
|
29640
|
-
|
|
29698
|
+
Tooltip,
|
|
29641
29699
|
{
|
|
29642
|
-
placement: "
|
|
29643
|
-
|
|
29644
|
-
|
|
29645
|
-
|
|
29700
|
+
placement: "top",
|
|
29701
|
+
content: /* @__PURE__ */ jsx81("span", { className: "text-xs font-medium", children: t("tableMenu.openControls") }),
|
|
29702
|
+
children: /* @__PURE__ */ jsx81("span", { className: "inline-flex", children: /* @__PURE__ */ jsx81(
|
|
29703
|
+
DropdownMenu,
|
|
29646
29704
|
{
|
|
29647
|
-
|
|
29648
|
-
|
|
29649
|
-
|
|
29650
|
-
|
|
29651
|
-
|
|
29652
|
-
|
|
29653
|
-
|
|
29654
|
-
"
|
|
29655
|
-
|
|
29656
|
-
|
|
29705
|
+
placement: "bottom-start",
|
|
29706
|
+
isOpen: tableMenuOpen,
|
|
29707
|
+
onOpenChange: (open) => {
|
|
29708
|
+
setOpenMenuKey((prev) => open ? "table" : prev === "table" ? null : prev);
|
|
29709
|
+
},
|
|
29710
|
+
items: menuItems,
|
|
29711
|
+
trigger: /* @__PURE__ */ jsx81(
|
|
29712
|
+
"button",
|
|
29713
|
+
{
|
|
29714
|
+
type: "button",
|
|
29715
|
+
"aria-label": t("tableMenu.openControls"),
|
|
29716
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
29717
|
+
className: cn(
|
|
29718
|
+
"pointer-events-auto inline-flex h-7 w-7 items-center justify-center rounded-full",
|
|
29719
|
+
"border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur",
|
|
29720
|
+
"transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground"
|
|
29721
|
+
),
|
|
29722
|
+
children: /* @__PURE__ */ jsx81(MoreHorizontal2, { className: "h-4 w-4" })
|
|
29723
|
+
}
|
|
29724
|
+
)
|
|
29657
29725
|
}
|
|
29658
|
-
)
|
|
29726
|
+
) })
|
|
29659
29727
|
}
|
|
29660
29728
|
)
|
|
29661
29729
|
}
|
|
29662
29730
|
),
|
|
29663
29731
|
(controlsVisible || hoverState.addColumnVisible) && /* @__PURE__ */ jsx81(
|
|
29664
|
-
|
|
29732
|
+
Tooltip,
|
|
29665
29733
|
{
|
|
29666
|
-
|
|
29667
|
-
"
|
|
29668
|
-
|
|
29669
|
-
|
|
29670
|
-
|
|
29671
|
-
|
|
29672
|
-
|
|
29673
|
-
|
|
29674
|
-
|
|
29675
|
-
|
|
29676
|
-
|
|
29677
|
-
|
|
29678
|
-
|
|
29679
|
-
|
|
29680
|
-
|
|
29681
|
-
|
|
29682
|
-
|
|
29683
|
-
|
|
29684
|
-
|
|
29685
|
-
|
|
29686
|
-
|
|
29687
|
-
|
|
29688
|
-
|
|
29689
|
-
|
|
29734
|
+
placement: "right",
|
|
29735
|
+
content: /* @__PURE__ */ jsx81("span", { className: "text-xs font-medium", children: t("tableMenu.quickAddColumnAfter") }),
|
|
29736
|
+
children: /* @__PURE__ */ jsx81(
|
|
29737
|
+
"button",
|
|
29738
|
+
{
|
|
29739
|
+
type: "button",
|
|
29740
|
+
"data-table-control": "add-column",
|
|
29741
|
+
"aria-label": t("tableMenu.quickAddColumnAfter"),
|
|
29742
|
+
onMouseDown: (event) => {
|
|
29743
|
+
event.preventDefault();
|
|
29744
|
+
event.stopPropagation();
|
|
29745
|
+
setOpenMenuKey(null);
|
|
29746
|
+
if (!canExpandTable) return;
|
|
29747
|
+
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
29748
|
+
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
29749
|
+
document.body.style.cursor = "ew-resize";
|
|
29750
|
+
},
|
|
29751
|
+
disabled: !canExpandTable,
|
|
29752
|
+
className: cn(
|
|
29753
|
+
"absolute z-30 inline-flex items-center justify-center rounded-md",
|
|
29754
|
+
"border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
|
|
29755
|
+
"transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
|
|
29756
|
+
),
|
|
29757
|
+
style: {
|
|
29758
|
+
top: columnRailTop,
|
|
29759
|
+
left: columnRailLeft,
|
|
29760
|
+
width: 18,
|
|
29761
|
+
height: visibleTableHeight
|
|
29762
|
+
},
|
|
29763
|
+
children: /* @__PURE__ */ jsx81("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
29764
|
+
}
|
|
29765
|
+
)
|
|
29690
29766
|
}
|
|
29691
29767
|
),
|
|
29692
29768
|
(controlsVisible || hoverState.addRowVisible) && /* @__PURE__ */ jsx81(
|
|
29693
|
-
|
|
29769
|
+
Tooltip,
|
|
29694
29770
|
{
|
|
29695
|
-
|
|
29696
|
-
"
|
|
29697
|
-
|
|
29698
|
-
|
|
29699
|
-
|
|
29700
|
-
|
|
29701
|
-
|
|
29702
|
-
|
|
29703
|
-
|
|
29704
|
-
|
|
29705
|
-
|
|
29706
|
-
|
|
29707
|
-
|
|
29708
|
-
|
|
29709
|
-
|
|
29710
|
-
|
|
29711
|
-
|
|
29712
|
-
|
|
29713
|
-
|
|
29714
|
-
|
|
29715
|
-
|
|
29716
|
-
|
|
29717
|
-
|
|
29718
|
-
|
|
29771
|
+
placement: "bottom",
|
|
29772
|
+
content: /* @__PURE__ */ jsx81("span", { className: "text-xs font-medium", children: t("tableMenu.quickAddRowAfter") }),
|
|
29773
|
+
children: /* @__PURE__ */ jsx81(
|
|
29774
|
+
"button",
|
|
29775
|
+
{
|
|
29776
|
+
type: "button",
|
|
29777
|
+
"data-table-control": "add-row",
|
|
29778
|
+
"aria-label": t("tableMenu.quickAddRowAfter"),
|
|
29779
|
+
onMouseDown: (event) => {
|
|
29780
|
+
event.preventDefault();
|
|
29781
|
+
event.stopPropagation();
|
|
29782
|
+
setOpenMenuKey(null);
|
|
29783
|
+
if (!canExpandTable) return;
|
|
29784
|
+
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
29785
|
+
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
29786
|
+
document.body.style.cursor = "ns-resize";
|
|
29787
|
+
},
|
|
29788
|
+
disabled: !canExpandTable,
|
|
29789
|
+
className: cn(
|
|
29790
|
+
"absolute z-30 inline-flex items-center justify-center rounded-md",
|
|
29791
|
+
"border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
|
|
29792
|
+
"transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
|
|
29793
|
+
),
|
|
29794
|
+
style: {
|
|
29795
|
+
top: rowRailTop,
|
|
29796
|
+
left: rowRailLeft,
|
|
29797
|
+
width: visibleTableWidth,
|
|
29798
|
+
height: 16
|
|
29799
|
+
},
|
|
29800
|
+
children: /* @__PURE__ */ jsx81("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
29801
|
+
}
|
|
29802
|
+
)
|
|
29719
29803
|
}
|
|
29720
29804
|
),
|
|
29721
29805
|
dragPreview?.kind === "row" && /* @__PURE__ */ jsxs71(Fragment27, { children: [
|
|
@@ -30069,7 +30153,20 @@ var UEditor = React75.forwardRef(({
|
|
|
30069
30153
|
"[&_pre]:text-[#d4d4d4]!",
|
|
30070
30154
|
"[&_pre_code]:bg-transparent!",
|
|
30071
30155
|
"[&_.tableWrapper]:overflow-x-auto",
|
|
30156
|
+
"[&_.tableWrapper]:pb-1.5",
|
|
30072
30157
|
"[&_.tableWrapper]:select-text",
|
|
30158
|
+
"[&_.tableWrapper]:[scrollbar-width:thin]",
|
|
30159
|
+
"[&_.tableWrapper]:[scrollbar-color:hsl(var(--border))_transparent]",
|
|
30160
|
+
"[&_.tableWrapper::-webkit-scrollbar]:h-2",
|
|
30161
|
+
"[&_.tableWrapper::-webkit-scrollbar]:w-2",
|
|
30162
|
+
"[&_.tableWrapper::-webkit-scrollbar-track]:rounded-full",
|
|
30163
|
+
"[&_.tableWrapper::-webkit-scrollbar-track]:bg-transparent",
|
|
30164
|
+
"[&_.tableWrapper::-webkit-scrollbar-thumb]:rounded-full",
|
|
30165
|
+
"[&_.tableWrapper::-webkit-scrollbar-thumb]:border",
|
|
30166
|
+
"[&_.tableWrapper::-webkit-scrollbar-thumb]:border-solid",
|
|
30167
|
+
"[&_.tableWrapper::-webkit-scrollbar-thumb]:border-transparent",
|
|
30168
|
+
"[&_.tableWrapper::-webkit-scrollbar-thumb]:bg-border/70",
|
|
30169
|
+
"[&_.tableWrapper::-webkit-scrollbar-thumb:hover]:bg-muted-foreground/45",
|
|
30073
30170
|
"[&_table]:table-fixed",
|
|
30074
30171
|
"[&_table]:overflow-hidden",
|
|
30075
30172
|
"[&_table]:select-text",
|
|
@@ -30089,15 +30186,27 @@ var UEditor = React75.forwardRef(({
|
|
|
30089
30186
|
"[&_.selectedCell]:after:pointer-events-none",
|
|
30090
30187
|
"[&_.column-resize-handle]:pointer-events-auto",
|
|
30091
30188
|
"[&_.column-resize-handle]:cursor-col-resize",
|
|
30092
|
-
"[&_.column-resize-handle]:
|
|
30093
|
-
"[&_.column-resize-handle]:
|
|
30094
|
-
"[&_.column-resize-handle]:
|
|
30189
|
+
"[&_.column-resize-handle]:absolute",
|
|
30190
|
+
"[&_.column-resize-handle]:top-[-1px]",
|
|
30191
|
+
"[&_.column-resize-handle]:bottom-[-1px]",
|
|
30192
|
+
"[&_.column-resize-handle]:right-[-5px]",
|
|
30193
|
+
"[&_.column-resize-handle]:z-10",
|
|
30194
|
+
"[&_.column-resize-handle]:w-2.5",
|
|
30195
|
+
"[&_.column-resize-handle]:bg-transparent",
|
|
30196
|
+
"[&_.column-resize-handle]:rounded-none",
|
|
30095
30197
|
"[&_.column-resize-handle]:opacity-0",
|
|
30096
|
-
"[&_.column-resize-handle]:
|
|
30097
|
-
"[&_.column-resize-handle]:
|
|
30198
|
+
"[&_.column-resize-handle]:transition-opacity",
|
|
30199
|
+
"[&_.column-resize-handle]:after:absolute",
|
|
30200
|
+
"[&_.column-resize-handle]:after:top-0",
|
|
30201
|
+
"[&_.column-resize-handle]:after:bottom-0",
|
|
30202
|
+
"[&_.column-resize-handle]:after:left-1/2",
|
|
30203
|
+
"[&_.column-resize-handle]:after:w-0.5",
|
|
30204
|
+
"[&_.column-resize-handle]:after:-translate-x-1/2",
|
|
30205
|
+
"[&_.column-resize-handle]:after:rounded-full",
|
|
30206
|
+
"[&_.column-resize-handle]:after:bg-primary/75",
|
|
30207
|
+
"[&_.column-resize-handle]:after:content-['']",
|
|
30098
30208
|
"[&.resize-cursor_.column-resize-handle]:opacity-100",
|
|
30099
|
-
"[&.resize-cursor_.column-resize-handle]:bg-primary",
|
|
30100
|
-
"[&.resize-cursor_.column-resize-handle]:shadow-md",
|
|
30209
|
+
"[&.resize-cursor_.column-resize-handle]:after:bg-primary",
|
|
30101
30210
|
"[&.resize-cursor]:cursor-col-resize",
|
|
30102
30211
|
"[&.resize-row-cursor]:cursor-row-resize",
|
|
30103
30212
|
"[&_img.ProseMirror-selectednode]:ring-2",
|