@oliasoft-open-source/react-ui-library 10.2.2 → 10.2.3-beta-1

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.
Files changed (2) hide show
  1. package/dist/index.js +37 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7818,28 +7818,38 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
7818
7818
  var n;
7819
7819
  return e && (t == null || (n = t.data) == null ? void 0 : n.draggable) !== !1;
7820
7820
  }, mp = ({ list: e, canDrop: t, draggable: n = !1, onListReorder: r, onChangeOpen: i, testId: a, isInitialOpen: o = !1, autoOpenActiveItems: s = !1, treeRef: c, itemHasChild: l, onItemToggle: u, icons: f, allowParentReassignment: p, stickyHeader: m, height: h, render: g, placeholderIndent: v }) => {
7821
- var y;
7822
- let b = c == null ? _(null) : c, x = (e) => {
7821
+ var y, b;
7822
+ let x = c == null ? _(null) : c, w = (e) => {
7823
7823
  i && i(e);
7824
- }, w = (t) => {
7825
- let n = e.items.find((e) => e.id === t);
7826
- return n && n.parent ? [n.parent, ...w(n.parent)] : [];
7827
- };
7824
+ }, T = (y = e.items.find((e) => e.active)) == null ? void 0 : y.id, E = _(void 0);
7828
7825
  d(() => {
7829
- if (s) {
7830
- let n = e.items.find((e) => e.active);
7831
- if (n) {
7832
- var t;
7833
- let e = w(n.id);
7834
- (t = b.current) == null || t.open(e);
7835
- }
7826
+ var t;
7827
+ if (!s) {
7828
+ E.current = void 0;
7829
+ return;
7830
+ }
7831
+ if (T === void 0) {
7832
+ E.current = void 0;
7833
+ return;
7836
7834
  }
7837
- }, [s, e.items]);
7838
- let T = (e, t) => {
7835
+ if (E.current === T) return;
7836
+ E.current = T;
7837
+ let n = (t) => {
7838
+ let r = e.items.find((e) => e.id === t);
7839
+ return r && r.parent ? [r.parent, ...n(r.parent)] : [];
7840
+ };
7841
+ (t = x.current) == null || t.open(n(T));
7842
+ }, [
7843
+ s,
7844
+ T,
7845
+ e.items,
7846
+ x
7847
+ ]);
7848
+ let D = (e, t) => {
7839
7849
  var n;
7840
7850
  return (n = e == null ? void 0 : e.findIndex((e) => (e == null ? void 0 : e.id) === t)) == null ? -1 : n;
7841
- }, E = (e, t) => {
7842
- let n = T(t, e == null ? void 0 : e.parent);
7851
+ }, O = (e, t) => {
7852
+ let n = D(t, e == null ? void 0 : e.parent);
7843
7853
  if (n >= 0) {
7844
7854
  let r = t == null ? void 0 : t.find((e) => {
7845
7855
  var r;
@@ -7847,20 +7857,20 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
7847
7857
  });
7848
7858
  e.parent = r ? r.id : 0;
7849
7859
  }
7850
- }, D = (e, t) => {
7860
+ }, k = (e, t) => {
7851
7861
  var n;
7852
7862
  return (n = t == null ? void 0 : t.filter((t) => (t == null ? void 0 : t.id) !== (e == null ? void 0 : e.id))) == null ? [] : n;
7853
- }, O = (e, t, n) => (n == null || n.splice(t, 0, e), n), k = (e) => e.map(({ id: e, parent: t, droppable: n, data: r }) => ({
7863
+ }, A = (e, t, n) => (n == null || n.splice(t, 0, e), n), j = (e) => e.map(({ id: e, parent: t, droppable: n, data: r }) => ({
7854
7864
  id: e,
7855
7865
  parent: t,
7856
7866
  droppable: n,
7857
7867
  ...r
7858
- })), A = (e, t) => {
7868
+ })), M = (e, t) => {
7859
7869
  let { dragSource: n, dropTarget: i } = t, a = [...e];
7860
7870
  if (!r) return;
7861
- let o = T(a, n == null ? void 0 : n.id), s = T(a, n == null ? void 0 : n.parent), c = [];
7862
- (n == null ? void 0 : n.parent) === (i == null ? void 0 : i.id) && o === 0 && p && (E(n, a), a = D(n, a), a = O(n, s, a)), c = k(a), r(c);
7863
- }, j = e == null || (y = e.items) == null ? void 0 : y.map(({ id: e, droppable: t, parent: n, name: r, onDrop: i, ...a }) => ({
7871
+ let o = D(a, n == null ? void 0 : n.id), s = D(a, n == null ? void 0 : n.parent), c = [];
7872
+ (n == null ? void 0 : n.parent) === (i == null ? void 0 : i.id) && o === 0 && p && (O(n, a), a = k(n, a), a = A(n, s, a)), c = j(a), r(c);
7873
+ }, N = e == null || (b = e.items) == null ? void 0 : b.map(({ id: e, droppable: t, parent: n, name: r, onDrop: i, ...a }) => ({
7864
7874
  id: e,
7865
7875
  text: r,
7866
7876
  droppable: t,
@@ -7884,8 +7894,8 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
7884
7894
  options: Ci(),
7885
7895
  context: window,
7886
7896
  children: /* @__PURE__ */ S(Si, {
7887
- ref: b,
7888
- tree: j,
7897
+ ref: x,
7898
+ tree: N,
7889
7899
  sort: !1,
7890
7900
  insertDroppableFirst: !1,
7891
7901
  canDrag: (e) => pp(n, e),
@@ -7915,8 +7925,8 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
7915
7925
  onDrop: (s = e.data) == null ? void 0 : s.onDrop
7916
7926
  });
7917
7927
  },
7918
- onDrop: A,
7919
- onChangeOpen: x,
7928
+ onDrop: M,
7929
+ onChangeOpen: w,
7920
7930
  dropTargetOffset: 10,
7921
7931
  placeholderRender: (e, { depth: t }) => /* @__PURE__ */ S(fp, {
7922
7932
  depth: t,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "10.2.2",
3
+ "version": "10.2.3-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {