@lv-x-software-house/x_view 1.2.6-dev.14 → 1.2.6-dev.16

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
@@ -13356,15 +13356,6 @@ var BoardItem = ({
13356
13356
  },
13357
13357
  /* @__PURE__ */ import_react29.default.createElement(import_fi23.FiPlus, { size: 12 }),
13358
13358
  /* @__PURE__ */ import_react29.default.createElement("span", null, "Subgrupo")
13359
- ), /* @__PURE__ */ import_react29.default.createElement(
13360
- "button",
13361
- {
13362
- onClick: () => onAddSubgroup(item.id, "folder"),
13363
- className: "flex items-center gap-1 px-1.5 py-1 text-[10px] uppercase font-bold tracking-wider text-slate-500 hover:text-white hover:bg-white/10 rounded transition-colors",
13364
- title: "Criar Subpasta"
13365
- },
13366
- /* @__PURE__ */ import_react29.default.createElement(import_fi23.FiFolder, { size: 12 }),
13367
- /* @__PURE__ */ import_react29.default.createElement("span", null, "Pasta")
13368
13359
  )), /* @__PURE__ */ import_react29.default.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ import_react29.default.createElement(
13369
13360
  "button",
13370
13361
  {
@@ -13533,26 +13524,30 @@ function AncestryBoard({
13533
13524
  children: []
13534
13525
  };
13535
13526
  if (navigationStack.length === 0) {
13536
- setGroups((prev) => [newItem, ...prev]);
13527
+ setGroups((prev) => [...prev, newItem]);
13537
13528
  } else {
13538
13529
  const parentId = navigationStack[navigationStack.length - 1];
13539
13530
  const add = (list) => list.map(
13540
- (g) => g.id === parentId ? { ...g, children: [newItem, ...g.children] } : { ...g, children: add(g.children) }
13531
+ (g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
13541
13532
  );
13542
13533
  setGroups((prev) => add(prev));
13543
13534
  }
13544
13535
  };
13545
13536
  const handleAddSubgroup = (parentId, type = "group") => {
13546
- const newItem = {
13547
- id: (0, import_uuid11.v4)(),
13548
- type,
13549
- name: type === "folder" ? "Nova Pasta" : "",
13550
- content: [],
13551
- children: []
13552
- };
13553
- const add = (list) => list.map(
13554
- (g) => g.id === parentId ? { ...g, children: [newItem, ...g.children] } : { ...g, children: add(g.children) }
13555
- );
13537
+ const add = (list) => list.map((g) => {
13538
+ if (g.id === parentId) {
13539
+ if (g.type === "group" && type === "folder") return g;
13540
+ const newItem = {
13541
+ id: (0, import_uuid11.v4)(),
13542
+ type,
13543
+ name: type === "folder" ? "Nova Pasta" : "",
13544
+ content: [],
13545
+ children: []
13546
+ };
13547
+ return { ...g, children: [...g.children, newItem] };
13548
+ }
13549
+ return { ...g, children: add(g.children) };
13550
+ });
13556
13551
  setGroups((prev) => add(prev));
13557
13552
  };
13558
13553
  const handleUpdateItem = (id, newData) => {
@@ -13582,8 +13577,12 @@ function AncestryBoard({
13582
13577
  const found = findGroupAndParent(next, id);
13583
13578
  if (!found || found.index === 0) return prev;
13584
13579
  const { group, siblings, index } = found;
13580
+ const targetParent = siblings[index - 1];
13581
+ if (group.type === "folder" && targetParent.type === "group") {
13582
+ return prev;
13583
+ }
13585
13584
  siblings.splice(index, 1);
13586
- siblings[index - 1].children.push(group);
13585
+ targetParent.children.push(group);
13587
13586
  return next;
13588
13587
  });
13589
13588
  };
package/dist/index.mjs CHANGED
@@ -13404,15 +13404,6 @@ var BoardItem = ({
13404
13404
  },
13405
13405
  /* @__PURE__ */ React28.createElement(FiPlus10, { size: 12 }),
13406
13406
  /* @__PURE__ */ React28.createElement("span", null, "Subgrupo")
13407
- ), /* @__PURE__ */ React28.createElement(
13408
- "button",
13409
- {
13410
- onClick: () => onAddSubgroup(item.id, "folder"),
13411
- className: "flex items-center gap-1 px-1.5 py-1 text-[10px] uppercase font-bold tracking-wider text-slate-500 hover:text-white hover:bg-white/10 rounded transition-colors",
13412
- title: "Criar Subpasta"
13413
- },
13414
- /* @__PURE__ */ React28.createElement(FiFolder3, { size: 12 }),
13415
- /* @__PURE__ */ React28.createElement("span", null, "Pasta")
13416
13407
  )), /* @__PURE__ */ React28.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React28.createElement(
13417
13408
  "button",
13418
13409
  {
@@ -13581,26 +13572,30 @@ function AncestryBoard({
13581
13572
  children: []
13582
13573
  };
13583
13574
  if (navigationStack.length === 0) {
13584
- setGroups((prev) => [newItem, ...prev]);
13575
+ setGroups((prev) => [...prev, newItem]);
13585
13576
  } else {
13586
13577
  const parentId = navigationStack[navigationStack.length - 1];
13587
13578
  const add = (list) => list.map(
13588
- (g) => g.id === parentId ? { ...g, children: [newItem, ...g.children] } : { ...g, children: add(g.children) }
13579
+ (g) => g.id === parentId ? { ...g, children: [...g.children, newItem] } : { ...g, children: add(g.children) }
13589
13580
  );
13590
13581
  setGroups((prev) => add(prev));
13591
13582
  }
13592
13583
  };
13593
13584
  const handleAddSubgroup = (parentId, type = "group") => {
13594
- const newItem = {
13595
- id: uuidv411(),
13596
- type,
13597
- name: type === "folder" ? "Nova Pasta" : "",
13598
- content: [],
13599
- children: []
13600
- };
13601
- const add = (list) => list.map(
13602
- (g) => g.id === parentId ? { ...g, children: [newItem, ...g.children] } : { ...g, children: add(g.children) }
13603
- );
13585
+ const add = (list) => list.map((g) => {
13586
+ if (g.id === parentId) {
13587
+ if (g.type === "group" && type === "folder") return g;
13588
+ const newItem = {
13589
+ id: uuidv411(),
13590
+ type,
13591
+ name: type === "folder" ? "Nova Pasta" : "",
13592
+ content: [],
13593
+ children: []
13594
+ };
13595
+ return { ...g, children: [...g.children, newItem] };
13596
+ }
13597
+ return { ...g, children: add(g.children) };
13598
+ });
13604
13599
  setGroups((prev) => add(prev));
13605
13600
  };
13606
13601
  const handleUpdateItem = (id, newData) => {
@@ -13630,8 +13625,12 @@ function AncestryBoard({
13630
13625
  const found = findGroupAndParent(next, id);
13631
13626
  if (!found || found.index === 0) return prev;
13632
13627
  const { group, siblings, index } = found;
13628
+ const targetParent = siblings[index - 1];
13629
+ if (group.type === "folder" && targetParent.type === "group") {
13630
+ return prev;
13631
+ }
13633
13632
  siblings.splice(index, 1);
13634
- siblings[index - 1].children.push(group);
13633
+ targetParent.children.push(group);
13635
13634
  return next;
13636
13635
  });
13637
13636
  };
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.14",
3
+ "version": "1.2.6-dev.16",
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",