monobill-mintui 0.6.729 → 0.6.731
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/components/chunks/{sortable-DdT2ptc5.js → sortable-CZb3qVcJ.js} +58 -20
- package/dist/components/chunks/sortable-DRLPQduO.js +1 -0
- package/dist/components/chunks/table-BNNRNEZ9.js +1 -0
- package/dist/components/chunks/{table-C6ufpGLx.js → table-BNZVNp5g.js} +3 -1
- package/dist/components/resource-table/browser.js +1 -1
- package/dist/components/resource-table/index.cjs +1 -1
- package/dist/components/resource-table/index.js +1 -1
- package/dist/components/sortable/Sortable.d.ts +6 -1
- package/dist/components/sortable/Sortable.d.ts.map +1 -1
- package/dist/components/sortable/browser.js +1 -1
- package/dist/components/sortable/index.cjs +1 -1
- package/dist/components/sortable/index.js +1 -1
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/browser.js +1 -1
- package/dist/components/table/index.cjs +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/tree/browser.js +1 -1
- package/dist/components/tree/index.cjs +1 -1
- package/dist/components/tree/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.css +1 -1
- package/dist/index.js +61 -21
- package/dist/sortable.css +1 -1
- package/package.json +1 -1
- package/dist/components/chunks/sortable-Bql13n3L.js +0 -1
- package/dist/components/chunks/table-B_S4xwx3.js +0 -1
|
@@ -18,7 +18,7 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
18
18
|
];
|
|
19
19
|
}
|
|
20
20
|
constructor() {
|
|
21
|
-
super(), this._pointerId = null, this._dragEl = null, this._placeholder = null, this._listRoot = this, this._startIndex = 0, this._pointerStartX = 0, this._pointerStartY = 0, this._scrollRaf = null, this._childObserver = null, this._pointerBoundRoot = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropAtEnd = !1, this._dropRejected = !1, this._sortStatus = null, this._flipCleanupTimers = /* @__PURE__ */ new WeakMap(), this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._keyboardKeydownHandler = (e) => this._onKeyboardReorder(e), this._onListPointerDown = (e) => {
|
|
21
|
+
super(), this._pointerId = null, this._dragEl = null, this._placeholder = null, this._listRoot = this, this._startIndex = 0, this._pointerStartX = 0, this._pointerStartY = 0, this._scrollRaf = null, this._previewResizeRaf = null, this._childObserver = null, this._pointerBoundRoot = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropAtEnd = !1, this._dropRejected = !1, this._sortStatus = null, this._flipCleanupTimers = /* @__PURE__ */ new WeakMap(), this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._keyboardKeydownHandler = (e) => this._onKeyboardReorder(e), this._onListPointerDown = (e) => {
|
|
22
22
|
let t = e;
|
|
23
23
|
if (this._isDisabled() || this._pointerId !== null || t.button !== 0) return;
|
|
24
24
|
let n = t.target;
|
|
@@ -134,7 +134,8 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
134
134
|
}));
|
|
135
135
|
}
|
|
136
136
|
getDirection() {
|
|
137
|
-
|
|
137
|
+
let e = this.getAttribute("direction") || "vertical";
|
|
138
|
+
return e === "horizontal" || e === "grid" ? e : "vertical";
|
|
138
139
|
}
|
|
139
140
|
getGap() {
|
|
140
141
|
let e = this.getAttribute("gap") || "3", t = parseFloat(e);
|
|
@@ -278,33 +279,62 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
278
279
|
if (!t || !n) return;
|
|
279
280
|
let r = this._resolveDropList(e), i = r._resolveListRoot();
|
|
280
281
|
if (i === n || n.contains(i)) return;
|
|
281
|
-
t.parentElement !== i
|
|
282
|
-
|
|
282
|
+
let a = t.parentElement !== i;
|
|
283
|
+
a && r._flipAnimate(() => i.appendChild(t)), this._dropList = r;
|
|
284
|
+
let o = r.getDirection();
|
|
285
|
+
if (o === "grid") {
|
|
286
|
+
this._moveGridPlaceholder(r, i, t, n, e);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
let s = o === "horizontal", c = s ? e.clientX : e.clientY, l = this.hasAttribute("data-mint-sortable-full-crossing");
|
|
283
290
|
if (this._dropAtEnd && r !== this) {
|
|
284
291
|
(t.parentElement !== i || i.lastElementChild !== t) && r._flipAnimate(() => i.appendChild(t)), this._dispatchPreview(r, i, t, n);
|
|
285
292
|
return;
|
|
286
293
|
}
|
|
287
|
-
let
|
|
288
|
-
for (let e of
|
|
289
|
-
let n = e.getBoundingClientRect(), r =
|
|
290
|
-
if (
|
|
291
|
-
if (
|
|
292
|
-
|
|
294
|
+
let u = Array.from(i.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && e !== n && e !== t), d = null;
|
|
295
|
+
for (let e of u) {
|
|
296
|
+
let n = e.getBoundingClientRect(), r = s ? n.left : n.top, a = s ? n.left + n.width : n.top + n.height;
|
|
297
|
+
if (l) {
|
|
298
|
+
if (c < r) {
|
|
299
|
+
d = e;
|
|
293
300
|
break;
|
|
294
301
|
}
|
|
295
|
-
if (
|
|
296
|
-
|
|
302
|
+
if (c <= a && Array.prototype.indexOf.call(i.children, t) < Array.prototype.indexOf.call(i.children, e)) {
|
|
303
|
+
d = e;
|
|
297
304
|
break;
|
|
298
305
|
}
|
|
299
|
-
} else if (
|
|
300
|
-
|
|
306
|
+
} else if (c < (s ? n.left + n.width / 2 : n.top + n.height / 2)) {
|
|
307
|
+
d = e;
|
|
301
308
|
break;
|
|
302
309
|
}
|
|
303
310
|
}
|
|
304
|
-
let
|
|
305
|
-
(
|
|
306
|
-
|
|
307
|
-
|
|
311
|
+
let f = Array.from(i.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && e !== n), p = f.length > 0 && f[f.length - 1] === t;
|
|
312
|
+
if (!(d ? !(t.nextSibling === d && t.parentNode === i) : !p)) {
|
|
313
|
+
a && this._dispatchPreview(r, i, t, n);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
r._flipAnimate(() => {
|
|
317
|
+
d ? i.insertBefore(t, d) : i.appendChild(t);
|
|
318
|
+
}), this._dispatchPreview(r, i, t, n);
|
|
319
|
+
}
|
|
320
|
+
_moveGridPlaceholder(e, t, n, r, i) {
|
|
321
|
+
let a = Array.from(t.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && e !== r && e !== n && !e.hasAttribute("data-mint-sortable-status")), o = null, s = Infinity;
|
|
322
|
+
for (let e of a) {
|
|
323
|
+
let t = e.getBoundingClientRect(), n = i.clientX < t.left ? t.left - i.clientX : i.clientX > t.right ? i.clientX - t.right : 0, r = i.clientY < t.top ? t.top - i.clientY : i.clientY > t.bottom ? i.clientY - t.bottom : 0, a = n * n + r * r;
|
|
324
|
+
a < s && (o = e, s = a);
|
|
325
|
+
}
|
|
326
|
+
let c = null;
|
|
327
|
+
if (o) {
|
|
328
|
+
let e = o.getBoundingClientRect(), t = i.clientX < e.left + e.width / 2;
|
|
329
|
+
c = a[a.indexOf(o) + (t ? 0 : 1)] ?? null;
|
|
330
|
+
}
|
|
331
|
+
if (!(c ? !(n.nextSibling === c && n.parentNode === t) : !(t.lastElementChild === n && n.parentNode === t))) {
|
|
332
|
+
this._dispatchPreview(e, t, n, r);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
e._flipAnimate(() => {
|
|
336
|
+
c ? t.insertBefore(n, c) : t.appendChild(n);
|
|
337
|
+
}), this._dispatchPreview(e, t, n, r);
|
|
308
338
|
}
|
|
309
339
|
_dispatchPreview(e, t, n, r) {
|
|
310
340
|
let i = Array.from(t.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && e !== r && !e.hasAttribute("data-mint-sortable-status")), a = i.indexOf(n);
|
|
@@ -322,7 +352,14 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
322
352
|
bubbles: !0,
|
|
323
353
|
composed: !0,
|
|
324
354
|
detail: c
|
|
325
|
-
}));
|
|
355
|
+
})), this._resizeDragToPlaceholder(r, n);
|
|
356
|
+
}
|
|
357
|
+
_resizeDragToPlaceholder(e, t) {
|
|
358
|
+
this._previewResizeRaf !== null && cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = requestAnimationFrame(() => {
|
|
359
|
+
if (this._previewResizeRaf = null, this._dragEl !== e || this._placeholder !== t || !t.isConnected) return;
|
|
360
|
+
let n = t.getBoundingClientRect();
|
|
361
|
+
!n.width || !n.height || (e.style.transition = "width 160ms ease, height 160ms ease", e.style.width = `${n.width}px`, e.style.height = `${n.height}px`, e.style.transformOrigin = "top left");
|
|
362
|
+
});
|
|
326
363
|
}
|
|
327
364
|
_flipAnimate(e) {
|
|
328
365
|
let t = this._dragEl, n = this._getAnimationDurationMs(), r = this._getLayoutChildren().filter((e) => e !== t), i = /* @__PURE__ */ new Map();
|
|
@@ -360,6 +397,7 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
360
397
|
this._teardownDrag();
|
|
361
398
|
return;
|
|
362
399
|
}
|
|
400
|
+
this._previewResizeRaf !== null && (cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = null);
|
|
363
401
|
try {
|
|
364
402
|
t.releasePointerCapture(this._pointerId);
|
|
365
403
|
} catch {}
|
|
@@ -428,7 +466,7 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
428
466
|
})));
|
|
429
467
|
}
|
|
430
468
|
_teardownDrag() {
|
|
431
|
-
if (this._scrollRaf !== null && (cancelAnimationFrame(this._scrollRaf), this._scrollRaf = null), window.removeEventListener("pointermove", this._boundPointerMove), window.removeEventListener("pointerup", this._boundPointerUp), window.removeEventListener("pointercancel", this._boundPointerCancel), this._dragEl) {
|
|
469
|
+
if (this._previewResizeRaf !== null && (cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = null), this._scrollRaf !== null && (cancelAnimationFrame(this._scrollRaf), this._scrollRaf = null), window.removeEventListener("pointermove", this._boundPointerMove), window.removeEventListener("pointerup", this._boundPointerUp), window.removeEventListener("pointercancel", this._boundPointerCancel), this._dragEl) {
|
|
432
470
|
try {
|
|
433
471
|
this._pointerId !== null && this._dragEl.releasePointerCapture(this._pointerId);
|
|
434
472
|
} catch {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./register-element-tCL_F1YI.js`);var t=`mint-sortable-placeholder`,n=`mint-sortable-dragging`,r=class e extends HTMLElement{static get observedAttributes(){return[`direction`,`gap`,`text-align`,`align-content`,`scroll-max-height`,`disabled`,`handle-selector`,`scroll-sensitivity`,`scroll-speed`,`animation-duration`,`item-key-attribute`,`group`]}constructor(){super(),this._pointerId=null,this._dragEl=null,this._placeholder=null,this._listRoot=this,this._startIndex=0,this._pointerStartX=0,this._pointerStartY=0,this._scrollRaf=null,this._previewResizeRaf=null,this._childObserver=null,this._pointerBoundRoot=null,this._restoreAfter=null,this._originListRoot=null,this._originNextSibling=null,this._dropList=null,this._dropAtEnd=!1,this._dropRejected=!1,this._sortStatus=null,this._flipCleanupTimers=new WeakMap,this._lastPreviewRoot=null,this._lastPreviewIndex=-1,this._keyboardKeydownHandler=e=>this._onKeyboardReorder(e),this._onListPointerDown=e=>{let t=e;if(this._isDisabled()||this._pointerId!==null||t.button!==0)return;let n=t.target;if(!n||!this.contains(n))return;let r=(n instanceof Element?n:n.parentElement)?.closest(`mint-sortable`);if(r&&r!==this)return;let i=this._closestSortableItem(n);if(!i||!this._listRoot.contains(i)||i.hasAttribute(`data-sortable-disabled`))return;let a=this._getHandleSelector();if(a){let e=t.target.closest(a);if(!e||!i.contains(e))return}t.preventDefault(),this._startDrag(t,i)},this._boundPointerMove=this._onPointerMove.bind(this),this._boundPointerUp=this._onPointerUp.bind(this),this._boundPointerCancel=this._onPointerCancel.bind(this)}connectedCallback(){this.classList.add(`mint-sortable`),this._syncInnerStackAttributes(),this._applyHostScrollAndLayout(),this.addEventListener(`keydown`,this._keyboardKeydownHandler),this._observeInnerStack()}disconnectedCallback(){this._unobserveInnerStack(),this.removeEventListener(`keydown`,this._keyboardKeydownHandler),this._teardownDrag(),this._pointerBoundRoot&&=(this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),null)}attributeChangedCallback(e,t,n){t!==n&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}_observeInnerStack(){this._childObserver||(this._childObserver=new MutationObserver(()=>{this._pointerId===null&&(this._syncInnerStackAttributes(),this._applyHostScrollAndLayout())}),this._childObserver.observe(this,{childList:!0}))}_unobserveInnerStack(){this._childObserver&&=(this._childObserver.disconnect(),null)}_getInnerStack(){for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.nodeType===Node.ELEMENT_NODE&&t.tagName===`MINT-STACK`)return t}return null}_resolveListRoot(){return this._getInnerStack()??this}_getItemKeyAttribute(){return this.getAttribute(`item-key-attribute`)?.trim()||`data-sortable-id`}_collectOrderedKeys(){let e=this._resolveListRoot(),n=this._getItemKeyAttribute(),r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i];if(a.nodeType!==Node.ELEMENT_NODE)continue;let o=a;o.classList.contains(t)||o.hasAttribute(`data-mint-sortable-status`)||r.push(o.getAttribute(n)??``)}return r}_syncInnerStackAttributes(){let e=this._getInnerStack();if(!e)return;let t=this.getDirection(),n=this.getGap(),r=this.getTextAlign();e.setAttribute(`direction`,t),e.setAttribute(`gap`,String(n)),r?e.setAttribute(`text-align`,r):e.removeAttribute(`text-align`);let i=this.getAlignContent();i?e.setAttribute(`align-content`,i):e.removeAttribute(`align-content`)}_applyHostScrollAndLayout(){this._listRoot=this._resolveListRoot();let e=this.getAttribute(`scroll-max-height`);e?(this.style.maxHeight=e,this.style.overflowY=`auto`,this.style.overflowX=`hidden`,this.classList.add(`mint-sortable-scrollable`)):(this.style.maxHeight=``,this.style.overflowY=``,this.style.overflowX=``,this.classList.remove(`mint-sortable-scrollable`));let t=this._getInnerStack();this.classList.toggle(`mint-sortable-has-inner-stack`,!!t);let n=this.getDirection(),r=this.getAlignContent(),i=Math.min(12,Math.max(1,Math.round(this.getGap()))),a=this.getTextAlign();this.style.setProperty(`--mint-sortable-direction`,n===`horizontal`?`row`:`column`),this.style.setProperty(`--mint-sortable-gap`,`${i*.25}rem`),this.style.setProperty(`--mint-sortable-text-align`,a||`initial`),this.style.setProperty(`--mint-sortable-button-justify`,a===`left`?`flex-start`:a===`right`?`flex-end`:`center`);let o=r?r===`left`?`flex-start`:r===`right`?`flex-end`:`center`:``,s=n===`vertical`&&o||`stretch`,c=n===`horizontal`&&o||`flex-start`;this.style.setProperty(`--mint-sortable-cross-align`,s),this.style.setProperty(`--mint-sortable-main-align`,c),this._ensureListPointerBinding(),this._syncKeyboardAccessibility()}_syncKeyboardAccessibility(){let e=this._resolveListRoot();e.hasAttribute(`role`)||e.setAttribute(`role`,`list`),this._sortStatus||(this._sortStatus=document.createElement(`div`),this._sortStatus.className=`mint-sortable-status`,this._sortStatus.setAttribute(`role`,`status`),this._sortStatus.setAttribute(`aria-live`,`polite`),this._sortStatus.setAttribute(`aria-atomic`,`true`),this._sortStatus.setAttribute(`data-mint-sortable-status`,``),this.appendChild(this._sortStatus)),this._getLayoutChildren().forEach(e=>{e.classList.contains(t)||(e.hasAttribute(`role`)||e.setAttribute(`role`,`listitem`),e.hasAttribute(`tabindex`)||(e.tabIndex=0),e.setAttribute(`aria-keyshortcuts`,`Alt+ArrowUp Alt+ArrowDown`),e.hasAttribute(`aria-roledescription`)||e.setAttribute(`aria-roledescription`,`sortable item`))})}_onKeyboardReorder(e){if(this._isDisabled()||!e.altKey||![`ArrowUp`,`ArrowDown`].includes(e.key))return;let n=e.target instanceof Element?e.target:null,r=n?.closest(`mint-sortable`);if(r&&r!==this)return;let i=n?this._closestSortableItem(n):null;if(!i||i.hasAttribute(`data-sortable-disabled`))return;let a=this._getLayoutChildren().filter(e=>!e.classList.contains(t)),o=a.indexOf(i),s=o+(e.key===`ArrowUp`?-1:1);if(o<0||s<0||s>=a.length)return;e.preventDefault();let c=a[s];e.key===`ArrowUp`?this._listRoot.insertBefore(i,c):this._listRoot.insertBefore(c,i),i.focus({preventScroll:!0});let l=this._collectOrderedKeys(),u=this._indexOfItem(i),d=i.getAttribute(`aria-label`)||i.textContent?.trim().replace(/\s+/g,` `)||`Item`;this._sortStatus&&(this._sortStatus.textContent=`${d} moved to position ${u+1} of ${a.length}.`);let f=this.getAttribute(`data-tree-parent-id`)||null,p={oldIndex:o,newIndex:u,keys:l,itemId:i.getAttribute(this._getItemKeyAttribute())||``,oldParentId:f,newParentId:f,sourceContainerId:this.id||null,destinationContainerId:this.id||null};this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:p})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:l}}))}getDirection(){let e=this.getAttribute(`direction`)||`vertical`;return e===`horizontal`||e===`grid`?e:`vertical`}getGap(){let e=this.getAttribute(`gap`)||`3`,t=parseFloat(e);return Number.isFinite(t)?t:3}getTextAlign(){let e=this.getAttribute(`text-align`)||``;return[`left`,`center`,`right`,`justify`].includes(e)?e:``}getAlignContent(){let e=(this.getAttribute(`align-content`)||``).trim().toLowerCase();return e===`left`||e===`right`||e===`center`?e:``}_isDisabled(){return this.hasAttribute(`disabled`)&&this.getAttribute(`disabled`)!==`false`}_getHandleSelector(){let e=this.getAttribute(`handle-selector`);return e&&e.trim()?e.trim():null}_getScrollSensitivity(){let e=parseFloat(this.getAttribute(`scroll-sensitivity`)||`48`);return Number.isFinite(e)?e:48}_getScrollSpeed(){let e=parseFloat(this.getAttribute(`scroll-speed`)||`12`);return Number.isFinite(e)?e:12}_getAnimationDurationMs(){let e=parseFloat(this.getAttribute(`animation-duration`)||`220`);return Number.isFinite(e)?Math.max(0,e):220}_ensureListPointerBinding(){let e=this._resolveListRoot();this._pointerBoundRoot!==e&&(this._pointerBoundRoot&&this._pointerBoundRoot.removeEventListener(`pointerdown`,this._onListPointerDown),e.addEventListener(`pointerdown`,this._onListPointerDown),this._pointerBoundRoot=e,this._listRoot=e)}_closestSortableItem(e){let r=e;for(;r&&r!==this._listRoot;){if(r.nodeType===Node.ELEMENT_NODE){let e=r;if(e.classList.contains(t)||e.classList.contains(n))return null;if(r.parentElement===this._listRoot)return e}r=r.parentElement}return null}_startDrag(e,r){this._listRoot=this._resolveListRoot(),this._restoreAfter=r.nextElementSibling,this._originListRoot=this._listRoot,this._originNextSibling=r.nextElementSibling,this._dropList=this,this._dropAtEnd=!1,this._dropRejected=!1,this._dragEl=r,this._pointerId=e.pointerId,this._startIndex=this._indexOfItem(r);let i=r.getBoundingClientRect();this._pointerStartX=e.clientX,this._pointerStartY=e.clientY;let a=document.createElement(`div`);a.className=t,a.style.minHeight=`${i.height}px`,a.style.minWidth=`${i.width}px`,a.setAttribute(`aria-hidden`,`true`),this._placeholder=a,this._listRoot.insertBefore(a,r),r.classList.add(n),r.style.position=`fixed`,r.style.left=`${i.left}px`,r.style.top=`${i.top}px`,r.style.width=`${i.width}px`,r.style.height=`${i.height}px`,r.style.margin=`0`,r.style.zIndex=`10000`,r.style.boxSizing=`border-box`,r.style.pointerEvents=`none`,r.style.touchAction=`none`,r.style.transform=`translate3d(0, 0, 0) scale(1.015)`,r.style.transformOrigin=`center center`,r.style.willChange=`transform`,r.setPointerCapture(e.pointerId);let o=this._collectOrderedKeys(),s={index:this._startIndex,itemId:r.getAttribute(this._getItemKeyAttribute())||``,keys:o,sourceContainerId:this.id||null};this.dispatchEvent(new CustomEvent(`mint-sortable-start`,{bubbles:!0,composed:!0,detail:s})),this.dispatchEvent(new CustomEvent(`sort-start`,{bubbles:!0,composed:!0,detail:s})),window.addEventListener(`pointermove`,this._boundPointerMove,{passive:!1}),window.addEventListener(`pointerup`,this._boundPointerUp),window.addEventListener(`pointercancel`,this._boundPointerCancel)}_indexOfItem(e){let n=0;for(let r=0;r<this._listRoot.children.length;r++){let i=this._listRoot.children[r];if(i.nodeType!==Node.ELEMENT_NODE)continue;let a=i;if(!a.classList.contains(t)){if(a===e)return n;n++}}return-1}_getLayoutChildren(){return Array.from(this._listRoot.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&!e.hasAttribute(`data-mint-sortable-status`))}_onPointerMove(e){if(e.pointerId!==this._pointerId||!this._dragEl||!this._placeholder)return;e.preventDefault();let t=e.clientX-this._pointerStartX,n=e.clientY-this._pointerStartY;this._dragEl.style.transform=`translate3d(${t}px, ${n}px, 0) scale(1.015)`,this.dispatchEvent(new CustomEvent(`mint-sortable-drag`,{bubbles:!0,composed:!0,detail:{item:this._dragEl,source:this,clientX:e.clientX,clientY:e.clientY}})),this._autoScroll(e),this._maybeMovePlaceholder(e)}_resolveDropList(t){let n=document.elementFromPoint(t.clientX,t.clientY),r=n?.closest(`[data-mint-sortable-drop-container]`);this._dropAtEnd=!!r?.hasAttribute(`data-mint-sortable-drop-end`);let i=r?.getAttribute(`data-mint-sortable-drop-container`),a=i?document.getElementById(i):null,o=a?.matches(`mint-sortable`)?a:n?.closest(`mint-sortable`),s=o instanceof e?o:this,c=this.getAttribute(`group`)?.trim(),l=!!(c&&s.getAttribute(`group`)?.trim()===c),u=!!(this._dragEl&&(s===this._dragEl||this._dragEl.contains(s))),d=s===this||l&&s.isConnected&&!u,f=new CustomEvent(`mint-sortable-drag-over`,{bubbles:!0,composed:!0,cancelable:!0,detail:{item:this._dragEl,source:this,target:s,clientX:t.clientX,clientY:t.clientY}});return this.dispatchEvent(f),this._dropRejected=!d||f.defaultPrevented,this._dropRejected?this:s}_autoScroll(e){let t=this;for(;t&&t!==document.body;){let e=getComputedStyle(t);if(/(auto|scroll)/.test(`${e.overflowY} ${e.overflow}`)&&t.scrollHeight>t.clientHeight||t.style.maxHeight)break;t=t.parentElement}if(!t||t===document.body)return;let n=this._getScrollSensitivity(),r=this._getScrollSpeed(),i=t.getBoundingClientRect();this._scrollRaf!==null&&cancelAnimationFrame(this._scrollRaf),this._scrollRaf=requestAnimationFrame(()=>{this._scrollRaf=null;let a=0;e.clientY<i.top+n?a=-r:e.clientY>i.bottom-n&&(a=r),a!==0&&(t.scrollTop+=a,this._maybeMovePlaceholder(e))})}_maybeMovePlaceholder(e){let t=this._placeholder,n=this._dragEl;if(!t||!n)return;let r=this._resolveDropList(e),i=r._resolveListRoot();if(i===n||n.contains(i))return;let a=t.parentElement!==i;a&&r._flipAnimate(()=>i.appendChild(t)),this._dropList=r;let o=r.getDirection();if(o===`grid`){this._moveGridPlaceholder(r,i,t,n,e);return}let s=o===`horizontal`,c=s?e.clientX:e.clientY,l=this.hasAttribute(`data-mint-sortable-full-crossing`);if(this._dropAtEnd&&r!==this){(t.parentElement!==i||i.lastElementChild!==t)&&r._flipAnimate(()=>i.appendChild(t)),this._dispatchPreview(r,i,t,n);return}let u=Array.from(i.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n&&e!==t),d=null;for(let e of u){let n=e.getBoundingClientRect(),r=s?n.left:n.top,a=s?n.left+n.width:n.top+n.height;if(l){if(c<r){d=e;break}if(c<=a&&Array.prototype.indexOf.call(i.children,t)<Array.prototype.indexOf.call(i.children,e)){d=e;break}}else if(c<(s?n.left+n.width/2:n.top+n.height/2)){d=e;break}}let f=Array.from(i.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==n),p=f.length>0&&f[f.length-1]===t;if(!(d?!(t.nextSibling===d&&t.parentNode===i):!p)){a&&this._dispatchPreview(r,i,t,n);return}r._flipAnimate(()=>{d?i.insertBefore(t,d):i.appendChild(t)}),this._dispatchPreview(r,i,t,n)}_moveGridPlaceholder(e,t,n,r,i){let a=Array.from(t.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==r&&e!==n&&!e.hasAttribute(`data-mint-sortable-status`)),o=null,s=1/0;for(let e of a){let t=e.getBoundingClientRect(),n=i.clientX<t.left?t.left-i.clientX:i.clientX>t.right?i.clientX-t.right:0,r=i.clientY<t.top?t.top-i.clientY:i.clientY>t.bottom?i.clientY-t.bottom:0,a=n*n+r*r;a<s&&(o=e,s=a)}let c=null;if(o){let e=o.getBoundingClientRect(),t=i.clientX<e.left+e.width/2;c=a[a.indexOf(o)+(t?0:1)]??null}if(!(c?!(n.nextSibling===c&&n.parentNode===t):!(t.lastElementChild===n&&n.parentNode===t))){this._dispatchPreview(e,t,n,r);return}e._flipAnimate(()=>{c?t.insertBefore(n,c):t.appendChild(n)}),this._dispatchPreview(e,t,n,r)}_dispatchPreview(e,t,n,r){let i=Array.from(t.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==r&&!e.hasAttribute(`data-mint-sortable-status`)),a=i.indexOf(n);if(a<0||this._lastPreviewRoot===t&&this._lastPreviewIndex===a)return;this._lastPreviewRoot=t,this._lastPreviewIndex=a;let o=this._getItemKeyAttribute(),s=i.map(e=>e===n?r.getAttribute(o)||``:e.getAttribute(o)||``),c={itemId:r.getAttribute(o)||``,oldIndex:this._startIndex,newIndex:a,keys:s,sourceContainerId:this.id||null,destinationContainerId:e.id||null};this.dispatchEvent(new CustomEvent(`mint-sortable-preview`,{bubbles:!0,composed:!0,detail:c})),this._resizeDragToPlaceholder(r,n)}_resizeDragToPlaceholder(e,t){this._previewResizeRaf!==null&&cancelAnimationFrame(this._previewResizeRaf),this._previewResizeRaf=requestAnimationFrame(()=>{if(this._previewResizeRaf=null,this._dragEl!==e||this._placeholder!==t||!t.isConnected)return;let n=t.getBoundingClientRect();!n.width||!n.height||(e.style.transition=`width 160ms ease, height 160ms ease`,e.style.width=`${n.width}px`,e.style.height=`${n.height}px`,e.style.transformOrigin=`top left`)})}_flipAnimate(e){let t=this._dragEl,n=this._getAnimationDurationMs(),r=this._getLayoutChildren().filter(e=>e!==t),i=new Map;if(r.forEach(e=>{let t=this._flipCleanupTimers.get(e);t!==void 0&&(window.clearTimeout(t),this._flipCleanupTimers.delete(e)),i.set(e,e.getBoundingClientRect()),e.style.transition=`none`,e.style.transform=``}),r.length&&r[0].offsetHeight,e(),n<=0||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){r.forEach(e=>{e.style.transition=``,e.style.transform=``});return}r.forEach(e=>{let t=i.get(e);if(!t)return;let r=e.getBoundingClientRect(),a=t.left-r.left,o=t.top-r.top;Math.abs(a)<.5&&Math.abs(o)<.5||(e.style.transition=`none`,e.style.transform=`translate(${a}px, ${o}px)`,requestAnimationFrame(()=>{e.style.transition=`transform ${n}ms cubic-bezier(0.22, 1, 0.36, 1)`,e.style.transform=``;let t=()=>{e.removeEventListener(`transitionend`,t),e.style.transition=``,e.style.transform=``,this._flipCleanupTimers.delete(e)};e.addEventListener(`transitionend`,t,{once:!0}),this._flipCleanupTimers.set(e,window.setTimeout(t,n+40))}))})}_onPointerUp(e){e.pointerId===this._pointerId&&(this._maybeMovePlaceholder(e),this._finishDrag(!1))}_onPointerCancel(e){e.pointerId===this._pointerId&&this._finishDrag(!0)}_finishDrag(e){let t=this._dragEl,r=this._placeholder;if(!t||this._pointerId===null){this._teardownDrag();return}this._previewResizeRaf!==null&&(cancelAnimationFrame(this._previewResizeRaf),this._previewResizeRaf=null);try{t.releasePointerCapture(this._pointerId)}catch{}window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel);let i=this._dropList??this,a=i._resolveListRoot();!e&&!this._dropRejected&&this._dropAtEnd&&i!==this&&r?.parentNode===a&&a.appendChild(r);let o=this.getAttribute(`data-tree-parent-id`)||null,s=i.getAttribute(`data-tree-parent-id`)||null,c=this._indexOfItem(t),l=r?.parentNode===a?Array.from(a.children).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==t&&!e.hasAttribute(`data-mint-sortable-status`)).indexOf(r):c,u=new CustomEvent(`mint-sortable-before-drop`,{bubbles:!0,composed:!0,cancelable:!0,detail:{item:t,source:this,target:i,oldIndex:c,newIndex:l,oldParentId:o,newParentId:s}});e||this.dispatchEvent(u);let d=e||this._dropRejected||u.defaultPrevented;if(d){let e=this._originListRoot??this._listRoot,n=this._originNextSibling??this._restoreAfter;n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t)}else r?.parentNode&&r.parentNode.insertBefore(t,r);r?.remove(),this._placeholder=null,t.classList.remove(n),t.style.cssText=``;let f=d?c:i._indexOfItem(t);this._pointerId=null,this._dragEl=null,this._restoreAfter=null,this._originListRoot=null,this._originNextSibling=null,this._dropList=null,this._dropAtEnd=!1,this._dropRejected=!1,this._lastPreviewRoot=null,this._lastPreviewIndex=-1;let p=this._collectOrderedKeys(),m=i._collectOrderedKeys(),h=!d&&(!d&&o!==s||f!==c),g=t.getAttribute(this._getItemKeyAttribute())||``,_={oldIndex:c,newIndex:f,cancelled:d,keys:p,sourceKeys:p,destinationKeys:m,oldParentId:o,newParentId:s,sourceContainerId:this.id||null,destinationContainerId:i.id||null,itemId:g};this.dispatchEvent(new CustomEvent(`mint-sortable-end`,{bubbles:!0,composed:!0,detail:_})),this.dispatchEvent(new CustomEvent(`sort-stop`,{bubbles:!0,composed:!0,detail:_})),h&&(this.dispatchEvent(new CustomEvent(`mint-sortable-change`,{bubbles:!0,composed:!0,detail:_})),this.dispatchEvent(new CustomEvent(`mint-sortable-order`,{bubbles:!0,composed:!0,detail:{keys:p,sourceKeys:p,destinationKeys:m,oldParentId:o,newParentId:s,itemId:g}})))}_teardownDrag(){if(this._previewResizeRaf!==null&&(cancelAnimationFrame(this._previewResizeRaf),this._previewResizeRaf=null),this._scrollRaf!==null&&(cancelAnimationFrame(this._scrollRaf),this._scrollRaf=null),window.removeEventListener(`pointermove`,this._boundPointerMove),window.removeEventListener(`pointerup`,this._boundPointerUp),window.removeEventListener(`pointercancel`,this._boundPointerCancel),this._dragEl){try{this._pointerId!==null&&this._dragEl.releasePointerCapture(this._pointerId)}catch{}this._dragEl.classList.remove(n),this._dragEl.style.cssText=``}this._placeholder?.remove(),this._placeholder=null,this._dragEl=null,this._pointerId=null,this._restoreAfter=null,this._originListRoot=null,this._originNextSibling=null,this._dropList=null,this._dropRejected=!1,this._lastPreviewRoot=null,this._lastPreviewIndex=-1}};customElements.get(`mint-sortable`)||e.t(`mint-sortable`,r),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./register-element-tCL_F1YI.js`),t=require(`./ScrollFade-Dfq2B1Hm.js`);var n=class extends HTMLElement{constructor(...e){super(...e),this._observer=null,this._disposeScrollFade=null}connectedCallback(){this.classList.add(`mint-table-host`);let e=this.closest(`[data-mint-rt-horizontal-scroll]`);this._disposeScrollFade=e?t.n(e,`horizontal`):t.n(this,`both`),this._observeChanges(),this._applyStyles(),requestAnimationFrame(()=>{this._applyStyles(),setTimeout(()=>this._applyStyles(),0)})}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._disposeScrollFade?.(),this._disposeScrollFade=null}_observeChanges(){this._observer=new MutationObserver(()=>this._applyStyles()),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!1})}_applyStyles(){this._observer?.disconnect();let e=Array.from(this.querySelectorAll(`table`));if(e.length===0){this._observer&&this._observeChanges();return}e.forEach(e=>{let t=!!e.closest(`[id^="mint-rt-vscroll-"]`)||!!e.closest(`mint-resource-table[data-mint-rt-fixed-header]`);e.classList.add(`mint-table-native`),e.classList.toggle(`mint-table-pinned-layout`,t)});let t=e.find(e=>e.querySelector(`thead`))??e[0],n=e.find(e=>e.querySelector(`tbody`))??e[0],r=t.querySelector(`thead`);r&&r.querySelectorAll(`th`).forEach(e=>{let t=e.querySelector(`mint-icon`),n=t?.getAttribute(`name`)||``,r=e.hasAttribute(`data-mint-rt-sortable`)||t!==null&&n!==`ellipsis`;e.classList.toggle(`mint-table-sortable`,r);let i=e.closest(`table`),a=i?.closest(`mint-resource-table`),o=!!i?.closest(`[id^="mint-rt-vscroll-"]`)||!!a?.hasAttribute(`data-mint-rt-fixed-header`);e.classList.toggle(`mint-table-pinned-header`,o)});let i=n.querySelector(`tbody`);if(i){let e=Array.from(i.querySelectorAll(`tr`)),t=!!n.closest(`[id^="mint-rt-vscroll-"]`)||!!n.closest(`mint-resource-table`)?.hasAttribute(`data-mint-rt-fixed-header`),r=e.findIndex(e=>e.getAttribute(`data-mint-rt-spacer`)===`bottom`);e.forEach((n,i)=>{let a=n.hasAttribute(`data-mint-rt-spacer`),o=n.hasAttribute(`data-row-clickable`);n.classList.toggle(`mint-table-spacer`,a),n.classList.toggle(`mint-table-clickable`,o&&!a),n.classList.toggle(`mint-table-row-bordered`,!a&&!t&&i!==e.length-1),Array.from(n.querySelectorAll(`td`)).forEach(o=>{let s=n.hasAttribute(`data-mint-rt-last-row`),c=r===-1&&i===e.length-1;o.classList.toggle(`mint-table-cell-bordered`,t&&!a&&!s&&!c),this._restoreCell(o)})})}n.querySelectorAll(`tfoot td`).forEach(e=>this._restoreCell(e)),this._observer&&this._observeChanges()}_restoreCell(e){if(e.dataset.mtProcessed!==`true`)return;let t={};Array.from(e.attributes).forEach(e=>{e.name.startsWith(`data-`)&&e.name!==`data-original`&&e.name!==`data-mt-processed`&&(t[e.name]=e.value)});let n=e.getAttribute(`data-original`)||``;e.dataset.mtProcessed=``,e.innerHTML=n,Object.entries(t).forEach(([t,n])=>e.setAttribute(t,n))}};customElements.get(`mint-table`)||e.t(`mint-table`,n),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -6,7 +6,9 @@ var n = class extends HTMLElement {
|
|
|
6
6
|
super(...e), this._observer = null, this._disposeScrollFade = null;
|
|
7
7
|
}
|
|
8
8
|
connectedCallback() {
|
|
9
|
-
this.classList.add("mint-table-host")
|
|
9
|
+
this.classList.add("mint-table-host");
|
|
10
|
+
let e = this.closest("[data-mint-rt-horizontal-scroll]");
|
|
11
|
+
this._disposeScrollFade = e ? t(e, "horizontal") : t(this, "both"), this._observeChanges(), this._applyStyles(), requestAnimationFrame(() => {
|
|
10
12
|
this._applyStyles(), setTimeout(() => this._applyStyles(), 0);
|
|
11
13
|
});
|
|
12
14
|
}
|
|
@@ -32,7 +32,7 @@ import "../chunks/caret-down-pn6aBT-u.js";
|
|
|
32
32
|
import "../chunks/popover-DPNBidSz.js";
|
|
33
33
|
import { n as t } from "../chunks/ScrollFade-Cg9fVO0V.js";
|
|
34
34
|
import "../chunks/search-COAeeXxO.js";
|
|
35
|
-
import "../chunks/table-
|
|
35
|
+
import "../chunks/table-BNZVNp5g.js";
|
|
36
36
|
import "../chunks/select-CnN6eiFK.js";
|
|
37
37
|
//#region src/components/resource-table/utility-aliases.js
|
|
38
38
|
var n = {
|