@orangelogic/orange-dam-content-browser-sdk 2.1.26 → 2.1.27
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.
|
@@ -3959,6 +3959,12 @@
|
|
|
3959
3959
|
|
|
3960
3960
|
.icon-button__icon-container {
|
|
3961
3961
|
position: relative;
|
|
3962
|
+
display: flex;
|
|
3963
|
+
align-items: center;
|
|
3964
|
+
justify-content: center;
|
|
3965
|
+
width: 100%;
|
|
3966
|
+
height: 100%;
|
|
3967
|
+
line-height: 1;
|
|
3962
3968
|
}
|
|
3963
3969
|
`;var vt=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,yt=(e,t,n,r)=>{for(var o,i=r>1?void 0:r?bt(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&vt(t,n,i),i};let xt=class extends xe{constructor(){super(...arguments),this.localize=new nt(this),this.hasFocus=!1,this.variant="outlined",this.buttonVariant="text",this.label="",this.disabled=!1,this.iconClass="",this.size="medium",this.outline=!1,this.circle=!1}firstUpdated(){this.syncStyles(),new MutationObserver((()=>this.syncStyles())).observe(this,{attributeFilter:["style"],attributes:!0})}syncStyles(){const e=this.style.fontSize;e&&this.button&&(this.icon.style.setProperty("--font-size",e),this.button.style.fontSize="inherit",this.style.fontSize="")}handleBlur(){this.hasFocus=!1,this.emit("cx-blur")}handleFocus(){this.hasFocus=!0,this.emit("cx-focus")}handleClick(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}click(){this.button.click()}focus(e){this.button.focus(e)}blur(){this.button.blur()}render(){const e=!!this.href,t=e?at`a`:at`button`;return lt`
|
|
3964
3970
|
<${t}
|
|
@@ -10561,6 +10567,9 @@ governing permissions and limitations under the License.
|
|
|
10561
10567
|
display: block;
|
|
10562
10568
|
outline: 0;
|
|
10563
10569
|
--selected-color: var(--cx-color-primary-600);
|
|
10570
|
+
--selected-background-color: var(--cx-color-primary-50);
|
|
10571
|
+
--hover-background-color: var(--cx-menu-item-background-color-hover);
|
|
10572
|
+
--active-background-color: var(--cx-color-neutral-200);
|
|
10564
10573
|
}
|
|
10565
10574
|
|
|
10566
10575
|
:host(:focus) {
|
|
@@ -10678,11 +10687,11 @@ governing permissions and limitations under the License.
|
|
|
10678
10687
|
}
|
|
10679
10688
|
|
|
10680
10689
|
.tree-item__item:hover {
|
|
10681
|
-
background-color: var(--
|
|
10690
|
+
background-color: var(--hover-background-color);
|
|
10682
10691
|
}
|
|
10683
10692
|
|
|
10684
10693
|
.tree-item__item:active {
|
|
10685
|
-
background-color: var(--
|
|
10694
|
+
background-color: var(--active-background-color);
|
|
10686
10695
|
}
|
|
10687
10696
|
|
|
10688
10697
|
.tree-item--disabled .tree-item__item {
|
|
@@ -10692,7 +10701,7 @@ governing permissions and limitations under the License.
|
|
|
10692
10701
|
}
|
|
10693
10702
|
|
|
10694
10703
|
:host(:not([aria-disabled='true'])) .tree-item--selected .tree-item__item {
|
|
10695
|
-
background-color: var(--
|
|
10704
|
+
background-color: var(--selected-background-color);
|
|
10696
10705
|
color: var(--selected-color);
|
|
10697
10706
|
}
|
|
10698
10707
|
|
|
@@ -10713,7 +10722,7 @@ governing permissions and limitations under the License.
|
|
|
10713
10722
|
:host(:not([aria-disabled='true']))
|
|
10714
10723
|
.tree-item--selected
|
|
10715
10724
|
.tree-item__actions::slotted(cx-icon-button) {
|
|
10716
|
-
--hover-color: var(--cx-color-neutral-0);
|
|
10725
|
+
--hover-background-color: var(--cx-color-neutral-0);
|
|
10717
10726
|
}
|
|
10718
10727
|
|
|
10719
10728
|
.tree-item__label {
|
|
@@ -10766,7 +10775,40 @@ governing permissions and limitations under the License.
|
|
|
10766
10775
|
outline: dashed 1px SelectedItem;
|
|
10767
10776
|
}
|
|
10768
10777
|
}
|
|
10769
|
-
|
|
10778
|
+
|
|
10779
|
+
::slotted(cx-tree-item) {
|
|
10780
|
+
--hover-background-color: inherit;
|
|
10781
|
+
--active-background-color: inherit;
|
|
10782
|
+
--selected-background-color: inherit;
|
|
10783
|
+
--selected-color: inherit;
|
|
10784
|
+
}
|
|
10785
|
+
|
|
10786
|
+
:host([data-dragging]) {
|
|
10787
|
+
position: relative;
|
|
10788
|
+
}
|
|
10789
|
+
|
|
10790
|
+
:host([data-dragging='inside']) {
|
|
10791
|
+
background-color: var(--cx-color-primary-400);
|
|
10792
|
+
}
|
|
10793
|
+
|
|
10794
|
+
:host([data-dragging='before'])::before {
|
|
10795
|
+
content: '';
|
|
10796
|
+
position: absolute;
|
|
10797
|
+
top: 0;
|
|
10798
|
+
left: 0;
|
|
10799
|
+
width: 100%;
|
|
10800
|
+
border-top: var(--cx-spacing-2x-small) solid var(--cx-color-primary-400);
|
|
10801
|
+
}
|
|
10802
|
+
|
|
10803
|
+
:host([data-dragging='after'])::before {
|
|
10804
|
+
content: '';
|
|
10805
|
+
position: absolute;
|
|
10806
|
+
bottom: 0;
|
|
10807
|
+
left: 0;
|
|
10808
|
+
width: 100%;
|
|
10809
|
+
border-bottom: var(--cx-spacing-2x-small) solid var(--cx-color-primary-400);
|
|
10810
|
+
}
|
|
10811
|
+
`,ef=()=>{const e=window.navigator&&window.navigator.userAgent||"";return!(navigator.userAgent.indexOf("Chrome")>-1)&&e.indexOf("Safari")>-1};!ef()&&window;const tf="tree-sortable",nf=e=>null==e;class rf extends Ap{constructor(e,t){super(e,t)}static create(e){return new rf(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}}rf.mount(new function(){function e(){}let t=null;return e.prototype={dragOver(){t&&(t.el.removeAttribute("data-dragging"),t=null)},dragOverValid(e){let{activeSortable:n,cancel:r,changed:o,completed:i,dragEl:a,originalEvent:s,putSortable:l,target:c}=e;if(t=null,!n||!n.options[tf]||!n.options.getDropZone||nf(n.options.insertBeforeZonePercentage)||nf(n.options.insertAfterZonePercentage))return;const u=n.options.getDropZone(c);if(!u)return;const d=u.getBoundingClientRect(),h=(s.clientY-d.top)/d.height,p=l||this.sortable;p.captureAnimationState(),p!==n&&n.captureAnimationState();const f=c.parentNode;if(a&&f&&(h<n.options.insertBeforeZonePercentage?(t={dragEl:a,el:c,position:-1},c.setAttribute("data-dragging","before")):h>n.options.insertAfterZonePercentage?(t={dragEl:a,el:c,position:1},c.setAttribute("data-dragging","after")):(t={dragEl:a,el:c,position:0},c.setAttribute("data-dragging","inside"))),p.animateAll(),p!==n&&n.animateAll(),!t)return!0;o(),i(!0),r()},dragStart(e){let{cancel:t,dragEl:n}=e;!n||cf.isTreeItem(n)||t()},drop(){if(t){const e=t.el.parentNode;e&&("CX-TREE"===e.tagName&&t.dragEl.removeAttribute("slot"),-1===t.position?e.insertBefore(t.dragEl,t.el):1===t.position?e.insertBefore(t.dragEl,t.el.nextSibling):(t.dragEl.setAttribute("slot","children"),t.el.appendChild(t.dragEl))),t.el.removeAttribute("data-dragging"),t=null}}},Object.assign(e,{pluginName:tf})});const of=e=>({...e,animation:100,emptyInsertThreshold:0,fallbackOnBody:!0,forceFallback:ef(),getDropZone:e=>{var t;return null==(t=null==e?void 0:e.shadowRoot)?void 0:t.querySelector(".tree-item__item")},insertAfterZonePercentage:.8,insertBeforeZonePercentage:.2,invertSwap:!0,onStart(t){var n;if(null==(n=e.onStart)||n.call(e,t),"CX-TREE-ITEM"===t.item.tagName){t.item.expanded=!1}},[tf]:!0,swapThreshold:.2});var af=Object.defineProperty,sf=Object.getOwnPropertyDescriptor,lf=(e,t,n,r)=>{for(var o,i=r>1?void 0:r?sf(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&af(t,n,i),i};let cf=class extends xe{constructor(){super(...arguments),this.localize=new nt(this),this.expanded=!1,this.selected=!1,this.disabled=!1,this.readonly=!1,this.lazy=!1,this.itemid="",this.sortable=!1,this.sortableGroup=void 0,this.expandButtonPlacement="start",this.disabledSyncCheckboxes=!1,this.partialSyncCheckboxes=!1,this.previouslySelected=!1,this.indeterminate=!1,this.isLeaf=!1,this.loading=!1,this.selectable=!1,this.sortableInstance=null,this.onDragStart=e=>{if(e.dataTransfer){const t=this.cloneNode(!0);t.style.backgroundColor="red",t.style.display="none",this.ownerDocument.body.appendChild(t),e.dataTransfer.setDragImage(t,0,0)}}}static isTreeItem(e){return e instanceof Element&&"treeitem"===e.getAttribute("role")}get showExpandButton(){return!this.loading&&(!this.isLeaf||this.lazy)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","treeitem"),this.setAttribute("tabindex","-1"),this.isNestedItem()&&(this.slot="children")}firstUpdated(){this.childrenContainer.hidden=!this.expanded,this.childrenContainer.style.height=this.expanded?"auto":"0",this.getChildrenItems().forEach((e=>e.expandButtonPlacement=this.expandButtonPlacement)),this.isLeaf=!this.lazy&&0===this.getChildrenItems().length,this.handleExpandedChange()}async animateCollapse(){this.emit("cx-collapse"),await Ee(this.childrenContainer);const{keyframes:e,options:t}=He(this,"tree-item.collapse",{dir:this.localize.dir()});await Se(this.childrenContainer,Ce(e,this.childrenContainer.scrollHeight),t),this.childrenContainer.hidden=!0,this.emit("cx-after-collapse")}isNestedItem(){const e=this.parentElement;return!!e&&cf.isTreeItem(e)}handleChildrenSlotChange(){this.loading=!1,this.getChildrenItems().forEach((e=>e.expandButtonPlacement=this.expandButtonPlacement)),this.isLeaf=!this.lazy&&0===this.getChildrenItems().length}willUpdate(e){e.has("selected")&&!e.has("indeterminate")&&(this.indeterminate=!1)}async animateExpand(){this.emit("cx-expand"),await Ee(this.childrenContainer),this.childrenContainer.hidden=!1;const{keyframes:e,options:t}=He(this,"tree-item.expand",{dir:this.localize.dir()});await Se(this.childrenContainer,Ce(e,this.childrenContainer.scrollHeight),t),this.childrenContainer.style.height="auto",this.emit("cx-after-expand")}handleLoadingChange(){this.setAttribute("aria-busy",this.loading?"true":"false"),this.loading||this.animateExpand()}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false"),this.hasUpdated&&this.emit("cx-selected-change",{detail:{selected:this.selected}})}handleExpandedChange(){this.isLeaf?this.removeAttribute("aria-expanded"):this.setAttribute("aria-expanded",this.expanded?"true":"false")}handleExpandAnimation(){this.expanded?this.lazy?(this.loading=!0,this.emit("cx-lazy-load")):this.animateExpand():this.animateCollapse()}async handleLazyChange(){!this.lazy&&this.loading&&(this.loading=!1,this.handleChildrenSlotChange()),this.selected&&(await this.updateComplete,gf(this)),this.emit("cx-lazy-change")}getChildrenItems(){let{includeDisabled:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.childrenSlot?[...this.childrenSlot.assignedElements({flatten:!0})].filter((t=>cf.isTreeItem(t)&&(e||!t.disabled))):[]}renderExpandButton(){const e="rtl"===this.localize.dir(),t=this.showExpandButton;return Q` <div
|
|
10770
10812
|
part="expand-button"
|
|
10771
10813
|
class=${Fe({"tree-item__expand-button":!0,"tree-item__expand-button--visible":t})}
|
|
10772
10814
|
aria-hidden="true"
|
|
@@ -10784,7 +10826,7 @@ governing permissions and limitations under the License.
|
|
|
10784
10826
|
<slot class="tree-item__expand-icon-slot" name="collapse-icon">
|
|
10785
10827
|
<cx-icon name=${e?"chevron_left":"chevron_right"}></cx-icon>
|
|
10786
10828
|
</slot>
|
|
10787
|
-
</div>`}handleSortableUpdate(e){const t=this.getChildrenItems({includeDisabled:!0});this.emit("cx-reorder",{detail:{from:e.from,items:t,newIndex:e.newIndex,oldIndex:e.oldIndex,to:e.to,type:e.type}})}destroySortable(){this.removeEventListener("dragstart",this.onDragStart),this.sortableInstance&&(this.sortableInstance.destroy(),this.sortableInstance=null)}initSortable(){this.addEventListener("dragstart",this.onDragStart),this.sortableInstance=rf.create(this,{...of({group:this.sortableGroup,onAdd:this.handleSortableUpdate.bind(this),onRemove:this.handleSortableUpdate.bind(this),onUpdate:this.handleSortableUpdate.bind(this)})})}updated(e){super.updated(e),e.has("sortable")&&(this.destroySortable(),this.sortable&&this.initSortable())}render(){const e=this.showExpandButton;return Q`
|
|
10829
|
+
</div>`}handleSortableUpdate(e){const t=this.getChildrenItems({includeDisabled:!0});this.emit("cx-reorder",{detail:{from:e.from,item:e.item,items:t,newIndex:e.newIndex,oldIndex:e.oldIndex,to:e.to,type:e.type}})}handleSortableStart(){this.emit("cx-drag-start")}handleSortableEnd(){this.emit("cx-drag-end")}destroySortable(){this.removeEventListener("dragstart",this.onDragStart),this.sortableInstance&&(this.sortableInstance.destroy(),this.sortableInstance=null)}initSortable(){this.addEventListener("dragstart",this.onDragStart),this.sortableInstance=rf.create(this,{...of({group:this.sortableGroup,onAdd:this.handleSortableUpdate.bind(this),onEnd:this.handleSortableEnd.bind(this),onRemove:this.handleSortableUpdate.bind(this),onStart:this.handleSortableStart.bind(this),onUpdate:this.handleSortableUpdate.bind(this)})})}updated(e){super.updated(e),e.has("sortable")&&(this.destroySortable(),this.sortable&&this.initSortable())}render(){const e=this.showExpandButton;return Q`
|
|
10788
10830
|
<div
|
|
10789
10831
|
part="base"
|
|
10790
10832
|
class="${Fe({"tree-item":!0,"tree-item--disabled":this.disabled,"tree-item--expanded":this.expanded,"tree-item--has-expand-button":e,"tree-item--leaf":this.isLeaf,"tree-item--rtl":"rtl"===this.localize.dir(),"tree-item--selected":this.selected})}"
|
|
@@ -10859,7 +10901,13 @@ governing permissions and limitations under the License.
|
|
|
10859
10901
|
display: flex;
|
|
10860
10902
|
flex-direction: column;
|
|
10861
10903
|
}
|
|
10862
|
-
|
|
10904
|
+
|
|
10905
|
+
:host([dragging]) ::slotted(cx-tree-item) {
|
|
10906
|
+
--hover-background-color: transparent !important;
|
|
10907
|
+
--active-background-color: transparent !important;
|
|
10908
|
+
--selected-background-color: transparent !important;
|
|
10909
|
+
}
|
|
10910
|
+
`;var df=Object.defineProperty,hf=Object.getOwnPropertyDescriptor,pf=(e,t,n,r)=>{for(var o,i=r>1?void 0:r?hf(t,n):t,a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&df(t,n,i),i};function ff(e){const t=e.getChildrenItems({includeDisabled:!1});if(t.length){const n=t.every((e=>e.selected)),r=t.every((e=>!e.selected&&!e.indeterminate));let o=!1,i=!1;(!n&&!r||e.partialSyncCheckboxes&&(n||r&&e.previouslySelected))&&(o=!0),i=e.partialSyncCheckboxes?n&&!o:n,e.indeterminate=o,e.selected=i}}function mf(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"single";const n=e.parentElement;cf.isTreeItem(n)&&!n.disabledSyncCheckboxes&&"multiple"===t&&(ff(n),mf(n,t))}function gf(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"single";!e.disabledSyncCheckboxes&&"multiple"===n&&(e.partialSyncCheckboxes&&(e.selected?e.previouslySelected=!0:e.previouslySelected=!1),function e(n){if(n instanceof cf||"treeitem"===n.getAttribute("role")){for(const r of n.getChildrenItems())r.selected=t?n.selected||r.selected:!r.disabled&&!r.readonly&&n.selected,e(r);t&&ff(n)}}(e)),mf(e,n)}let vf=class extends xe{constructor(){super(),this.sortable=!1,this.sortableGroup=null,this.disabledSortableGroup=!1,this.selection="single",this.disabledAutoExpand=!1,this.autoExpandToSelected=!1,this.expandButtonPlacement="start",this.forceOnChange=!1,this.labelSelectSingle=!1,this.clickTarget=null,this.localize=new nt(this),this.sortableInstance=null,this.initTreeItem=e=>{e.expandButtonPlacement=this.expandButtonPlacement,e.selectable="multiple"===this.selection,["expand","collapse"].filter((e=>!!this.querySelector(`[slot="${e}-icon"]`))).forEach((t=>{const n=e.querySelector(`[slot="${t}-icon"]`),r=this.getExpandButtonIcon(t);r&&(null===n?e.append(r):n.hasAttribute("data-default")&&n.replaceWith(r))})),this.sortable?(e.sortable=!0,e.sortableGroup=this.getSortableGroup()):e.sortable=!1},this.handleTreeChanged=e=>{for(const t of e){const e=[...t.addedNodes].filter(cf.isTreeItem),n=[...t.removedNodes].filter(cf.isTreeItem);e.forEach(this.initTreeItem),this.lastFocusedItem&&n.includes(this.lastFocusedItem)&&(this.lastFocusedItem=null)}},this.handleFocusOut=e=>{const t=e.relatedTarget;(!t||!this.contains(t))&&(this.tabIndex=0)},this.handleFocusIn=e=>{const t=e.target;e.target===this&&this.focusItem(this.lastFocusedItem||this.getAllTreeItems()[0]),cf.isTreeItem(t)&&!t.disabled&&!t.readonly&&(this.lastFocusedItem&&(this.lastFocusedItem.tabIndex=-1),this.lastFocusedItem=t,this.tabIndex=-1,t.tabIndex=0)},this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),this.addEventListener("cx-lazy-change",this.handleSlotChange)}async connectedCallback(){super.connectedCallback(),this.setAttribute("role","tree"),this.setAttribute("tabindex","0"),await this.updateComplete,this.mutationObserver=new MutationObserver(this.handleTreeChanged),this.mutationObserver.observe(this,{childList:!0,subtree:!0}),this.autoExpandToSelected&&this.getAllTreeItems().length&&customElements.whenDefined("cx-tree-item").then((()=>{this.selectedItems.forEach((e=>{this.expandToItem(e)}))}))}disconnectedCallback(){var e;super.disconnectedCallback(),null==(e=this.mutationObserver)||e.disconnect()}getExpandButtonIcon(e){const t=("expand"===e?this.expandedIconSlot:this.collapsedIconSlot).assignedElements({flatten:!0})[0];if(t){const n=t.cloneNode(!0);return[n,...n.querySelectorAll("[id]")].forEach((e=>e.removeAttribute("id"))),n.setAttribute("data-default",""),n.slot=`${e}-icon`,n}return null}selectItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=[...this.selectedItems],r=this.getAllTreeItems();if("multiple"===this.selection){if(t)for(const e of r)e.selected=!1;e.selected=t||!e.selected,e.lazy&&!this.disabledAutoExpand&&(e.expanded=!0),gf(e,!1,this.selection)}else if("single"===this.selection||e.isLeaf)for(const i of r)i.selected=i===e;else"leaf"===this.selection&&(e.expanded=!e.expanded);const o=this.selectedItems;(n.length!==o.length||o.some((e=>!n.includes(e)))||this.forceOnChange||t)&&Promise.all(o.map((e=>e.updateComplete))).then((()=>{this.emit("cx-selection-change",{detail:{selection:o}})}))}getAllTreeItems(){return[...this.querySelectorAll("cx-tree-item")]}getAllDirectTreeItems(){return[...this.querySelectorAll(":scope > cx-tree-item")]}focusItem(e){null==e||e.focus()}handleKeyDown(e){if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Home","End","Enter"," "].includes(e.key)||e.composedPath().some((e=>{var t;return["input","textarea"].includes(null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase())})))return;const t=this.getFocusableItems(),n="ltr"===this.localize.dir(),r="rtl"===this.localize.dir();if(t.length>0){e.preventDefault();const o=t.findIndex((e=>e.matches(":focus"))),i=t[o],a=e=>{const n=t[function(e,t,n){const r=e=>Object.is(e,-0)?0:e;return r(e<t?t:e>n?n:e)}(e,0,t.length-1)];this.focusItem(n)},s=e=>{i.expanded=e};"ArrowDown"===e.key?a(o+1):"ArrowUp"===e.key?a(o-1):n&&"ArrowRight"===e.key||r&&"ArrowLeft"===e.key?!i||i.disabled||i.readonly||i.expanded||i.isLeaf&&!i.lazy?a(o+1):s(!0):n&&"ArrowLeft"===e.key||r&&"ArrowRight"===e.key?!i||i.disabled||i.readonly||i.isLeaf||!i.expanded?a(o-1):s(!1):"Home"===e.key?a(0):"End"===e.key?a(t.length-1):("Enter"===e.key||" "===e.key)&&!i.disabled&&!i.readonly&&this.selectItem(i)}}handleClick(e){const t=e.composedPath(),n=e.target,r=n.closest("cx-tree-item"),o=e.composedPath().some((e=>{var t;return null==(t=null==e?void 0:e.classList)?void 0:t.contains("tree-item__expand-button")})),i=e.composedPath().some((e=>{var t;return null==(t=null==e?void 0:e.classList)?void 0:t.contains("tree-item__actions")})),a=t.find((e=>{var t;return null==(t=e.classList)?void 0:t.contains("checkbox__control")}));if(!r||r.disabled||r.readonly||n!==this.clickTarget||a)return;const s=!t.find((e=>{var t;return"cx-checkbox"===(null==(t=e.tagName)?void 0:t.toLowerCase())}));o&&r.showExpandButton?r.expanded=!r.expanded:i||this.selectItem(r,s&&this.labelSelectSingle&&"multiple"===this.selection)}handleMouseDown(e){this.clickTarget=e.target}expandToItem(e){var t;const n=null==(t=e.parentElement)?void 0:t.closest("cx-tree-item");n&&!n.expanded&&!n.lazy&&(n.expanded=!0,this.expandToItem(n))}handleSlotChange(){this.getAllTreeItems().forEach(this.initTreeItem)}handleSortableUpdate(e){const t=this.getAllDirectTreeItems();this.emit("cx-reorder",{detail:{from:e.from,item:e.item,items:t,newIndex:e.newIndex,oldIndex:e.oldIndex,to:e.to,type:e.type}})}destroySortable(){this.removeEventListener("cx-drag-start",this.handleSortableStart),this.removeEventListener("cx-drag-end",this.handleSortableEnd),this.sortableInstance&&(this.sortableInstance.destroy(),this.sortableInstance=null)}getSortableGroup(){if(!this.disabledSortableGroup)return this.sortableGroup||(this.sortableGroup=Zp()),this.sortableGroup}handleSortableStart(){this.setAttribute("dragging","")}handleSortableEnd(){this.removeAttribute("dragging")}initSortable(){this.addEventListener("cx-drag-start",this.handleSortableStart),this.addEventListener("cx-drag-end",this.handleSortableEnd),this.sortableInstance=rf.create(this,{...of({group:this.getSortableGroup(),onAdd:this.handleSortableUpdate.bind(this),onEnd:this.handleSortableEnd.bind(this),onRemove:this.handleSortableUpdate.bind(this),onStart:this.handleSortableStart.bind(this),onUpdate:this.handleSortableUpdate.bind(this)})})}async handleSelectionChange(){const e="multiple"===this.selection,t=this.getAllTreeItems();this.setAttribute("aria-multiselectable",e?"true":"false");for(const n of t)n.selectable=e;e?(await this.updateComplete,[...this.querySelectorAll(":scope > cx-tree-item")].forEach((e=>gf(e,!0,this.selection)))):this.autoExpandToSelected||t.forEach((e=>{e.selected=!1,e.indeterminate=!1}))}updated(e){super.updated(e),e.has("sortable")&&(this.destroySortable(),this.sortable&&this.initSortable())}get selectedItems(){return this.getAllTreeItems().filter((e=>e.partialSyncCheckboxes?e.selected||e.indeterminate&&e.previouslySelected:e.selected))}getFocusableItems(){const e=this.getAllTreeItems(),t=new Set;return e.filter((e=>{var n;if(e.disabled||e.readonly)return!1;const r=null==(n=e.parentElement)?void 0:n.closest("[role=treeitem]");return r&&(!r.expanded||r.loading||t.has(r))&&t.add(e),!t.has(e)}))}render(){return Q`
|
|
10863
10911
|
<div
|
|
10864
10912
|
part="base"
|
|
10865
10913
|
class="tree"
|