lituix 0.1.30 → 0.1.32
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/components.json +1 -1
- package/dist/components/lui-button-group.d.ts +1 -0
- package/dist/components/lui-button-group.d.ts.map +1 -1
- package/dist/index.browser.js +16 -9
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +16 -9
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +16 -9
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2217,7 +2217,7 @@ var K2=Object.create;var fs=Object.defineProperty;var ch=Object.getOwnPropertyDe
|
|
|
2217
2217
|
.submenu-chevron lui-icon {
|
|
2218
2218
|
--lui-icon-size: 16px;
|
|
2219
2219
|
}
|
|
2220
|
-
`],a([rt({attribute:!1})],Me.prototype,"items",2),a([rt()],Me.prototype,"placement",2),a([rt()],Me.prototype,"trigger",2),a([rt({type:Boolean,attribute:"close-on-select"})],Me.prototype,"closeOnSelect",2),a([rt({type:Boolean})],Me.prototype,"disabled",2),a([rt()],Me.prototype,"heading",2),a([rt({attribute:"heading-icon"})],Me.prototype,"headingIcon",2),a([rt({type:Boolean,attribute:"show-arrow"})],Me.prototype,"showArrow",2),a([rt({type:Boolean,attribute:"close-on-outside-press"})],Me.prototype,"closeOnOutsidePress",2),a([rt({type:Boolean,attribute:"close-on-esc"})],Me.prototype,"closeOnEsc",2),a([rt({type:Boolean,reflect:!0})],Me.prototype,"open",2),a([rt({type:Number,attribute:"open-delay"})],Me.prototype,"openDelay",2),a([rt({type:Number,attribute:"close-delay"})],Me.prototype,"closeDelay",2),a([rt({type:Number,attribute:"offset"})],Me.prototype,"offsetDistance",2),a([rt({reflect:!0})],Me.prototype,"backdrop",2),a([rt({attribute:"backdrop-style"})],Me.prototype,"backdropStyle",2),a([rt({type:Boolean})],Me.prototype,"portal",2),a([rt({type:Boolean,attribute:"same-width"})],Me.prototype,"sameWidth",2),a([rt({type:Number,attribute:"max-width"})],Me.prototype,"maxWidth",2),a([rt({type:Number,attribute:"max-height"})],Me.prototype,"maxHeight",2),a([rt({attribute:!1})],Me.prototype,"dropdownProps",2),a([rt({attribute:!1})],Me.prototype,"menuProps",2),a([rt({reflect:!0,attribute:"submenu-trigger"})],Me.prototype,"submenuTrigger",2),a([rt({attribute:"submenu-icon"})],Me.prototype,"submenuIcon",2),a([bp("lui-dropdown")],Me.prototype,"_dropdown",2),a([mf("lui-menu")],Me.prototype,"_menus",2),a([bp('slot[name="trigger"]')],Me.prototype,"_triggerSlot",2),a([gf()],Me.prototype,"_submenuPlacements",2),Me=a([pf("lui-dropmenu")],Me);var Re=class extends yf{constructor(){super(...arguments);this.selection="none";this.values=[];this.variant="default";this.size="md";this.radius="md";this.vertical=!1;this.disabled=!1;this.ripple=!1;this.block=!1;this.collapse="none";this.overflowLabel="\u66F4\u591A";this.overflowIcon="more-horizontal";this.overflowPlacement="bottom-end";this.overflowTriggerWidth=0;this.overflowTriggerProps={};this.items=[];this._overflowIndexes=[];this._activeInteractionIndex=-1;this._layoutFrame=0;this._indicatorFrame=0;this._onItemActivate=e=>{let t=e.detail?.item,r=e.detail?.value??t?.value??"";t&&this._commitItemActivation(t,r)};this._onSlotChange=()=>{this.items.length>0||(this._syncItems(),this._scheduleLayout())};this._onOverflowSelect=e=>{let t=Number(e.detail?.value),r=this._collectItems()[t];if(!r||r.item.disabled)return;let n=r.element;n!==r.item&&typeof n.trigger=="function"&&n.trigger(),r.item.trigger()};this._onGroupPointerOver=e=>{let t=e.composedPath(),n=this._collectItems().findIndex(({element:s,item:d})=>t.includes(s)||t.includes(d));this._setInteractionIndex(n)};this._onGroupPointerOut=e=>{let t=e.relatedTarget;t&&this._groupEl?.contains(t)||this._clearInteractionIndex()};this._onGroupPointerDown=e=>{let t=e.composedPath(),n=this._collectItems().findIndex(({element:s,item:d})=>t.includes(s)||t.includes(d));this._setInteractionIndex(n)};this._onGroupPointerUp=()=>{this._clearInteractionIndex()}}_applyInheritedItemProp(e,t,r){let n=`data-lui-button-group-${t}`;e.hasAttribute(t)&&!e.hasAttribute(n)||(e[t]=r,e.setAttribute(n,""))}connectedCallback(){super.connectedCallback(),this.addEventListener("button-group-item-activate",this._onItemActivate),this._resizeObserver=new ResizeObserver(()=>this._scheduleLayout())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("button-group-item-activate",this._onItemActivate),this._resizeObserver?.disconnect(),this._observedParent=void 0,this._layoutFrame&&cancelAnimationFrame(this._layoutFrame),this._indicatorFrame&&cancelAnimationFrame(this._indicatorFrame)}firstUpdated(){this._groupEl&&this._resizeObserver?.observe(this._groupEl),this._resizeObserver?.observe(this),this.parentElement&&(this._observedParent=this.parentElement,this._resizeObserver?.observe(this.parentElement)),this._scheduleLayout()}updated(e){this.parentElement&&this.parentElement!==this._observedParent&&(this._observedParent&&this._resizeObserver?.unobserve(this._observedParent),this._observedParent=this.parentElement,this._resizeObserver?.observe(this.parentElement)),this._syncItems(),this._syncOverflowTriggerProps(),(e.has("items")||e.has("collapse")||e.has("vertical")||e.has("block")||e.has("size")||e.has("radius")||e.has("overflowTriggerWidth"))&&this._scheduleLayout()}_collectItems(){return this.items.length>0?Array.from(this.renderRoot.querySelectorAll('lui-button-group-item[data-lui-generated="true"]')).map(e=>({element:e,item:e})):(this._assignedElements??[]).map(e=>{if(e.tagName.toLowerCase()==="lui-button-group-item")return{element:e,item:e};let t=e.shadowRoot?.querySelector("lui-button-group-item");return t?{element:e,item:t}:null}).filter(e=>!!e)}_syncItems(){let e=this._collectItems(),t=this._resolvedValues(),r=e.map((h,p)=>p).filter(h=>!this._overflowIndexes.includes(h)),n=this._overflowIndexes.length>0,s=this._usesSelectionIndicator(),d=new Set(r.filter(h=>t.includes(e[h]?.item.value??"")));e.forEach(({element:h,item:p},f)=>{let x=r.indexOf(f),k=x>0?r[x-1]:-1;p.grouped=!0,p.first=r[0]===f,p.last=!n&&r[r.length-1]===f,p.vertical=this.vertical,p.dividerHidden=s&&(d.has(f)||d.has(k)),p.interactionActive=this._activeInteractionIndex===f||k===this._activeInteractionIndex,this._applyInheritedItemProp(p,"variant",this.variant),this._applyInheritedItemProp(p,"size",this.size),this._applyInheritedItemProp(p,"radius",this.radius),this._applyInheritedItemProp(p,"ripple",this.ripple),this.disabled?(p.disabled||p.setAttribute("data-lui-button-group-disabled",""),p.disabled=!0):p.hasAttribute("data-lui-button-group-disabled")&&(p.removeAttribute("data-lui-button-group-disabled"),p.disabled=!1),(this.selection!=="none"||!p.hasAttribute("pressed"))&&(p.pressed=t.includes(p.value)),p.indicatorSelected=this._usesSelectionIndicator()&&p.pressed&&!this._overflowIndexes.includes(f),h.toggleAttribute("data-overflow-hidden",this._overflowIndexes.includes(f))})}_resolvedValues(){return this.selection==="single"?this.value?[this.value]:[]:this.selection==="multiple"?this.values.slice():this._collectItems().filter(({item:e})=>e.pressed).map(({item:e})=>e.value)}_readOverflowIcon(e,t){return e.getAttribute("icon")||t.getAttribute("icon")||t.querySelector('lui-icon[slot="prefix"], [slot="prefix"][name]')?.getAttribute("name")||e.shadowRoot?.querySelector('lui-button-group-item lui-icon[slot="prefix"], lui-button-group-item [slot="prefix"][name]')?.getAttribute("name")||void 0||void 0}_syncOverflowTriggerProps(){this._overflowTriggerButton&&oe(this._overflowTriggerButton,this.overflowTriggerProps)}_readOverflowLabel(e,t,r){let n=e.getAttribute("label")||t.getAttribute("label")||e.getAttribute("aria-label")||t.getAttribute("aria-label")||e.getAttribute("title")||t.getAttribute("title"),s=t.textContent?.trim()||e.textContent?.trim();return n||s||t.value||`item-${r}`}_overflowItems(){let e=this._collectItems();return this._overflowIndexes.flatMap(t=>{let r=e[t];if(!r)return[];let{element:n,item:s}=r;return[{key:String(t),value:String(t),label:this._readOverflowLabel(n,s,t),icon:this._readOverflowIcon(n,s),disabled:s.disabled,active:this.selection==="single"&&s.pressed,checked:this.selection!=="single"&&s.pressed}]})}_scheduleLayout(){this._layoutFrame&&cancelAnimationFrame(this._layoutFrame),this._indicatorFrame&&cancelAnimationFrame(this._indicatorFrame),this._layoutFrame=requestAnimationFrame(()=>{this._layoutFrame=0,this._recomputeLayout(),this._scheduleSelectionIndicatorLayout()})}_usesSelectionIndicator(){return this.selection==="single"&&!this.vertical}_scheduleSelectionIndicatorLayout(){this._indicatorFrame&&cancelAnimationFrame(this._indicatorFrame),this._indicatorFrame=requestAnimationFrame(()=>{this._indicatorFrame=0,this._updateSelectionIndicator()})}_updateSelectionIndicator(){let e=this._groupEl;if(!e||!this._usesSelectionIndicator()){e?.style.setProperty("--lui-button-group-indicator-opacity","0");return}let r=this._collectItems().find((d,h)=>d.item.pressed&&!this._overflowIndexes.includes(h));if(!r){e.style.setProperty("--lui-button-group-indicator-opacity","0");return}let n=e.getBoundingClientRect(),s=r.element.getBoundingClientRect();e.style.setProperty("--lui-button-group-indicator-x",`${s.left-n.left+e.scrollLeft}px`),e.style.setProperty("--lui-button-group-indicator-y",`${s.top-n.top+e.scrollTop}px`),e.style.setProperty("--lui-button-group-indicator-width",`${s.width}px`),e.style.setProperty("--lui-button-group-indicator-height",`${s.height}px`),e.style.setProperty("--lui-button-group-indicator-radius",getComputedStyle(r.item).getPropertyValue("--lui-button-group-item-radius")||"0px"),e.style.setProperty("--lui-button-group-indicator-opacity","1")}_getContainerWidth(){let e=Math.round(this.getBoundingClientRect().width),t=this._groupEl?.clientWidth??0,r=this.parentElement?.getBoundingClientRect(),n=Math.round(r?.width??0),s=r?Math.max(0,Math.round(r.right-this.getBoundingClientRect().left)):0,d=this.style.width.trim().length>0;return this.block||d?e||t||n:s||n||e||t}_defaultOverflowTriggerWidth(){let e=Number.parseFloat(getComputedStyle(this).getPropertyValue("--lui-button-height"));return Number.isFinite(e)&&e>0?Math.round(e):this.overflowTriggerWidth>0?this.overflowTriggerWidth:this.size==="sm"?32:this.size==="lg"?44:38}_readItemWidth(e){let t=e.getBoundingClientRect().width,r=Math.ceil(t||e.scrollWidth||e.offsetWidth||0);return Math.max(0,r)}_setOverflowIndexes(e){if(!(e.length!==this._overflowIndexes.length||e.some((r,n)=>r!==this._overflowIndexes[n]))){this._syncItems(),this._scheduleSelectionIndicatorLayout();return}this._overflowIndexes=e,this._syncItems(),this._scheduleSelectionIndicatorLayout()}_recomputeLayout(){if(this.collapse!=="auto"||this.vertical){this._setOverflowIndexes([]);return}let e=this._collectItems(),t=this._getContainerWidth();if(!e.length||!t){this._setOverflowIndexes([]);return}let r=e.map(({element:s})=>this._readItemWidth(s)),n=tp({itemWidths:r,containerWidth:t,overflowTriggerWidth:this._defaultOverflowTriggerWidth(),minVisibleItems:0});this._setOverflowIndexes(n.overflowIndexes)}_commitItemActivation(e,t=e.value){if(e){if(this.selection!=="none"){let r=ep({selection:this.selection,currentValue:this.value,currentValues:this.values,nextValue:t});this.value=r.value,this.values=r.values,this._syncItems(),this._scheduleSelectionIndicatorLayout()}this.dispatchEvent(new CustomEvent("change",{detail:{value:this.selection==="multiple"?void 0:this.value,values:this._resolvedValues(),item:e},bubbles:!0,composed:!0})),this.items.find(r=>r.value===t)?.onClick?.(this.items.find(r=>r.value===t))}}_setInteractionIndex(e){this._activeInteractionIndex!==e&&(this._activeInteractionIndex=e,this._syncItems())}_clearInteractionIndex(){this._activeInteractionIndex<0||(this._activeInteractionIndex=-1,this._syncItems())}_overflowTriggerRadius(){return this._overflowIndexes.length<this._collectItems().length?"0 var(--lui-button-group-radius) var(--lui-button-group-radius) 0":"var(--lui-button-group-radius)"}_renderDataItems(){return this.items.map(e=>kn`
|
|
2220
|
+
`],a([rt({attribute:!1})],Me.prototype,"items",2),a([rt()],Me.prototype,"placement",2),a([rt()],Me.prototype,"trigger",2),a([rt({type:Boolean,attribute:"close-on-select"})],Me.prototype,"closeOnSelect",2),a([rt({type:Boolean})],Me.prototype,"disabled",2),a([rt()],Me.prototype,"heading",2),a([rt({attribute:"heading-icon"})],Me.prototype,"headingIcon",2),a([rt({type:Boolean,attribute:"show-arrow"})],Me.prototype,"showArrow",2),a([rt({type:Boolean,attribute:"close-on-outside-press"})],Me.prototype,"closeOnOutsidePress",2),a([rt({type:Boolean,attribute:"close-on-esc"})],Me.prototype,"closeOnEsc",2),a([rt({type:Boolean,reflect:!0})],Me.prototype,"open",2),a([rt({type:Number,attribute:"open-delay"})],Me.prototype,"openDelay",2),a([rt({type:Number,attribute:"close-delay"})],Me.prototype,"closeDelay",2),a([rt({type:Number,attribute:"offset"})],Me.prototype,"offsetDistance",2),a([rt({reflect:!0})],Me.prototype,"backdrop",2),a([rt({attribute:"backdrop-style"})],Me.prototype,"backdropStyle",2),a([rt({type:Boolean})],Me.prototype,"portal",2),a([rt({type:Boolean,attribute:"same-width"})],Me.prototype,"sameWidth",2),a([rt({type:Number,attribute:"max-width"})],Me.prototype,"maxWidth",2),a([rt({type:Number,attribute:"max-height"})],Me.prototype,"maxHeight",2),a([rt({attribute:!1})],Me.prototype,"dropdownProps",2),a([rt({attribute:!1})],Me.prototype,"menuProps",2),a([rt({reflect:!0,attribute:"submenu-trigger"})],Me.prototype,"submenuTrigger",2),a([rt({attribute:"submenu-icon"})],Me.prototype,"submenuIcon",2),a([bp("lui-dropdown")],Me.prototype,"_dropdown",2),a([mf("lui-menu")],Me.prototype,"_menus",2),a([bp('slot[name="trigger"]')],Me.prototype,"_triggerSlot",2),a([gf()],Me.prototype,"_submenuPlacements",2),Me=a([pf("lui-dropmenu")],Me);var Re=class extends yf{constructor(){super(...arguments);this.selection="none";this.values=[];this.variant="default";this.size="md";this.radius="md";this.vertical=!1;this.disabled=!1;this.ripple=!1;this.block=!1;this.collapse="none";this.overflowLabel="\u66F4\u591A";this.overflowIcon="more-horizontal";this.overflowPlacement="bottom-end";this.overflowTriggerWidth=0;this.overflowTriggerProps={};this.items=[];this._overflowIndexes=[];this._activeInteractionIndex=-1;this._layoutFrame=0;this._indicatorFrame=0;this._indicatorLastKey=null;this._onItemActivate=e=>{let t=e.detail?.item,r=e.detail?.value??t?.value??"";t&&this._commitItemActivation(t,r)};this._onSlotChange=()=>{this.items.length>0||(this._syncItems(),this._scheduleLayout())};this._onOverflowSelect=e=>{let t=Number(e.detail?.value),r=this._collectItems()[t];if(!r||r.item.disabled)return;let n=r.element;n!==r.item&&typeof n.trigger=="function"&&n.trigger(),r.item.trigger()};this._onGroupPointerOver=e=>{let t=e.composedPath(),n=this._collectItems().findIndex(({element:s,item:d})=>t.includes(s)||t.includes(d));this._setInteractionIndex(n)};this._onGroupPointerOut=e=>{let t=e.relatedTarget;t&&this._groupEl?.contains(t)||this._clearInteractionIndex()};this._onGroupPointerDown=e=>{let t=e.composedPath(),n=this._collectItems().findIndex(({element:s,item:d})=>t.includes(s)||t.includes(d));this._setInteractionIndex(n)};this._onGroupPointerUp=()=>{this._clearInteractionIndex()}}_applyInheritedItemProp(e,t,r){let n=`data-lui-button-group-${t}`;e.hasAttribute(t)&&!e.hasAttribute(n)||(e[t]=r,e.setAttribute(n,""))}connectedCallback(){super.connectedCallback(),this.addEventListener("button-group-item-activate",this._onItemActivate),this._resizeObserver=new ResizeObserver(()=>this._scheduleLayout())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("button-group-item-activate",this._onItemActivate),this._resizeObserver?.disconnect(),this._observedParent=void 0,this._layoutFrame&&cancelAnimationFrame(this._layoutFrame),this._indicatorFrame&&cancelAnimationFrame(this._indicatorFrame)}firstUpdated(){this._groupEl&&this._resizeObserver?.observe(this._groupEl),this._resizeObserver?.observe(this),this.parentElement&&(this._observedParent=this.parentElement,this._resizeObserver?.observe(this.parentElement)),this._scheduleLayout()}updated(e){this.parentElement&&this.parentElement!==this._observedParent&&(this._observedParent&&this._resizeObserver?.unobserve(this._observedParent),this._observedParent=this.parentElement,this._resizeObserver?.observe(this.parentElement)),this._syncItems(),this._syncOverflowTriggerProps(),(e.has("items")||e.has("collapse")||e.has("vertical")||e.has("block")||e.has("size")||e.has("radius")||e.has("overflowTriggerWidth"))&&this._scheduleLayout(),this._groupEl?.setAttribute("data-indicator-still","")}_collectItems(){return this.items.length>0?Array.from(this.renderRoot.querySelectorAll('lui-button-group-item[data-lui-generated="true"]')).map(e=>({element:e,item:e})):(this._assignedElements??[]).map(e=>{if(e.tagName.toLowerCase()==="lui-button-group-item")return{element:e,item:e};let t=e.shadowRoot?.querySelector("lui-button-group-item");return t?{element:e,item:t}:null}).filter(e=>!!e)}_syncItems(){let e=this._collectItems(),t=this._resolvedValues(),r=e.map((h,p)=>p).filter(h=>!this._overflowIndexes.includes(h)),n=this._overflowIndexes.length>0,s=this._usesSelectionIndicator(),d=new Set(r.filter(h=>t.includes(e[h]?.item.value??"")));e.forEach(({element:h,item:p},f)=>{let x=r.indexOf(f),k=x>0?r[x-1]:-1;p.grouped=!0,p.first=r[0]===f,p.last=!n&&r[r.length-1]===f,p.vertical=this.vertical,p.dividerHidden=s&&(d.has(f)||d.has(k)),p.interactionActive=this._activeInteractionIndex===f||k===this._activeInteractionIndex,this._applyInheritedItemProp(p,"variant",this.variant),this._applyInheritedItemProp(p,"size",this.size),this._applyInheritedItemProp(p,"radius",this.radius),this._applyInheritedItemProp(p,"ripple",this.ripple),this.disabled?(p.disabled||p.setAttribute("data-lui-button-group-disabled",""),p.disabled=!0):p.hasAttribute("data-lui-button-group-disabled")&&(p.removeAttribute("data-lui-button-group-disabled"),p.disabled=!1),(this.selection!=="none"||!p.hasAttribute("pressed"))&&(p.pressed=t.includes(p.value)),p.indicatorSelected=this._usesSelectionIndicator()&&p.pressed&&!this._overflowIndexes.includes(f),h.toggleAttribute("data-overflow-hidden",this._overflowIndexes.includes(f))})}_resolvedValues(){return this.selection==="single"?this.value?[this.value]:[]:this.selection==="multiple"?this.values.slice():this._collectItems().filter(({item:e})=>e.pressed).map(({item:e})=>e.value)}_readOverflowIcon(e,t){return e.getAttribute("icon")||t.getAttribute("icon")||t.querySelector('lui-icon[slot="prefix"], [slot="prefix"][name]')?.getAttribute("name")||e.shadowRoot?.querySelector('lui-button-group-item lui-icon[slot="prefix"], lui-button-group-item [slot="prefix"][name]')?.getAttribute("name")||void 0||void 0}_syncOverflowTriggerProps(){this._overflowTriggerButton&&oe(this._overflowTriggerButton,this.overflowTriggerProps)}_readOverflowLabel(e,t,r){let n=e.getAttribute("label")||t.getAttribute("label")||e.getAttribute("aria-label")||t.getAttribute("aria-label")||e.getAttribute("title")||t.getAttribute("title"),s=t.textContent?.trim()||e.textContent?.trim();return n||s||t.value||`item-${r}`}_overflowItems(){let e=this._collectItems();return this._overflowIndexes.flatMap(t=>{let r=e[t];if(!r)return[];let{element:n,item:s}=r;return[{key:String(t),value:String(t),label:this._readOverflowLabel(n,s,t),icon:this._readOverflowIcon(n,s),disabled:s.disabled,active:this.selection==="single"&&s.pressed,checked:this.selection!=="single"&&s.pressed}]})}_scheduleLayout(){this._layoutFrame&&cancelAnimationFrame(this._layoutFrame),this._indicatorFrame&&cancelAnimationFrame(this._indicatorFrame),this._layoutFrame=requestAnimationFrame(()=>{this._layoutFrame=0,this._recomputeLayout(),this._scheduleSelectionIndicatorLayout()})}_usesSelectionIndicator(){return this.selection==="single"&&!this.vertical}_scheduleSelectionIndicatorLayout(){this._indicatorFrame&&cancelAnimationFrame(this._indicatorFrame),this._indicatorFrame=requestAnimationFrame(()=>{this._indicatorFrame=0,this._updateSelectionIndicator()})}_updateSelectionIndicator(){let e=this._groupEl;if(!e||!this._usesSelectionIndicator()){e?.style.setProperty("--lui-button-group-indicator-opacity","0"),this._indicatorLastKey=null;return}let r=this._collectItems().find((h,p)=>h.item.pressed&&!this._overflowIndexes.includes(p));if(!r){e.style.setProperty("--lui-button-group-indicator-opacity","0"),this._indicatorLastKey=null;return}let n=String(r.item.value??r.item.textContent??"");this._indicatorLastKey!==null&&this._indicatorLastKey!==n&&e.removeAttribute("data-indicator-still");let s=e.getBoundingClientRect(),d=r.element.getBoundingClientRect();e.style.setProperty("--lui-button-group-indicator-x",`${d.left-s.left+e.scrollLeft}px`),e.style.setProperty("--lui-button-group-indicator-y",`${d.top-s.top+e.scrollTop}px`),e.style.setProperty("--lui-button-group-indicator-width",`${d.width}px`),e.style.setProperty("--lui-button-group-indicator-height",`${d.height}px`),e.style.setProperty("--lui-button-group-indicator-radius",getComputedStyle(r.item).getPropertyValue("--lui-button-group-item-radius")||"0px"),e.style.setProperty("--lui-button-group-indicator-opacity","1"),this._indicatorLastKey=n}_getContainerWidth(){let e=Math.round(this.getBoundingClientRect().width),t=this._groupEl?.clientWidth??0,r=this.parentElement?.getBoundingClientRect(),n=Math.round(r?.width??0),s=r?Math.max(0,Math.round(r.right-this.getBoundingClientRect().left)):0,d=this.style.width.trim().length>0;return this.block||d?e||t||n:s||n||e||t}_defaultOverflowTriggerWidth(){let e=Number.parseFloat(getComputedStyle(this).getPropertyValue("--lui-button-height"));return Number.isFinite(e)&&e>0?Math.round(e):this.overflowTriggerWidth>0?this.overflowTriggerWidth:this.size==="sm"?32:this.size==="lg"?44:38}_readItemWidth(e){let t=e.getBoundingClientRect().width,r=Math.ceil(t||e.scrollWidth||e.offsetWidth||0);return Math.max(0,r)}_setOverflowIndexes(e){if(!(e.length!==this._overflowIndexes.length||e.some((r,n)=>r!==this._overflowIndexes[n]))){this._syncItems(),this._scheduleSelectionIndicatorLayout();return}this._overflowIndexes=e,this._syncItems(),this._scheduleSelectionIndicatorLayout()}_recomputeLayout(){if(this.collapse!=="auto"||this.vertical){this._setOverflowIndexes([]);return}let e=this._collectItems(),t=this._getContainerWidth();if(!e.length||!t){this._setOverflowIndexes([]);return}let r=e.map(({element:s})=>this._readItemWidth(s)),n=tp({itemWidths:r,containerWidth:t,overflowTriggerWidth:this._defaultOverflowTriggerWidth(),minVisibleItems:0});this._setOverflowIndexes(n.overflowIndexes)}_commitItemActivation(e,t=e.value){if(e){if(this.selection!=="none"){let r=ep({selection:this.selection,currentValue:this.value,currentValues:this.values,nextValue:t});this.value=r.value,this.values=r.values,this._syncItems(),this._scheduleSelectionIndicatorLayout()}this.dispatchEvent(new CustomEvent("change",{detail:{value:this.selection==="multiple"?void 0:this.value,values:this._resolvedValues(),item:e},bubbles:!0,composed:!0})),this.items.find(r=>r.value===t)?.onClick?.(this.items.find(r=>r.value===t))}}_setInteractionIndex(e){this._activeInteractionIndex!==e&&(this._activeInteractionIndex=e,this._syncItems())}_clearInteractionIndex(){this._activeInteractionIndex<0||(this._activeInteractionIndex=-1,this._syncItems())}_overflowTriggerRadius(){return this._overflowIndexes.length<this._collectItems().length?"0 var(--lui-button-group-radius) var(--lui-button-group-radius) 0":"var(--lui-button-group-radius)"}_renderDataItems(){return this.items.map(e=>kn`
|
|
2221
2221
|
<lui-button-group-item
|
|
2222
2222
|
data-lui-generated="true"
|
|
2223
2223
|
value=${e.value}
|
|
@@ -2239,6 +2239,7 @@ var K2=Object.create;var fs=Object.defineProperty;var ch=Object.getOwnPropertyDe
|
|
|
2239
2239
|
class="group"
|
|
2240
2240
|
part="group"
|
|
2241
2241
|
role="group"
|
|
2242
|
+
data-indicator-still
|
|
2242
2243
|
data-has-overflow=${t?"true":"false"}
|
|
2243
2244
|
@pointerover=${this._onGroupPointerOver}
|
|
2244
2245
|
@pointerout=${this._onGroupPointerOut}
|
|
@@ -2385,6 +2386,12 @@ var K2=Object.create;var fs=Object.defineProperty;var ch=Object.getOwnPropertyDe
|
|
|
2385
2386
|
will-change: transform, width, height;
|
|
2386
2387
|
z-index: 0;
|
|
2387
2388
|
}
|
|
2389
|
+
/* 初始挂载/布局重建时禁过渡:指示器从 0,0 跳到目标位置的滑动
|
|
2390
|
+
不是用户要的"点击切换"反馈,反而会看到一块东西从左上角飞过去。
|
|
2391
|
+
真实的选项切换在 _updateSelectionIndicator 里移除该标记 */
|
|
2392
|
+
[data-indicator-still] .selection-indicator {
|
|
2393
|
+
transition: none;
|
|
2394
|
+
}
|
|
2388
2395
|
.group[data-has-overflow="true"] {
|
|
2389
2396
|
align-items: stretch;
|
|
2390
2397
|
}
|
|
@@ -5292,15 +5299,15 @@ var K2=Object.create;var fs=Object.defineProperty;var ch=Object.getOwnPropertyDe
|
|
|
5292
5299
|
justify-content: flex-end;
|
|
5293
5300
|
text-align: right;
|
|
5294
5301
|
}
|
|
5295
|
-
th
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5302
|
+
/* resizer/拖拽把手需要 th 是定位上下文;但 position:relative 与
|
|
5303
|
+
fixed 列的 position:sticky 同优先级且在后会覆盖它,导致表头不吸。
|
|
5304
|
+
所以 relative 只给非 fixed 的 th——fixed 的 th 自带 sticky 定位,
|
|
5305
|
+
本身就是 containing block。 */
|
|
5306
|
+
th[data-resizable="true"]:not(.fixed-left):not(.fixed-right),
|
|
5307
|
+
th[data-reorderable="true"]:not(.fixed-left):not(.fixed-right),
|
|
5308
|
+
.vhead-cell[data-resizable="true"]:not(.fixed-left):not(.fixed-right),
|
|
5309
|
+
.vhead-cell[data-reorderable="true"]:not(.fixed-left):not(.fixed-right) {
|
|
5299
5310
|
position: relative;
|
|
5300
|
-
/* Safari/老 Firefox 对 display:table-cell 的 position:relative 会忽略,
|
|
5301
|
-
把手回落到 .table-wrap 全部堆在表右缘;translateZ(0) 把 th 提升为
|
|
5302
|
-
transform containing block,等效定位且全平台一致 */
|
|
5303
|
-
transform: translateZ(0);
|
|
5304
5311
|
}
|
|
5305
5312
|
.column-drag-handle {
|
|
5306
5313
|
display: inline-flex;
|