You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
8.8 KiB
20 lines
8.8 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("exports ./componentsUtils ./dom ./key ./interactive ./component ./icon ./table-cell ./table-header".split(" "),function(l,d,g,p,h,q,r,t,u){function m(){"undefined"!==typeof customElements&&["calcite-table-row","calcite-icon","calcite-table-cell","calcite-table-header"].forEach(a=>{switch(a){case "calcite-table-row":customElements.get(a)||customElements.define(a,n);break;case "calcite-icon":customElements.get(a)||r.defineCustomElement();break;case "calcite-table-cell":customElements.get(a)|| |
|
t.defineCustomElement();break;case "calcite-table-header":customElements.get(a)||u.defineCustomElement()}})}const n=d.proxyCustomElement(class extends d.H{constructor(){super();this.__registerHost();this.__attachShadow();this.calciteTableRowSelect=d.createEvent(this,"calciteTableRowSelect",6);this.calciteInternalTableRowFocusRequest=d.createEvent(this,"calciteInternalTableRowFocusRequest",6);this.rowCells=[];this.keyDownHandler=a=>{if("interactive"===this.interactionMode){var c=a.target,f=a.key,e= |
|
a.ctrlKey,b=this.rowCells;if(c.matches("calcite-table-cell")||c.matches("calcite-table-header"))switch(f){case "ArrowUp":this.emitTableRowFocusRequest(c.positionInRow,this.positionAll,"previous");a.preventDefault();break;case "ArrowDown":this.emitTableRowFocusRequest(c.positionInRow,this.positionAll,"next");a.preventDefault();break;case "PageUp":this.emitTableRowFocusRequest(c.positionInRow,this.positionAll,"first");a.preventDefault();break;case "PageDown":this.emitTableRowFocusRequest(c.positionInRow, |
|
this.positionAll,"last");a.preventDefault();break;case "ArrowLeft":g.focusElementInGroup(b,c,"previous",!1);a.preventDefault();break;case "ArrowRight":g.focusElementInGroup(b,c,"next",!1);a.preventDefault();break;case "Home":e?this.emitTableRowFocusRequest(1,this.positionAll,"first"):g.focusElementInGroup(b,c,"first",!1);a.preventDefault();break;case "End":e?this.emitTableRowFocusRequest(this.rowCells?.length,this.positionAll,"last",!0):g.focusElementInGroup(b,c,"last",!1),a.preventDefault()}}};this.emitTableRowFocusRequest= |
|
(a,c,f,e)=>{this.calciteInternalTableRowFocusRequest.emit({cellPosition:a,rowPosition:c,destination:f,lastCell:e})};this.updateCells=()=>{const a=this.alignment?this.alignment:"head"!==this.rowType?"center":"start",c=this.tableRowSlotEl?.assignedElements({flatten:!0})?.filter(b=>b.matches("calcite-table-cell")||b.matches("calcite-table-header")),f=Array.from(this.tableRowEl?.querySelectorAll("calcite-table-header, calcite-table-cell"))?.filter(b=>b.numberCell||b.selectionCell),e=f?f.concat(c):c;0< |
|
e.length&&e?.forEach((b,k)=>{b.interactionMode=this.interactionMode;b.lastCell=k===e.length-1;b.parentRowAlignment=a;b.parentRowIsSelected=this.selected;b.parentRowType=this.rowType;b.positionInRow=k+1;b.scale=this.scale;"CALCITE-TABLE-CELL"===b.nodeName&&(b.readCellContentsToAT=this.readCellContentsToAT,b.disabled=this.disabled)});this.rowCells=e||[];this.cellCount=e?.length};this.handleSelectionOfRow=()=>{this.calciteTableRowSelect.emit()};this.handleKeyboardSelection=a=>{p.isActivationKey(a.key)&& |
|
(" "===a.key&&a.preventDefault(),this.handleSelectionOfRow())};this.alignment=void 0;this.selected=this.disabled=!1;this.cellCount=void 0;this.interactionMode="interactive";this.rowType=this.lastVisibleRow=void 0;this.numbered=!1;this.scale=this.readCellContentsToAT=this.positionAll=this.positionSectionLocalized=this.positionSection=void 0;this.selectionMode="none";this.bodyRowCount=this.selectedRowCountLocalized=this.selectedRowCount=void 0;this.effectiveLocale=""}handleCellChanges(){this.tableRowEl&& |
|
0<this.rowCells.length&&this.updateCells()}handleDelayedCellChanges(){this.tableRowEl&&0<this.rowCells.length&&requestAnimationFrame(()=>this.updateCells())}componentDidLoad(){this.tableRowEl&&0<this.rowCells.length&&this.updateCells()}connectedCallback(){h.connectInteractive(this)}componentDidRender(){h.updateHostInteraction(this)}disconnectedCallback(){h.disconnectInteractive(this)}calciteInternalTableRowFocusChangeHandler(a){if(a.target.contains(this.el)){const c=a.detail.cellPosition,f=a.detail.destination, |
|
e=a.detail.lastCell;a.detail.rowPosition===this.positionAll&&(this.disabled?this.emitTableRowFocusRequest(c,this.positionAll,"last"===f?"previous":"first"===f?"next":f):(a=e?this.rowCells[this.rowCells.length-1]:this.rowCells?.find((b,k)=>k+1===c))&&a.setFocus())}}renderSelectionIcon(){return d.h("calcite-icon",{icon:"multiple"===this.selectionMode&&this.selected?"check-square-f":"multiple"===this.selectionMode?"square":this.selected?"circle-f":"circle",scale:q.getIconScale(this.scale)})}renderSelectableCell(){return"head"=== |
|
this.rowType?d.h("calcite-table-header",{alignment:"center",bodyRowCount:this.bodyRowCount,key:"selection-head",onClick:"multiple"===this.selectionMode&&this.handleSelectionOfRow,onKeyDown:"multiple"===this.selectionMode&&this.handleKeyboardSelection,parentRowAlignment:this.alignment,selectedRowCount:this.selectedRowCount,selectedRowCountLocalized:this.selectedRowCountLocalized,selectionCell:!0,selectionMode:this.selectionMode}):"body"===this.rowType?d.h("calcite-table-cell",{alignment:"center",key:"selection-body", |
|
onClick:this.handleSelectionOfRow,onKeyDown:this.handleKeyboardSelection,parentRowAlignment:this.alignment,parentRowIsSelected:this.selected,parentRowPositionLocalized:this.positionSectionLocalized,selectionCell:!0},this.renderSelectionIcon()):d.h("calcite-table-cell",{alignment:"center",key:"selection-foot",parentRowAlignment:this.alignment,selectionCell:!0})}renderNumberedCell(){return"head"===this.rowType?d.h("calcite-table-header",{alignment:"center",key:"numbered-head",numberCell:!0,parentRowAlignment:this.alignment}): |
|
"body"===this.rowType?d.h("calcite-table-cell",{alignment:"center",key:"numbered-body",numberCell:!0,parentRowAlignment:this.alignment},this.positionSectionLocalized):d.h("calcite-table-cell",{alignment:"center",key:"numbered-foot",numberCell:!0,parentRowAlignment:this.alignment})}render(){return d.h(d.Host,{key:"1d51f5351ce604d34d7b5a8c6ff241d1f1bb7121"},d.h(h.InteractiveContainer,{key:"67d835df1a6a91ebddd1742f76bdf45407bce5e5",disabled:this.disabled},d.h("tr",{key:"b490313209717e71bb18e277d6795895e7f60a25", |
|
"aria-disabled":this.disabled,"aria-rowindex":this.positionAll+1,"aria-selected":this.selected,class:{["last-visible-row"]:this.lastVisibleRow},onKeyDown:this.keyDownHandler,ref:a=>this.tableRowEl=a},this.numbered&&this.renderNumberedCell(),"none"!==this.selectionMode&&this.renderSelectableCell(),d.h("slot",{key:"ca447805a4b4a807ee113fd438fca4fe95a6b6c6",onSlotchange:this.updateCells,ref:a=>this.tableRowSlotEl=a}))))}get el(){return this}static get watchers(){return{bodyRowCount:["handleCellChanges"], |
|
scale:["handleCellChanges"],selected:["handleCellChanges"],selectedRowCount:["handleCellChanges"],interactionMode:["handleCellChanges"],numbered:["handleDelayedCellChanges"],selectionMode:["handleDelayedCellChanges"]}}static get style(){return":host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{--calcite-internal-table-row-background:var(--calcite-table-row-background, var(--calcite-color-foreground-1));--calcite-internal-table-row-border-color:var(--calcite-table-row-border-color, transparent);display:contents}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) tr{pointer-events:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}tr{border-block-end:1px solid var(--calcite-internal-table-row-border-color);background-color:var(--calcite-internal-table-row-background)}tr.last-visible-row{border-block-end:0}"}}, |
|
[1,"calcite-table-row",{alignment:[513],disabled:[516],selected:[516],cellCount:[1026,"cell-count"],interactionMode:[1,"interaction-mode"],lastVisibleRow:[4,"last-visible-row"],rowType:[1,"row-type"],numbered:[4],positionSection:[2,"position-section"],positionSectionLocalized:[1,"position-section-localized"],positionAll:[2,"position-all"],readCellContentsToAT:[4,"read-cell-contents-to-a-t"],scale:[1],selectionMode:[1,"selection-mode"],selectedRowCount:[2,"selected-row-count"],selectedRowCountLocalized:[1, |
|
"selected-row-count-localized"],bodyRowCount:[2,"body-row-count"],effectiveLocale:[32]},[[4,"calciteInternalTableRowFocusChange","calciteInternalTableRowFocusChangeHandler"]],{bodyRowCount:["handleCellChanges"],scale:["handleCellChanges"],selected:["handleCellChanges"],selectedRowCount:["handleCellChanges"],interactionMode:["handleCellChanges"],numbered:["handleDelayedCellChanges"],selectionMode:["handleDelayedCellChanges"]}]);m();l.CalciteTableRow=n;l.defineCustomElement=m;Object.defineProperty(l, |
|
Symbol.toStringTag,{value:"Module"})}); |