monobill-mintui 0.6.678 → 0.6.680

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
@@ -3126,6 +3126,10 @@ var mn = class extends HTMLElement {
3126
3126
  this._actionsTrigger.hidden = !0, this._actionsPopover.style.display = "none", this._actionsWrapper.hidden = !0, this._groupingActions = !1;
3127
3127
  return;
3128
3128
  }
3129
+ if (e.length === 1) {
3130
+ this._setActionSlot(e[0], "actions"), this._syncOverflowButtonWidths([]), this._actionsTrigger.hidden = !0, this._actionsPopover.style.display = "none", this._groupingActions = !1;
3131
+ return;
3132
+ }
3129
3133
  e.forEach((e) => this._setActionSlot(e, "actions")), this._syncOverflowButtonWidths([]), this._actionsPopover.style.display = "", this._actionsTrigger.hidden = !0;
3130
3134
  let t = this._root.querySelector(".mint-page-actions-primary"), n = this._root.querySelector(".mint-page-header"), r = this._root.querySelector(".mint-page-heading");
3131
3135
  this._actionsResizeObserver?.observe(t), e.forEach((e) => this._actionsResizeObserver?.observe(e));
@@ -14741,17 +14745,45 @@ var $ = class extends HTMLElement {
14741
14745
  }
14742
14746
  _undo() {
14743
14747
  let e = this._undoStack.pop();
14744
- e && (this._redoStack.push(q(this._items)), this._items = e, this._render(), Z(this, "mint-tree-change", {
14745
- items: this.items,
14746
- itemId: this._selectedId
14747
- }), Z(this, "mint-tree-undo", { items: this.items }));
14748
+ if (!e) return;
14749
+ let t = this._items;
14750
+ this._redoStack.push(q(this._items)), this._items = e, this._render(), this._emitHistoryChange(t), Z(this, "mint-tree-undo", { items: this.items });
14748
14751
  }
14749
14752
  _redo() {
14750
14753
  let e = this._redoStack.pop();
14751
- e && (this._undoStack.push(q(this._items)), this._items = e, this._render(), Z(this, "mint-tree-change", {
14752
- items: this.items,
14754
+ if (!e) return;
14755
+ let t = this._items;
14756
+ this._undoStack.push(q(this._items)), this._items = e, this._render(), this._emitHistoryChange(t), Z(this, "mint-tree-redo", { items: this.items });
14757
+ }
14758
+ _emitHistoryChange(e) {
14759
+ let t = this.items, n = (e) => {
14760
+ let t = /* @__PURE__ */ new Map(), n = (e, r) => e.forEach((e, i) => {
14761
+ let a = String(e.id);
14762
+ t.set(a, {
14763
+ parentId: r,
14764
+ index: i,
14765
+ item: e
14766
+ }), n(e.children || [], a);
14767
+ });
14768
+ return n(e, null), t;
14769
+ }, r = n(e), i = n(this._items), a = [...new Set([...r.keys(), ...i.keys()])].find((e) => {
14770
+ let t = r.get(e), n = i.get(e);
14771
+ return t && n && (t.parentId !== n.parentId || t.index !== n.index);
14772
+ });
14773
+ if (Z(this, "mint-tree-change", {
14774
+ items: t,
14753
14775
  itemId: this._selectedId
14754
- }), Z(this, "mint-tree-redo", { items: this.items }));
14776
+ }), !a) return;
14777
+ let o = r.get(a), s = i.get(a), c = {
14778
+ itemId: a,
14779
+ item: { ...s.item },
14780
+ items: t,
14781
+ oldParentId: o.parentId,
14782
+ newParentId: s.parentId,
14783
+ oldIndex: o.index,
14784
+ newIndex: s.index
14785
+ };
14786
+ Z(this, o.parentId === s.parentId ? "mint-tree-reorder" : "mint-tree-reparent", c);
14755
14787
  }
14756
14788
  _keyboardIndent(e) {
14757
14789
  let t = Y(this._items, e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monobill-mintui",
3
- "version": "0.6.678",
3
+ "version": "0.6.680",
4
4
  "description": "Framework-independent HTML custom elements with component-scoped CSS.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",