@lv-x-software-house/x_view 1.2.6-dev.55 → 1.2.6-dev.57

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 CHANGED
@@ -3387,9 +3387,11 @@ function ContextMenu({
3387
3387
  viewMembers,
3388
3388
  currentUser,
3389
3389
  onStartQuest,
3390
- onFinishQuest
3390
+ onFinishQuest,
3391
+ renderedNodeIds = [],
3392
+ renderedLinkIds = []
3391
3393
  }) {
3392
- var _a, _b, _c;
3394
+ var _a, _b;
3393
3395
  const menuRef = (0, import_react2.useRef)(null);
3394
3396
  const [menuPos, setMenuPos] = (0, import_react2.useState)({ left: 0, top: 0 });
3395
3397
  const [menuView, setMenuView] = (0, import_react2.useState)("main");
@@ -3434,6 +3436,13 @@ function ContextMenu({
3434
3436
  document.addEventListener("mousedown", handleClickOutside);
3435
3437
  return () => document.removeEventListener("mousedown", handleClickOutside);
3436
3438
  }, [data.visible, onClose]);
3439
+ const visibleLinkIds = (0, import_react2.useMemo)(() => {
3440
+ var _a2;
3441
+ return /* @__PURE__ */ new Set([
3442
+ ...((_a2 = sceneData == null ? void 0 : sceneData.links) == null ? void 0 : _a2.map((link) => String(link.id))) ?? [],
3443
+ ...renderedLinkIds.map((id) => String(id))
3444
+ ]);
3445
+ }, [sceneData == null ? void 0 : sceneData.links, renderedLinkIds]);
3437
3446
  if (!data.visible) return null;
3438
3447
  const swallow = (e) => e.stopPropagation();
3439
3448
  const baseButtonClass = "w-full flex items-center gap-2.5 px-2 py-1.5 text-left text-sm rounded-md hover:bg-indigo-500/20 text-slate-200 hover:text-white transition-colors duration-150 truncate";
@@ -3450,7 +3459,6 @@ function ContextMenu({
3450
3459
  }
3451
3460
  return -Infinity;
3452
3461
  };
3453
- const visibleLinkIds = new Set(((_b = sceneData == null ? void 0 : sceneData.links) == null ? void 0 : _b.map((link) => String(link.id))) ?? []);
3454
3462
  const allParentLinks = Object.values(parentData).flatMap((fileData) => fileData.links || []);
3455
3463
  const nodeMap = new Map(allParentNodes.map((node) => [String(node.id), node]));
3456
3464
  const connections = allParentLinks.filter((link) => {
@@ -3467,7 +3475,7 @@ function ContextMenu({
3467
3475
  var _a2;
3468
3476
  return c.targetNode && !(((_a2 = c.targetNode.version_node) == null ? void 0 : _a2.is_version) && String(c.targetNode.version_node.parent_node) === String(data.nodeData.id));
3469
3477
  });
3470
- const isCurrentNodeQuest = ((_c = data.nodeData) == null ? void 0 : _c.is_quest) === true;
3478
+ const isCurrentNodeQuest = ((_b = data.nodeData) == null ? void 0 : _b.is_quest) === true;
3471
3479
  const commonConnections = isCurrentNodeQuest ? connections : connections.filter((c) => {
3472
3480
  var _a2;
3473
3481
  return !((_a2 = c.targetNode) == null ? void 0 : _a2.is_quest);
@@ -3592,14 +3600,14 @@ function ContextMenu({
3592
3600
  });
3593
3601
  };
3594
3602
  const renderMainView = () => {
3595
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
3603
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
3596
3604
  const hasVersions = computedVersions.length > 0;
3597
3605
  const canCreateVersion = ability.can("create", "Versioning");
3598
3606
  const canReadVersion = ability.can("read", "Versioning");
3599
3607
  const shouldShowVersioningBtn = canCreateVersion || canReadVersion && hasVersions;
3600
3608
  const canStartQuest = isCurrentNodeQuest && (((_a2 = data.nodeData) == null ? void 0 : _a2.status) === "Backlog" || !((_b2 = data.nodeData) == null ? void 0 : _b2.status));
3601
3609
  const isQuestActuallyBlocked = canStartQuest && blockedStatus.isBlocked;
3602
- const canFinishQuest = isCurrentNodeQuest && ((_c2 = data.nodeData) == null ? void 0 : _c2.assignee_id) === (currentUser == null ? void 0 : currentUser.id) && ((_d = data.nodeData) == null ? void 0 : _d.status) !== "Backlog" && ((_e = data.nodeData) == null ? void 0 : _e.status) !== "Done";
3610
+ const canFinishQuest = isCurrentNodeQuest && ((_c = data.nodeData) == null ? void 0 : _c.assignee_id) === (currentUser == null ? void 0 : currentUser.id) && ((_d = data.nodeData) == null ? void 0 : _d.status) !== "Backlog" && ((_e = data.nodeData) == null ? void 0 : _e.status) !== "Done";
3603
3611
  return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: "flex items-center gap-2 px-2 pt-1 pb-2" }, /* @__PURE__ */ import_react2.default.createElement("span", { className: "inline-flex h-2 w-2 rounded-full bg-indigo-400/80 shadow-[0_0_12px_1px_rgba(99,102,241,0.5)]" }), /* @__PURE__ */ import_react2.default.createElement("p", { className: "text-[11px] uppercase tracking-wider text-slate-400" }, "A\xE7\xF5es R\xE1pidas")), /* @__PURE__ */ import_react2.default.createElement("div", { className: "flex flex-col gap-1" }, canStartQuest && /* @__PURE__ */ import_react2.default.createElement(
3604
3612
  "button",
3605
3613
  {
@@ -19485,6 +19493,11 @@ function XViewScene({
19485
19493
  parentData: parentDataRef.current,
19486
19494
  sceneData: sceneDataRef.current,
19487
19495
  ancestryData: ancestryDataRef.current,
19496
+ renderedNodeIds: Object.keys(stateRef.current.nodeObjects || {}),
19497
+ renderedLinkIds: (stateRef.current.allLinks || []).map((l) => {
19498
+ var _a2;
19499
+ return String((_a2 = l.userData) == null ? void 0 : _a2.id);
19500
+ }).filter((id) => id !== "undefined"),
19488
19501
  onClose: () => setContextMenu(
19489
19502
  (prev) => prev.visible ? { ...prev, visible: false } : prev
19490
19503
  ),
package/dist/index.mjs CHANGED
@@ -3348,9 +3348,11 @@ function ContextMenu({
3348
3348
  viewMembers,
3349
3349
  currentUser,
3350
3350
  onStartQuest,
3351
- onFinishQuest
3351
+ onFinishQuest,
3352
+ renderedNodeIds = [],
3353
+ renderedLinkIds = []
3352
3354
  }) {
3353
- var _a, _b, _c;
3355
+ var _a, _b;
3354
3356
  const menuRef = useRef(null);
3355
3357
  const [menuPos, setMenuPos] = useState2({ left: 0, top: 0 });
3356
3358
  const [menuView, setMenuView] = useState2("main");
@@ -3395,6 +3397,13 @@ function ContextMenu({
3395
3397
  document.addEventListener("mousedown", handleClickOutside);
3396
3398
  return () => document.removeEventListener("mousedown", handleClickOutside);
3397
3399
  }, [data.visible, onClose]);
3400
+ const visibleLinkIds = useMemo(() => {
3401
+ var _a2;
3402
+ return /* @__PURE__ */ new Set([
3403
+ ...((_a2 = sceneData == null ? void 0 : sceneData.links) == null ? void 0 : _a2.map((link) => String(link.id))) ?? [],
3404
+ ...renderedLinkIds.map((id) => String(id))
3405
+ ]);
3406
+ }, [sceneData == null ? void 0 : sceneData.links, renderedLinkIds]);
3398
3407
  if (!data.visible) return null;
3399
3408
  const swallow = (e) => e.stopPropagation();
3400
3409
  const baseButtonClass = "w-full flex items-center gap-2.5 px-2 py-1.5 text-left text-sm rounded-md hover:bg-indigo-500/20 text-slate-200 hover:text-white transition-colors duration-150 truncate";
@@ -3411,7 +3420,6 @@ function ContextMenu({
3411
3420
  }
3412
3421
  return -Infinity;
3413
3422
  };
3414
- const visibleLinkIds = new Set(((_b = sceneData == null ? void 0 : sceneData.links) == null ? void 0 : _b.map((link) => String(link.id))) ?? []);
3415
3423
  const allParentLinks = Object.values(parentData).flatMap((fileData) => fileData.links || []);
3416
3424
  const nodeMap = new Map(allParentNodes.map((node) => [String(node.id), node]));
3417
3425
  const connections = allParentLinks.filter((link) => {
@@ -3428,7 +3436,7 @@ function ContextMenu({
3428
3436
  var _a2;
3429
3437
  return c.targetNode && !(((_a2 = c.targetNode.version_node) == null ? void 0 : _a2.is_version) && String(c.targetNode.version_node.parent_node) === String(data.nodeData.id));
3430
3438
  });
3431
- const isCurrentNodeQuest = ((_c = data.nodeData) == null ? void 0 : _c.is_quest) === true;
3439
+ const isCurrentNodeQuest = ((_b = data.nodeData) == null ? void 0 : _b.is_quest) === true;
3432
3440
  const commonConnections = isCurrentNodeQuest ? connections : connections.filter((c) => {
3433
3441
  var _a2;
3434
3442
  return !((_a2 = c.targetNode) == null ? void 0 : _a2.is_quest);
@@ -3553,14 +3561,14 @@ function ContextMenu({
3553
3561
  });
3554
3562
  };
3555
3563
  const renderMainView = () => {
3556
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
3564
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
3557
3565
  const hasVersions = computedVersions.length > 0;
3558
3566
  const canCreateVersion = ability.can("create", "Versioning");
3559
3567
  const canReadVersion = ability.can("read", "Versioning");
3560
3568
  const shouldShowVersioningBtn = canCreateVersion || canReadVersion && hasVersions;
3561
3569
  const canStartQuest = isCurrentNodeQuest && (((_a2 = data.nodeData) == null ? void 0 : _a2.status) === "Backlog" || !((_b2 = data.nodeData) == null ? void 0 : _b2.status));
3562
3570
  const isQuestActuallyBlocked = canStartQuest && blockedStatus.isBlocked;
3563
- const canFinishQuest = isCurrentNodeQuest && ((_c2 = data.nodeData) == null ? void 0 : _c2.assignee_id) === (currentUser == null ? void 0 : currentUser.id) && ((_d = data.nodeData) == null ? void 0 : _d.status) !== "Backlog" && ((_e = data.nodeData) == null ? void 0 : _e.status) !== "Done";
3571
+ const canFinishQuest = isCurrentNodeQuest && ((_c = data.nodeData) == null ? void 0 : _c.assignee_id) === (currentUser == null ? void 0 : currentUser.id) && ((_d = data.nodeData) == null ? void 0 : _d.status) !== "Backlog" && ((_e = data.nodeData) == null ? void 0 : _e.status) !== "Done";
3564
3572
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 px-2 pt-1 pb-2" }, /* @__PURE__ */ React.createElement("span", { className: "inline-flex h-2 w-2 rounded-full bg-indigo-400/80 shadow-[0_0_12px_1px_rgba(99,102,241,0.5)]" }), /* @__PURE__ */ React.createElement("p", { className: "text-[11px] uppercase tracking-wider text-slate-400" }, "A\xE7\xF5es R\xE1pidas")), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-1" }, canStartQuest && /* @__PURE__ */ React.createElement(
3565
3573
  "button",
3566
3574
  {
@@ -19541,6 +19549,11 @@ function XViewScene({
19541
19549
  parentData: parentDataRef.current,
19542
19550
  sceneData: sceneDataRef.current,
19543
19551
  ancestryData: ancestryDataRef.current,
19552
+ renderedNodeIds: Object.keys(stateRef.current.nodeObjects || {}),
19553
+ renderedLinkIds: (stateRef.current.allLinks || []).map((l) => {
19554
+ var _a2;
19555
+ return String((_a2 = l.userData) == null ? void 0 : _a2.id);
19556
+ }).filter((id) => id !== "undefined"),
19544
19557
  onClose: () => setContextMenu(
19545
19558
  (prev) => prev.visible ? { ...prev, visible: false } : prev
19546
19559
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.6-dev.55",
3
+ "version": "1.2.6-dev.57",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",