@aceshooting/lyra-ui 30.9.0 → 31.0.0
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/CHANGELOG.md +236 -339
- package/dist/ai/adapters/ag-ui.js +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
- package/dist/components/agent-tools/compare-panel/compare-panel.class.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.class.js +1 -1
- package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +1 -1
- package/dist/components/charts/chart/box-plot.class.js +2 -2
- package/dist/components/charts/chart/chart-sync.js +1 -1
- package/dist/components/charts/chart/chart.class.d.ts +1 -1
- package/dist/components/charts/chart/chart.class.js +4 -4
- package/dist/components/charts/chart/lite-chart-axis-layout.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.js +1 -1
- package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +9 -4
- package/dist/components/conversation/chat-composer/chat-composer.class.js +1 -1
- package/dist/components/conversation/chat-composer/chat-composer.styles.js +1 -1
- package/dist/components/conversation/chat-message/chat-message.class.d.ts +27 -3
- package/dist/components/conversation/chat-message/chat-message.class.js +14 -12
- package/dist/components/conversation/chat-message/chat-message.styles.js +1 -1
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +29 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +1 -1
- package/dist/components/conversation/code-block/code-block-shared.js +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.d.ts +1 -1
- package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-code-header.js +1 -1
- package/dist/components/conversation/markdown/markdown-core.class.d.ts +10 -0
- package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-shared.d.ts +7 -2
- package/dist/components/conversation/markdown/markdown-shared.js +3 -3
- package/dist/components/conversation/markdown/markdown.class.d.ts +10 -0
- package/dist/components/conversation/markdown/markdown.class.js +1 -1
- package/dist/components/conversation/message-feedback/message-feedback.class.js +2 -2
- package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +2 -1
- package/dist/components/conversation/streaming-text/streaming-text-base.class.d.ts +4 -0
- package/dist/components/conversation/streaming-text/streaming-text-base.class.js +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-core.class.d.ts +1 -1
- package/dist/components/conversation/streaming-text/streaming-text-core.class.js +1 -0
- package/dist/components/conversation/streaming-text/streaming-text.class.d.ts +1 -1
- package/dist/components/conversation/streaming-text/streaming-text.class.js +1 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +17 -3
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +3 -3
- package/dist/components/conversation/suggestion-chips/suggestion-chips.d.ts +1 -1
- package/dist/components/conversation/suggestion-chips/suggestion-chips.js +1 -1
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.class.js +2 -2
- package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
- package/dist/components/data/data-grid/data-grid.class.d.ts +10 -10
- package/dist/components/data/data-grid/data-grid.class.js +1 -1
- package/dist/components/data/file-tree/file-tree.class.js +1 -1
- package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +1 -1
- package/dist/components/data/heatmap/heatmap.class.js +1 -1
- package/dist/components/data/pagination/pagination.class.js +1 -1
- package/dist/components/data/table/table.class.d.ts +31 -2
- package/dist/components/data/table/table.class.js +3 -3
- package/dist/components/data/table/table.styles.js +1 -1
- package/dist/components/data/timeline/timeline-cluster.js +1 -1
- package/dist/components/data/timeline/timeline-item.class.d.ts +10 -3
- package/dist/components/data/timeline/timeline-item.class.js +16 -12
- package/dist/components/data/timeline/timeline-item.styles.js +1 -1
- package/dist/components/data/timeline/timeline.class.d.ts +14 -2
- package/dist/components/data/timeline/timeline.class.js +9 -5
- package/dist/components/data/tree/tree-item.class.js +1 -1
- package/dist/components/data/tree/tree.class.d.ts +2 -0
- package/dist/components/data/tree/tree.class.js +1 -1
- package/dist/components/forms/button/button.class.d.ts +8 -6
- package/dist/components/forms/button/button.class.js +2 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/color-picker/color-core.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +1 -1
- package/dist/components/forms/date-picker/date-input.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.class.d.ts +4 -2
- package/dist/components/forms/icon-button/icon-button.class.js +2 -2
- package/dist/components/forms/input/input-shared.js +2 -2
- package/dist/components/forms/input/number-input-locale.js +1 -0
- package/dist/components/forms/input/number-input.class.d.ts +19 -2
- package/dist/components/forms/input/number-input.class.js +2 -2
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +3 -3
- package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
- package/dist/components/layout/app-rail-group/app-rail-group.class.js +1 -1
- package/dist/components/layout/details/accordion-item.class.js +1 -1
- package/dist/components/layout/menu/menu.class.js +1 -1
- package/dist/components/layout/multi-split/multi-split.class.js +1 -1
- package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.js +1 -1
- package/dist/components/layout/tab-group/tab-group.class.d.ts +8 -1
- package/dist/components/layout/tab-group/tab-group.class.js +1 -1
- package/dist/components/layout/tab-group/tab.class.d.ts +7 -1
- package/dist/components/layout/tab-group/tab.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +2 -2
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/media/animated-image/animated-image.class.js +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +21 -14
- package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
- package/dist/components/media/attachment-trigger/attachment-trigger.class.d.ts +36 -12
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +3 -3
- package/dist/components/media/drop-zone/drop-zone.class.d.ts +23 -5
- package/dist/components/media/drop-zone/drop-zone.class.js +2 -2
- package/dist/components/media/drop-zone/drop-zone.styles.js +1 -1
- package/dist/components/media/file-icon/file-icon.class.js +1 -1
- package/dist/components/media/flag/flag-url-resolver.js +1 -1
- package/dist/components/media/image-viewer/image-viewer.class.d.ts +2 -2
- package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
- package/dist/components/media/map/map-owned-features.js +1 -1
- package/dist/components/media/map/map-scene-elevated-lines.js +2 -2
- package/dist/components/media/map/map-scene-render-controller.js +1 -1
- package/dist/components/media/map/map.class.d.ts +5 -5
- package/dist/components/media/map/map.class.js +3 -3
- package/dist/components/media/pan-zoom/pan-zoom.class.js +1 -1
- package/dist/components/media/video/video.class.d.ts +3 -3
- package/dist/components/media/video/video.class.js +3 -1
- package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
- package/dist/components/overlays/chip/chip.class.js +1 -1
- package/dist/components/overlays/overlay/dropdown.class.js +1 -1
- package/dist/components/overlays/overlay/tooltip.class.d.ts +5 -1
- package/dist/components/overlays/overlay/tooltip.class.js +3 -3
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -1
- package/dist/components/retrieval/graph/graph-node-renderer.js +1 -1
- package/dist/components/retrieval/graph/graph-spatial-controller.js +1 -1
- package/dist/components/retrieval/graph/graph.class.d.ts +1 -1
- package/dist/components/retrieval/graph/graph.class.js +1 -1
- package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.d.ts +1 -1
- package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +3 -3
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.class.d.ts +16 -1
- package/dist/components/utility/json-viewer/json-viewer.class.js +4 -4
- package/dist/components/utility/json-viewer/json-viewer.styles.js +1 -1
- package/dist/components/utility/known-date/known-date.class.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
- package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
- package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +1 -1
- package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
- package/dist/components/viewers/include/include.class.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer.class.js +1 -1
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +2 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
- package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
- package/dist/components/viewers/table-viewer-shared.js +4 -4
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/anchored-overlay-runtime.js +1 -1
- package/dist/internal/catalog-picker.js +1 -1
- package/dist/internal/document-tokens.js +2 -2
- package/dist/internal/drop-session-controller.js +1 -1
- package/dist/internal/engine-3d.js +1 -1
- package/dist/internal/icon-only-content.js +1 -1
- package/dist/internal/layered-layout.js +1 -1
- package/dist/internal/map-custom-layer-controller.js +1 -1
- package/dist/internal/media-panorama.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/safe-url.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/scroll-overflow.js +1 -1
- package/dist/internal/source-window-controller.js +1 -1
- package/dist/internal/text-quote.js +1 -1
- package/dist/internal/viewer-search.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/sequence-time-binding.js +1 -1
- package/dist/simulation-clock.js +1 -1
- package/dist/styles/reservations.css +1 -1
- package/dist/styles/reservations.styles.js +1 -1
- package/dist/testing/happy-dom-shims.js +1 -1
- package/dist/theme/theme.js +1 -1
- package/llms/components/lr-attachment-chip.md +27 -12
- package/llms/components/lr-attachment-trigger.md +27 -7
- package/llms/components/lr-button.md +6 -4
- package/llms/components/lr-chat-composer.md +13 -7
- package/llms/components/lr-chat-message.md +44 -3
- package/llms/components/lr-chat-viewport.md +39 -2
- package/llms/components/lr-data-grid.md +2 -0
- package/llms/components/lr-dialog.md +10 -0
- package/llms/components/lr-drop-zone.md +26 -2
- package/llms/components/lr-icon-button.md +2 -1
- package/llms/components/lr-json-viewer.md +17 -0
- package/llms/components/lr-locale-picker.md +5 -0
- package/llms/components/lr-markdown-core.md +2 -1
- package/llms/components/lr-markdown.md +20 -4
- package/llms/components/lr-menu.md +3 -1
- package/llms/components/lr-number-input.md +28 -1
- package/llms/components/lr-prompt-input.md +1 -1
- package/llms/components/lr-streaming-text-core.md +3 -2
- package/llms/components/lr-streaming-text.md +4 -1
- package/llms/components/lr-suggestion-chips.md +28 -5
- package/llms/components/lr-tab-group.md +13 -1
- package/llms/components/lr-tab.md +5 -0
- package/llms/components/lr-table.md +25 -4
- package/llms/components/lr-timeline-item.md +1 -1
- package/llms/components/lr-timeline.md +38 -4
- package/llms/components/lr-tooltip.md +3 -1
- package/llms/components/lr-tree.md +4 -0
- package/llms/components/lr-virtual-list.md +1 -0
- package/llms/peers.md +2 -2
- package/llms/shared/forms-and-accessibility.md +21 -4
- package/llms/shared.md +21 -4
- package/package.json +21 -20
- package/registrations.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{live}from"lit/directives/live.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{chevronIcon}from"../../../internal/icons.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LyraElement}from"../../../internal/lyra-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{finiteCount,finiteInteger}from"../../../internal/numbers.js";import{styles}from"./pagination.styles.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{sizes}from"../../../internal/sizes.styles.js";import{LYRA_DEFAULT_paginationAppliedUnknownTotal,LYRA_DEFAULT_paginationEmptySummary,LYRA_DEFAULT_paginationJumpToPage,LYRA_DEFAULT_paginationPage}from"../../../internal/default-strings/data.generated.js";import{LYRA_DEFAULT_items,LYRA_DEFAULT_next,LYRA_DEFAULT_paginationApplied,LYRA_DEFAULT_paginationFirstPage,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationLastPage,LYRA_DEFAULT_paginationSummary,LYRA_DEFAULT_previous}from"../../../internal/default-strings/shared.generated.js";const PAGINATION_FORMAT=literalSetConverter(["standard","compact"],"standard"),MAX_PAGE_SLOTS=101,MAX_WINDOW_COUNT=25;function pageSequence(from,to){return to<from?[]:Array.from({length:to-from+1},(_,offset)=>from+offset)}function paginationItems(current,totalPages,siblingCount,boundaryCount){if(totalPages<=0)return[];const asPage=page=>({type:"page",page}),budget=Math.min(boundaryCount*2+siblingCount*2+3,MAX_PAGE_SLOTS);if(totalPages<=budget)return pageSequence(1,totalPages).map(asPage);const windowFloor=boundaryCount+1,windowCeiling=totalPages-boundaryCount;let from=current-siblingCount,to=current+siblingCount;from<windowFloor&&(to+=windowFloor-from,from=windowFloor),to>windowCeiling&&(from-=to-windowCeiling,to=windowCeiling),from=Math.max(from,windowFloor),to=Math.min(to,windowCeiling);let spare=(from>windowFloor?0:1)+(to<windowCeiling?0:1);for(;spare>0;){if(to<windowCeiling)to+=1;else if(from>windowFloor)from-=1;else break;spare-=1}return from===windowFloor+1&&(from=windowFloor),to===windowCeiling-1&&(to=windowCeiling),[...pageSequence(1,boundaryCount).map(asPage),...from>windowFloor?[{type:"gap",target:Math.max(windowFloor,from-Math.max(1,siblingCount*2+1))}]:[],...pageSequence(from,to).map(asPage),...to<windowCeiling?[{type:"gap",target:Math.min(windowCeiling,to+Math.max(1,siblingCount*2+1))}]:[],...pageSequence(totalPages-boundaryCount+1,totalPages).map(asPage)]}class LyraPagination extends LyraElement{constructor(){super(...arguments),this.page=1,this.pageSize=10,this.total=0,this.hasNext=!0,this.disabled=!1,this.loading=!1,this.withSummary=!1,this.size="m",this._format="standard",this.siblingCount=2,this.boundaryCount=1,this.withEdges=!1,this.withoutNav=!1,this.hideSinglePage=!1,this.hrefTemplate="",this.appearance="outlined",this.itemLabel="",this.accessibleLabel=null,this.draftPage="",this.invalidDraft=!1,this.liveText="",this.internals=attachInternalsSafely(this),this.initialized=!1,this.pendingFocusOrigin=null,this.onPageInput=event=>{const input=event.currentTarget;this.draftPage=input.value,this.invalidDraft=input.value!==""&&this.validRequestedPage(input.value)==null},this.commitPage=event=>{const input=event.currentTarget,page=this.validRequestedPage(input.value);if(page==null){this.invalidDraft=!0;return}this.requestPage(page)},this.onPageKeyDown=event=>{event.key==="Enter"&&(event.preventDefault(),this.commitPage(event))},this.onControlFocus=event=>{relayNativeEvent(this,event)},this.onControlBlur=event=>{relayNativeEvent(this,event)}}static{this.defaultStrings={...super.defaultStrings,items:LYRA_DEFAULT_items,next:LYRA_DEFAULT_next,paginationApplied:LYRA_DEFAULT_paginationApplied,paginationAppliedUnknownTotal:LYRA_DEFAULT_paginationAppliedUnknownTotal,paginationEmptySummary:LYRA_DEFAULT_paginationEmptySummary,paginationFirstPage:LYRA_DEFAULT_paginationFirstPage,paginationJumpToPage:LYRA_DEFAULT_paginationJumpToPage,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationLastPage:LYRA_DEFAULT_paginationLastPage,paginationPage:LYRA_DEFAULT_paginationPage,paginationSummary:LYRA_DEFAULT_paginationSummary,previous:LYRA_DEFAULT_previous}}static{this.styles=[LyraElement.styles,sizes,styles]}get format(){return this._format}set format(value){const normalized=PAGINATION_FORMAT.normalizeReflected(this,"format",value),previous=this._format;previous!==normalized&&(this._format=normalized,this.requestUpdate("format",previous))}clearPendingFocus(){this.pendingFocusPage=void 0,this.pendingFocusOrigin=null}focusTargetIsInside(target){if(typeof target!="object"||!("nodeType"in target))return!1;const node=target;return this.contains(node)||this.renderRoot.contains(node)}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.clearPendingFocus(),this.sink?.release(),this.sink=void 0,super.disconnectedCallback()}get primaryControl(){return this.format==="compact"||this.indeterminate?this.pageInput:this.renderRoot.querySelector('[part~="page-current"]')??void 0}focus(options){this.primaryControl?.focus(options)}blur(){this.primaryControl?.blur()}click(){this.controlsDisabled||this.primaryControl?.click()}get normalizedTotalItems(){return finiteCount(this.total)}get normalizedPageSize(){return finiteCount(this.pageSize)}get calculatedTotalPages(){return this.normalizedTotalItems===0||this.normalizedPageSize===0?0:Math.ceil(this.normalizedTotalItems/this.normalizedPageSize)}get totalPages(){return this.calculatedTotalPages}get indeterminate(){return finiteInteger(this.total,0)===-1}get hasPages(){return this.indeterminate||this.calculatedTotalPages>0}get maxRequestablePage(){return this.indeterminate?Number.MAX_SAFE_INTEGER:this.calculatedTotalPages}get currentPage(){return this.indeterminate?finiteInteger(this.page,1,1,Number.MAX_SAFE_INTEGER):this.calculatedTotalPages===0?0:finiteInteger(this.page,1,1,this.calculatedTotalPages)}get controlsDisabled(){return this.disabled||this.loading||!this.hasPages}get normalizedSiblingCount(){return finiteCount(this.siblingCount,2,MAX_WINDOW_COUNT)}get normalizedBoundaryCount(){return finiteCount(this.boundaryCount,1,MAX_WINDOW_COUNT)}pageHref(page){const template=this.hrefTemplate;return typeof template=="function"?safeLinkHref(template(page)):typeof template!="string"||template===""?null:safeLinkHref(template.split("{page}").join(String(page)))}get hasHrefTemplate(){const template=this.hrefTemplate;return typeof template=="function"||typeof template=="string"&&template!==""}pageLink(page,inactive){if(!this.hasHrefTemplate)return{href:null,renderAnchor:!1};if(inactive||page<1||page>this.maxRequestablePage)return{href:null,renderAnchor:!0};const href=this.pageHref(page);return{href,renderAnchor:href!==null}}formatNumber(value){return getNumberFormat(this.effectiveLocale).format(value)}summaryText(){const total=this.normalizedTotalItems,itemLabel=this.itemLabel||this.localize("items",void 0,{count:total});if(this.calculatedTotalPages===0)return this.localize("paginationEmptySummary",void 0,{total:this.formatNumber(0),itemLabel});const start=(this.currentPage-1)*this.normalizedPageSize+1,end=Math.min(total,this.currentPage*this.normalizedPageSize);return this.localize("paginationSummary",void 0,{start:this.formatNumber(start),end:this.formatNumber(end),total:this.formatNumber(total),itemLabel})}willUpdate(changed){super.willUpdate(changed),setCustomState(this.internals,"disabled",this.disabled),(changed.has("page")||changed.has("pageSize")||changed.has("total"))&&(this.draftPage=this.hasPages?String(this.currentPage):"",this.invalidDraft=!1),this.initialized&&changed.has("page")&&this.indeterminate?(this.liveText=this.localize("paginationAppliedUnknownTotal",void 0,{page:this.formatNumber(this.currentPage)}),this.sink?.announce(this.liveText)):this.initialized&&changed.has("page")&&this.calculatedTotalPages>0&&(this.liveText=this.localize("paginationApplied",void 0,{page:this.formatNumber(this.currentPage),totalPages:this.formatNumber(this.calculatedTotalPages)}),this.sink?.announce(this.liveText)),this.initialized=!0}updated(changed){if(super.updated(changed),!changed.has("page")||this.pendingFocusPage===void 0)return;const requestedPage=this.pendingFocusPage,active=deepActiveElementIn(this.ownerDocument),focusMovedOutside=active!==this.pendingFocusOrigin&&active!==null&&active!==this.ownerDocument.body&&!this.focusTargetIsInside(active);if(this.clearPendingFocus(),this.currentPage!==requestedPage||focusMovedOutside)return;(this.format==="compact"||this.indeterminate?this.pageInput:this.renderRoot.querySelector('[part~="page-current"]'))?.focus()}validRequestedPage(value){if(value.trim()==="")return null;const page=Number(value);return!Number.isInteger(page)||page<1||page>this.maxRequestablePage?null:page}requestPage(page){if(!(this.controlsDisabled||page<1||page>this.maxRequestablePage)&&!(this.indeterminate&&page>this.currentPage&&!this.hasNext)){if(page!==this.currentPage){const focusOrigin=deepActiveElementIn(this.ownerDocument),detail=()=>Object.freeze({page,pageSize:this.normalizedPageSize});if(this.emit("lr-before-page-change",detail(),{cancelable:!0}).defaultPrevented){this.draftPage=this.hasPages?String(this.currentPage):"",this.invalidDraft=!1;return}this.pendingFocusPage=page,this.pendingFocusOrigin=focusOrigin,this.emit("lr-page-change",detail()),this.draftPage=this.hasPages?String(this.currentPage):"",this.invalidDraft=!1}this.emit("lr-activate",{value:page})}}renderNavButton(direction){const isPrevious=direction==="previous",current=this.currentPage,label=isPrevious?this.previousLabel??this.localize("previous"):this.nextLabel??this.localize("next"),spent=isPrevious?current<=1:this.indeterminate?!this.hasNext:current>=this.calculatedTotalPages,target=isPrevious?current-1:current+1,inactive=this.controlsDisabled||spent,{href,renderAnchor}=this.pageLink(target,inactive),part=isPrevious?"button previous-button":"button next-button",icon=html`<span part=${isPrevious?"previous-icon":"next-icon"} aria-hidden="true"
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{live}from"lit/directives/live.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{chevronIcon}from"../../../internal/icons.js";import{literalSetConverter,trueDefaultBooleanConverter}from"../../../internal/converters.js";import{LyraElement}from"../../../internal/lyra-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{finiteCount,finiteInteger}from"../../../internal/numbers.js";import{styles}from"./pagination.styles.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{safeLinkHref}from"../../../internal/safe-url.js";import{sizes}from"../../../internal/sizes.styles.js";import{LYRA_DEFAULT_paginationAppliedUnknownTotal,LYRA_DEFAULT_paginationEmptySummary,LYRA_DEFAULT_paginationJumpToPage,LYRA_DEFAULT_paginationPage}from"../../../internal/default-strings/data.generated.js";import{LYRA_DEFAULT_items,LYRA_DEFAULT_next,LYRA_DEFAULT_paginationApplied,LYRA_DEFAULT_paginationFirstPage,LYRA_DEFAULT_paginationLabel,LYRA_DEFAULT_paginationLastPage,LYRA_DEFAULT_paginationSummary,LYRA_DEFAULT_previous}from"../../../internal/default-strings/shared.generated.js";const PAGINATION_FORMAT=literalSetConverter(["standard","compact"],"standard"),MAX_PAGE_SLOTS=101,MAX_WINDOW_COUNT=25;function pageSequence(from,to){return to<from?[]:Array.from({length:to-from+1},(_,offset)=>from+offset)}function paginationItems(current,totalPages,siblingCount,boundaryCount){if(totalPages<=0)return[];const asPage=page=>({type:"page",page}),budget=Math.min(boundaryCount*2+siblingCount*2+3,MAX_PAGE_SLOTS);if(totalPages<=budget)return pageSequence(1,totalPages).map(asPage);const windowFloor=boundaryCount+1,windowCeiling=totalPages-boundaryCount;let from=current-siblingCount,to=current+siblingCount;from<windowFloor&&(to+=windowFloor-from,from=windowFloor),to>windowCeiling&&(from-=to-windowCeiling,to=windowCeiling),from=Math.max(from,windowFloor),to=Math.min(to,windowCeiling);let spare=(from>windowFloor?0:1)+(to<windowCeiling?0:1);for(;spare>0;){if(to<windowCeiling)to+=1;else if(from>windowFloor)from-=1;else break;spare-=1}return from===windowFloor+1&&(from=windowFloor),to===windowCeiling-1&&(to=windowCeiling),[...pageSequence(1,boundaryCount).map(asPage),...from>windowFloor?[{type:"gap",target:Math.max(windowFloor,from-Math.max(1,siblingCount*2+1))}]:[],...pageSequence(from,to).map(asPage),...to<windowCeiling?[{type:"gap",target:Math.min(windowCeiling,to+Math.max(1,siblingCount*2+1))}]:[],...pageSequence(totalPages-boundaryCount+1,totalPages).map(asPage)]}class LyraPagination extends LyraElement{constructor(){super(...arguments),this.page=1,this.pageSize=10,this.total=0,this.hasNext=!0,this.disabled=!1,this.loading=!1,this.withSummary=!1,this.size="m",this._format="standard",this.siblingCount=2,this.boundaryCount=1,this.withEdges=!1,this.withoutNav=!1,this.hideSinglePage=!1,this.hrefTemplate="",this.appearance="outlined",this.itemLabel="",this.accessibleLabel=null,this.draftPage="",this.invalidDraft=!1,this.liveText="",this.internals=attachInternalsSafely(this),this.initialized=!1,this.pendingFocusOrigin=null,this.onPageInput=event=>{const input=event.currentTarget;this.draftPage=input.value,this.invalidDraft=input.value!==""&&this.validRequestedPage(input.value)==null},this.commitPage=event=>{const input=event.currentTarget,page=this.validRequestedPage(input.value);if(page==null){this.invalidDraft=!0;return}this.requestPage(page)},this.onPageKeyDown=event=>{event.key==="Enter"&&(event.preventDefault(),this.commitPage(event))},this.onControlFocus=event=>{relayNativeEvent(this,event)},this.onControlBlur=event=>{relayNativeEvent(this,event)}}static{this.defaultStrings={...super.defaultStrings,items:LYRA_DEFAULT_items,next:LYRA_DEFAULT_next,paginationApplied:LYRA_DEFAULT_paginationApplied,paginationAppliedUnknownTotal:LYRA_DEFAULT_paginationAppliedUnknownTotal,paginationEmptySummary:LYRA_DEFAULT_paginationEmptySummary,paginationFirstPage:LYRA_DEFAULT_paginationFirstPage,paginationJumpToPage:LYRA_DEFAULT_paginationJumpToPage,paginationLabel:LYRA_DEFAULT_paginationLabel,paginationLastPage:LYRA_DEFAULT_paginationLastPage,paginationPage:LYRA_DEFAULT_paginationPage,paginationSummary:LYRA_DEFAULT_paginationSummary,previous:LYRA_DEFAULT_previous}}static{this.styles=[LyraElement.styles,sizes,styles]}get format(){return this._format}set format(value){const normalized=PAGINATION_FORMAT.normalizeReflected(this,"format",value),previous=this._format;previous!==normalized&&(this._format=normalized,this.requestUpdate("format",previous))}clearPendingFocus(){this.pendingFocusPage=void 0,this.pendingFocusOrigin=null}focusTargetIsInside(target){if(typeof target!="object"||!("nodeType"in target))return!1;const node=target;return this.contains(node)||this.renderRoot.contains(node)}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.clearPendingFocus(),this.sink?.release(),this.sink=void 0,super.disconnectedCallback()}get primaryControl(){return this.format==="compact"||this.indeterminate?this.pageInput:this.renderRoot?.querySelector('[part~="page-current"]')??void 0}focus(options){this.primaryControl?.focus(options)}blur(){this.primaryControl?.blur()}click(){this.controlsDisabled||this.primaryControl?.click()}get normalizedTotalItems(){return finiteCount(this.total)}get normalizedPageSize(){return finiteCount(this.pageSize)}get calculatedTotalPages(){return this.normalizedTotalItems===0||this.normalizedPageSize===0?0:Math.ceil(this.normalizedTotalItems/this.normalizedPageSize)}get totalPages(){return this.calculatedTotalPages}get indeterminate(){return finiteInteger(this.total,0)===-1}get hasPages(){return this.indeterminate||this.calculatedTotalPages>0}get maxRequestablePage(){return this.indeterminate?Number.MAX_SAFE_INTEGER:this.calculatedTotalPages}get currentPage(){return this.indeterminate?finiteInteger(this.page,1,1,Number.MAX_SAFE_INTEGER):this.calculatedTotalPages===0?0:finiteInteger(this.page,1,1,this.calculatedTotalPages)}get controlsDisabled(){return this.disabled||this.loading||!this.hasPages}get normalizedSiblingCount(){return finiteCount(this.siblingCount,2,MAX_WINDOW_COUNT)}get normalizedBoundaryCount(){return finiteCount(this.boundaryCount,1,MAX_WINDOW_COUNT)}pageHref(page){const template=this.hrefTemplate;return typeof template=="function"?safeLinkHref(template(page)):typeof template!="string"||template===""?null:safeLinkHref(template.split("{page}").join(String(page)))}get hasHrefTemplate(){const template=this.hrefTemplate;return typeof template=="function"||typeof template=="string"&&template!==""}pageLink(page,inactive){if(!this.hasHrefTemplate)return{href:null,renderAnchor:!1};if(inactive||page<1||page>this.maxRequestablePage)return{href:null,renderAnchor:!0};const href=this.pageHref(page);return{href,renderAnchor:href!==null}}formatNumber(value){return getNumberFormat(this.effectiveLocale).format(value)}summaryText(){const total=this.normalizedTotalItems,itemLabel=this.itemLabel||this.localize("items",void 0,{count:total});if(this.calculatedTotalPages===0)return this.localize("paginationEmptySummary",void 0,{total:this.formatNumber(0),itemLabel});const start=(this.currentPage-1)*this.normalizedPageSize+1,end=Math.min(total,this.currentPage*this.normalizedPageSize);return this.localize("paginationSummary",void 0,{start:this.formatNumber(start),end:this.formatNumber(end),total:this.formatNumber(total),itemLabel})}willUpdate(changed){super.willUpdate(changed),setCustomState(this.internals,"disabled",this.disabled),(changed.has("page")||changed.has("pageSize")||changed.has("total"))&&(this.draftPage=this.hasPages?String(this.currentPage):"",this.invalidDraft=!1),this.initialized&&changed.has("page")&&this.indeterminate?(this.liveText=this.localize("paginationAppliedUnknownTotal",void 0,{page:this.formatNumber(this.currentPage)}),this.sink?.announce(this.liveText)):this.initialized&&changed.has("page")&&this.calculatedTotalPages>0&&(this.liveText=this.localize("paginationApplied",void 0,{page:this.formatNumber(this.currentPage),totalPages:this.formatNumber(this.calculatedTotalPages)}),this.sink?.announce(this.liveText)),this.initialized=!0}updated(changed){if(super.updated(changed),!changed.has("page")||this.pendingFocusPage===void 0)return;const requestedPage=this.pendingFocusPage,active=deepActiveElementIn(this.ownerDocument),focusMovedOutside=active!==this.pendingFocusOrigin&&active!==null&&active!==this.ownerDocument.body&&!this.focusTargetIsInside(active);if(this.clearPendingFocus(),this.currentPage!==requestedPage||focusMovedOutside)return;(this.format==="compact"||this.indeterminate?this.pageInput:this.renderRoot.querySelector('[part~="page-current"]'))?.focus()}validRequestedPage(value){if(value.trim()==="")return null;const page=Number(value);return!Number.isInteger(page)||page<1||page>this.maxRequestablePage?null:page}requestPage(page){if(!(this.controlsDisabled||page<1||page>this.maxRequestablePage)&&!(this.indeterminate&&page>this.currentPage&&!this.hasNext)){if(page!==this.currentPage){const focusOrigin=deepActiveElementIn(this.ownerDocument),detail=()=>Object.freeze({page,pageSize:this.normalizedPageSize});if(this.emit("lr-before-page-change",detail(),{cancelable:!0}).defaultPrevented){this.draftPage=this.hasPages?String(this.currentPage):"",this.invalidDraft=!1;return}this.pendingFocusPage=page,this.pendingFocusOrigin=focusOrigin,this.emit("lr-page-change",detail()),this.draftPage=this.hasPages?String(this.currentPage):"",this.invalidDraft=!1}this.emit("lr-activate",{value:page})}}renderNavButton(direction){const isPrevious=direction==="previous",current=this.currentPage,label=isPrevious?this.previousLabel??this.localize("previous"):this.nextLabel??this.localize("next"),spent=isPrevious?current<=1:this.indeterminate?!this.hasNext:current>=this.calculatedTotalPages,target=isPrevious?current-1:current+1,inactive=this.controlsDisabled||spent,{href,renderAnchor}=this.pageLink(target,inactive),part=isPrevious?"button previous-button":"button next-button",icon=html`<span part=${isPrevious?"previous-icon":"next-icon"} aria-hidden="true"
|
|
2
2
|
><slot name=${isPrevious?"previous-icon":"next-icon"}>${chevronIcon()}</slot></span
|
|
3
3
|
>`;return renderAnchor?html`<a
|
|
4
4
|
part=${part}
|
|
@@ -137,6 +137,17 @@ cellStyle?(row:T):Record<string,string> |undefined;
|
|
|
137
137
|
* `exactValue` carries). Use it for a longer form of what the cell already shows, never for
|
|
138
138
|
* information that exists nowhere else. */
|
|
139
139
|
cellTitle?(row:T):string|undefined;
|
|
140
|
+
/** Extra CSS part names for a wrapper around this cell's rendered content. `cell()` templates
|
|
141
|
+
* render inside this table's shadow root, so a class set on their markup is never reached by the
|
|
142
|
+
* stylesheet of the component or page that owns the table; only inherited properties and custom
|
|
143
|
+
* properties cross. When `cellPart` is defined, the resting cell content is wrapped in a
|
|
144
|
+
* `display: block` element carrying `part="cell-content"` plus every whitespace-separated name
|
|
145
|
+
* returned here, so an outer scope can style it per row: `lr-table::part(cell-muted)`. Return
|
|
146
|
+
* `undefined` or an empty string for a plain `cell-content` wrapper; non-string results are
|
|
147
|
+
* ignored. Prefix your names (e.g. `cell-`) so they cannot collide with the table's own parts.
|
|
148
|
+
* Not applied to an open inline editor. A `part` attribute written directly inside a `cell()`
|
|
149
|
+
* template is equally a part of this table. */
|
|
150
|
+
cellPart?(row:T):string|undefined;
|
|
140
151
|
/** Numeric accessor backing the heat-tint background. A column that omits this is excluded from
|
|
141
152
|
* tinting (e.g. a label column) — its presence on any column is the opt-in signal for heat-tint
|
|
142
153
|
* mode as a whole, mirroring how `expandedContent` alone signals expand-mode (no separate
|
|
@@ -179,7 +190,10 @@ export type TableColumn<T> =(TableColumnCommon<T> &{
|
|
|
179
190
|
* inline editor at all. */
|
|
180
191
|
editTrigger?:'double-click';
|
|
181
192
|
/** Renders this cell's content. Required whenever the column can be in its plain-text
|
|
182
|
-
* resting state -- i.e. always, for a `'double-click'` or unset `editTrigger`.
|
|
193
|
+
* resting state -- i.e. always, for a `'double-click'` or unset `editTrigger`. The returned
|
|
194
|
+
* template renders inside this table's shadow root, so the owning component's or page's
|
|
195
|
+
* class rules never reach it; style it through `cellPart` or a `part` attribute in the
|
|
196
|
+
* template, selected with `lr-table::part(...)`. */
|
|
183
197
|
cell:(row:T)=>unknown;})|(TableColumnCommon<T> &{
|
|
184
198
|
/** `'always'` renders a persistent editor in every body cell of this column from first
|
|
185
199
|
* paint -- a settings/rate-style column the user is expected to type straight into. The
|
|
@@ -270,6 +284,9 @@ export interface LyraTableEventMap<T=unknown,K extends string|number=string|numb
|
|
|
270
284
|
* @csspart cell - Each body `<td>`. An `editTrigger: 'double-click'` column's resting (not
|
|
271
285
|
* currently editing) cell additionally carries `[data-editable]` and its own `tabindex="-1"`
|
|
272
286
|
* roving-focus stop -- see the keyboard paragraph above.
|
|
287
|
+
* @csspart cell-content - The `display: block` wrapper around a body cell's resting content,
|
|
288
|
+
* rendered only for a column that defines `cellPart(row)`; it also carries every part name that
|
|
289
|
+
* callback returns, for per-row styling of `cell()` output from outside the shadow root.
|
|
273
290
|
* @csspart row-total-cell - Each body row's trailing `<td>` holding `rowTotal(row)`, rendered only
|
|
274
291
|
* when `rowTotal` is set. The corresponding footer-row cell (holding `grandTotal`) is a
|
|
275
292
|
* `footer-cell` instead, matching every other footer cell.
|
|
@@ -812,4 +829,16 @@ expandedContentElement(rowKey:K):HTMLElement|null;private rowElementForToken;pri
|
|
|
812
829
|
*
|
|
813
830
|
* No `tabindex` on any of them: a persistent editor is a plain tab stop, exactly like the
|
|
814
831
|
* row-expand toggle rendered a few lines above, and stays outside the header/row roving model. */
|
|
815
|
-
|
|
832
|
+
/**
|
|
833
|
+
* Renders one cell, tolerating a column that omits its required `cell` renderer.
|
|
834
|
+
*
|
|
835
|
+
* `TableColumn.cell` is typed and documented required, but columns arrive through a lit
|
|
836
|
+
* `.columns=${[...]}` property binding, and lit-html property bindings are not type-checked by
|
|
837
|
+
* `tsc` -- only by lit-analyzer, which many projects do not run. So required-ness is unenforced
|
|
838
|
+
* where it is actually written. Calling it unguarded would make a malformed column interrupt the
|
|
839
|
+
* table render.
|
|
840
|
+
*
|
|
841
|
+
* Degrade to an empty cell so the rest of the table stays usable, and emit one fixed
|
|
842
|
+
* development-only diagnostic for the page without retaining or reporting caller data.
|
|
843
|
+
*/
|
|
844
|
+
private renderCellContent;private renderCellValue;private renderCellEditor;private renderSkeletonPlaceholder;private renderSkeletonRows;private emptyCompactFor;private renderErrorContent;private renderErrorRow;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-table':LyraTable;}}export{};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{sanitizeCssDeclarationValue,sanitizeCssLength}from"../../../internal/safe-css.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{srOnly,nextId}from"../../../internal/a11y.js";import{finiteCount,finiteInteger,finiteRatio}from"../../../internal/numbers.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{resolveCssTokenLength}from"../../../internal/css-token-length.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{CollectionSourceTracker}from"../../../internal/collection-source-tracker.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{styles}from"./table.styles.js";import{chevronIcon,closeIcon,sortIcon}from"../../../internal/icons.js";import{minMax}from"../../../internal/numbers.js";import{literalSetConverter,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{activeElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{normalizeSize,optionalSizeConverter}from"../../../internal/variants.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{ColumnResizePointerSession,columnResizeAriaValues,columnResizeKeyboardWidth,columnResizePointerWidth,columnResizeWidth}from"../../../internal/column-resize.js";import{renderDataState}from"../../../internal/data-state-renderer.js";import{LYRA_DEFAULT_noColumns,LYRA_DEFAULT_resizeColumn,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_showFewerColumns,LYRA_DEFAULT_tableEditCell,LYRA_DEFAULT_tableFilterLabel,LYRA_DEFAULT_tableFilterPlaceholder,LYRA_DEFAULT_tableLoading,LYRA_DEFAULT_tableLoadingMore,LYRA_DEFAULT_tableRowLimit,LYRA_DEFAULT_tableRowTotal}from"../../../internal/default-strings/data.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_expand,LYRA_DEFAULT_loadMore,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_open,LYRA_DEFAULT_resizeValuePixels,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_tableLoadFailed}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_SKELETON_ROWS=3,TABLE_OVERRIDE_MESSAGE_KEYS={tableLoading:"tableLoading",tableLoadingMore:"tableLoadingMore",tableLoadFailed:"tableLoadFailed",noColumns:"noColumns",noData:"noData",tableFilterLabel:"tableFilterLabel",tableFilterPlaceholder:"tableFilterPlaceholder",noMatches:"noMatches",showFewerColumns:"showFewerColumns",showAllColumns:"showAllColumns",loadMore:"loadMore"},MAX_SKELETON_ROWS=20,DEFAULT_PAGE_SIZE=100,MAX_PAGE_SIZE=500,MAX_TABLE_COLLECTION_ENTRIES=1e4,MAX_TABLE_ROWS=1e5,TABLE_SCROLL_OVERFLOW_TOLERANCE_PX=1,DEFAULT_RESIZE_MIN_WIDTH_PX=48,MISSING_CELL_RENDERER_WARNING="lyra-table-missing-cell-renderer",MISSING_ACCESSIBLE_NAME_WARNING="lyra-table-missing-accessible-name",INERT_PRIORITY_COLUMN_CONFIG_WARNING="lyra-table-inert-priority-column-config";function frozenArray(values,limit=MAX_TABLE_COLLECTION_ENTRIES){const snapshot=[];try{for(const value of values)if(snapshot.push(value),snapshot.length>=limit)break}catch{}return Object.freeze(snapshot)}function keySet(values,limit=MAX_TABLE_COLLECTION_ENTRIES){const snapshot=new Set;try{for(const value of values){if(typeof value=="string"){if(value.trim().length===0)continue}else if(typeof value!="number")continue;if(snapshot.add(value),snapshot.size>=limit)break}}catch{}return snapshot}function readonlyKeySet(snapshot){let facade;return facade={get size(){return snapshot.size},has:value=>snapshot.has(value),entries:()=>snapshot.entries(),keys:()=>snapshot.keys(),values:()=>snapshot.values(),[Symbol.iterator]:()=>snapshot[Symbol.iterator](),forEach(callback,thisArg){snapshot.forEach(value=>callback.call(thisArg,value,value,facade))}},Object.freeze(facade)}const keySetFacades=new WeakMap;function storedKeySetFacade(values){let facade=keySetFacades.get(values);return facade||(facade=readonlyKeySet(values),keySetFacades.set(values,facade)),facade}const COMPACT_EMPTY_SIZES=new Set(["2xs","xs","s"]),isCompactEmptySize=size=>COMPACT_EMPTY_SIZES.has(normalizeSize(size)),TABLE_LAYOUT=literalSetConverter(["auto","fixed"],"auto"),TABLE_PAGINATION_FORMAT=literalSetConverter(["standard","compact"],"compact"),INTERACTIVE_SELECTOR='button, a[href], input, select, textarea, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="menuitem"], [role="option"], [role="radio"], [role="separator"], [role="slider"], [role="spinbutton"], [role="switch"], [role="tab"], [role="textbox"]';function stickyDirection(sticky){if(sticky==="start"||sticky==="end")return sticky}const cellDeclarationVerdicts=new Map,CELL_DECLARATION_CACHE_LIMIT=1e3;function sanitizeCellStyle(cellStyle){const safe={};for(const[rawProperty,value]of Object.entries(cellStyle??{})){if(typeof value!="string")continue;const property2=normalizeStyleProperty(rawProperty.trim()),key=`${property2}\0${value}`;let verdict=cellDeclarationVerdicts.get(key);verdict===void 0&&(verdict=sanitizeCssDeclarationValue(property2,value)??"",cellDeclarationVerdicts.size>=CELL_DECLARATION_CACHE_LIMIT&&cellDeclarationVerdicts.clear(),cellDeclarationVerdicts.set(key,verdict)),verdict&&(safe[property2]=verdict)}return safe}function normalizeStyleProperty(property2){return property2.startsWith("--")?property2:property2.replace(/[A-Z]/g,"-$&").toLowerCase()}function normalizedEditTrigger(editTrigger){if(editTrigger==="always"||editTrigger==="double-click")return editTrigger}function encodeKey(key){return`${typeof key}:${key}`}function isImmutableSearchRow(value){if(value===null||typeof value!="object"&&typeof value!="function")return!0;try{return!Object.isFrozen(value)||"toJSON"in value||Object.getPrototypeOf(value)!==Object.prototype&&Object.getPrototypeOf(value)!==null?!1:Object.values(Object.getOwnPropertyDescriptors(value)).every(descriptor=>"value"in descriptor&&(descriptor.value===null||typeof descriptor.value!="object"&&typeof descriptor.value!="function"))}catch{return!1}}function createFilterStringifier(){let first,seen;const replace=(_key,value)=>{if(typeof value=="bigint")return value.toString();if(typeof value=="object"&&value!==null)if(first===void 0)first=value;else{if(value===first||(seen??=new Set,seen.has(value)))return"[Circular]";seen.add(value)}return value};return row=>{try{return JSON.stringify(row,replace)??""}catch{return""}finally{first=void 0,seen?.clear()}}}function asElement(value){return typeof value!="object"||!("nodeType"in value)||value.nodeType!==1||!("matches"in value)?null:value}function eventInteractiveTarget(event,boundary){for(const value of event.composedPath()){if(value===boundary)break;const element=asElement(value);if(element!==null&&(element.matches("[data-table-interactive]")||element.matches(INTERACTIVE_SELECTOR)&&!element.matches("[data-row-key], th[data-col-key]")))return element}return null}class LyraTable extends LyraElement{constructor(){super(...arguments),this.assignedSources=new CollectionSourceTracker,this._columns=Object.freeze([]),this._maxRows=MAX_TABLE_COLLECTION_ENTRIES,this.rowSourceLength=0,this._rows=Object.freeze([]),this._rowsTruncated=!1,this._layout="auto",this.sortKey="",this.sortDir="asc",this.sortIndicators="active",this.sortMode="client",this.defaultSortDir="asc",this.hostAccessibleLabel=null,this.caption="",this.captionId=nextId("lr-table-caption"),this.selectionMode="none",this.expansionMode="none",this.scrollMode="self",this._selectedKeys=new Set,this.filterable=!1,this.filterText="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.loading=!1,this.loadingAppearance="spinner",this.skeletonRows=0,this.pageSize=DEFAULT_PAGE_SIZE,this.page=1,this.totalItems=-1,this.paginationMode="client",this.unknownTotal=!1,this.paginationWithSummary=!1,this.paginationFormat="compact",this.hasNext=!0,this._expandedKeys=new Set,this.hasMore=!1,this.loadingMore=!1,this.error=!1,this.errorDescription="",this.announce=!1,this.emptyDescription="",this.emptyColumnsDescription="",this.hasHiddenPriorityColumns=!1,this.priorityToggleAvailable=!1,this.persistReady=!1,this.announcements=new AnnouncementSinkController(this,{eager:["polite","assertive"]}),this.firstUpdateAnnouncementsReady=!1,this._activeColKey=null,this._activeRowKey=null,this.editingCell=null,this.focusedEditorCell=null,this.editorHadFocusBeforeUpdate=!1,this.rovingFocusSnapshot=null,this._resizedColumnWidths=new Map,this.resizeWriteGuard=new VetoWriteGuard,this.resizePointer=new ColumnResizePointerSession(event=>this.onResizePointerMove(event),event=>this.onResizePointerEnd(event),event=>this.onResizePointerEnd(event)),this.rowsByKey=new Map,this.columnsByKey=new Map,this.layoutFrame=null,this.observedHeaders=new Set,this.priorityTierNaturalWidth=new Map,this.priorityTierHiddenAllocation=new Map,this.priorityTierRevealAllocation=new Map,this.onResizePointerDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0,header=handle.closest("th[data-col-key]");if(!key||!column||!header||!this.ownerDocument.defaultView)return;const replacedStartWidth=this.resizeState?.key===key?this.resizeState.startWidth:void 0;this.cancelResizeGesture();const minWidth=this.minimumResizeWidth(column);this.resizeState={key,pointerId:event.pointerId,startX:event.clientX,startWidth:replacedStartWidth??header.getBoundingClientRect().width,minWidth,maxWidth:this.maximumResizeWidth(column,minWidth),handle,previousWidth:this.resizedColumnWidths.get(key)},handle.toggleAttribute("data-resizing",!0),event.preventDefault(),event.stopPropagation(),this.resizePointer.start(event,handle)},this.onResizePointerMove=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;const width=columnResizePointerWidth(state2.startWidth,state2.startX,event.clientX,isRtl(this),state2.minWidth,state2.maxWidth);if(this.resizedColumnWidths.get(state2.key)===width)return;this._resizedColumnWidths=new Map(this.resizedColumnWidths).set(state2.key,width),markVetoGuardWrite(this.resizeWriteGuard),this.renderRoot.querySelector(`col[data-col-key="${CSS.escape(state2.key)}"]`)?.style.setProperty("inline-size",`${width}px`);const table=this.renderRoot.querySelector("table");table?.setAttribute("data-layout","fixed"),table?.setAttribute("data-has-column-widths",""),state2.handle.setAttribute("aria-valuenow",String(Math.round(width))),state2.handle.setAttribute("aria-valuetext",this.resizeValueText(width)),this.scheduleLayoutSync(),this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width}))},this.onResizeKeyDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0;if(!column)return;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),currentWidth=this.currentResizeWidth(column,handle),requestedWidth=columnResizeKeyboardWidth(event,currentWidth,minWidth,maxWidth,isRtl(this));requestedWidth!==void 0&&(event.preventDefault(),event.stopPropagation(),this.resizeColumnTo(column,requestedWidth))},this.onResizePointerEnd=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;if(state2.handle.removeAttribute("data-resizing"),this.resizeState=void 0,this.resizePointer.stop(),event.type!=="pointerup"){this.rollbackResizePreview(state2);return}this.requestUpdate("resizedColumnWidths");const committedWidth=this.resizedColumnWidths.get(state2.key);if(committedWidth===void 0||committedWidth===state2.previousWidth)return;this.resizeWriteGuard.open();const request=this.emit("lr-column-resize-request",Object.freeze({columnKey:state2.key,width:committedWidth}),{cancelable:!0});if(!this.resizeWriteGuard.touched){if(request.defaultPrevented){this.rollbackResizePreview(state2);return}this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width:committedWidth}))}},this.scheduleLayoutSync=()=>{if(this.layoutFrame)return;const owner=this.ownerDocument.defaultView;if(!owner)return;const frame={owner,handle:0};frame.handle=owner.requestAnimationFrame(()=>{this.layoutFrame===frame&&(this.layoutFrame=null,!(!this.isConnected||this.ownerDocument.defaultView!==owner)&&this.syncLayoutGeometry())}),this.layoutFrame=frame},this.cachedCanonicalRowEntries=null,this.canonicalRowEntriesInputs=null,this.cachedMatchingEntries=null,this.matchingEntriesInputs=null,this.cachedSortedEntries=null,this.sortedEntriesInputs=null,this.publicRowsMemo=new WeakMap,this.aggregateValues=new Map,this.onFilterInput=event=>{event.stopPropagation();const input=event.currentTarget;this.filterText=input.value,this.emit("lr-filter-change",Object.freeze({filterText:this.filterText}))},this.onClearFilter=()=>{this.filterText!==""&&(this.filterText="",this.emit("lr-filter-change",Object.freeze({filterText:""})),this.renderRoot.querySelector('[part="filter"]')?.focus())},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onNativeFocus=event=>{event.stopPropagation(),relayNativeEvent(this,event)},this.onNativeBlur=event=>{event.stopPropagation(),relayNativeEvent(this,event)},this.onPaginationChange=event=>{event.stopPropagation();const{page}=event.detail;this.paginationMode==="client"&&(this.page=page),this.emit("lr-page-change",Object.freeze({page}))},this.onTableFocusIn=event=>{const target=event.target,cell=target?.closest?.("td[data-col-key]"),row=target?.closest?.("[data-row-key]"),columnKey=cell?.dataset.colKey,rowKey=row?.dataset.rowKey;this.focusedEditorCell=target?.getAttribute("part")==="cell-editor"&&columnKey!==void 0&&rowKey!==void 0&&normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always"?{rowKey,columnKey}:null},this.onEditorKeyDown=(event,rowKey,columnKey)=>{event.stopPropagation();const alwaysOn=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always";event.key==="Enter"?(event.preventDefault(),this.commitEdit(event,rowKey,columnKey)):event.key==="Escape"&&!alwaysOn&&(event.preventDefault(),this.editingCell=null)},this.onTableDoubleClick=event=>{const target=event.target,table=event.currentTarget;if(eventInteractiveTarget(event,table))return;const cell=target.closest('[part="cell"][data-col-key]'),row=target.closest("[data-row-key]");cell&&row?.dataset.rowKey&&cell.dataset.colKey&&this.startEditing(row.dataset.rowKey,cell.dataset.colKey)},this.toggleColumns=()=>{this.priorityColumnsVisible=!this.priorityColumnsVisible,this.emit("lr-priority-columns-visibility-change",Object.freeze({visible:this.priorityColumnsVisible}))},this.onExpandToggleClick=event=>{const token=event.currentTarget.closest("tr[data-row-key]")?.dataset.rowKey,entry=token===void 0?void 0:this.rowsByKey.get(token);entry&&this.activateExpandToggle(entry.key)},this.onTableClick=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table))return;const th=target.closest("th[data-col-key]");if(th)return this.activateColumn(th.dataset.colKey);const tr=target.closest("[data-row-key]");tr&&this.activateRow(tr.dataset.rowKey)},this.onTableKeyDown=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table)||(e.altKey||e.metaKey)&&e.key.startsWith("Arrow"))return;const th=target.closest("th[data-col-key]");if(th)return this.onHeaderKeyDown(e,th);const tr=target.closest("[data-row-key]");tr&&this.onRowKeyDown(e,tr)}}static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,expand:LYRA_DEFAULT_expand,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noColumns:LYRA_DEFAULT_noColumns,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,open:LYRA_DEFAULT_open,resizeColumn:LYRA_DEFAULT_resizeColumn,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showAllColumns:LYRA_DEFAULT_showAllColumns,showFewerColumns:LYRA_DEFAULT_showFewerColumns,tableEditCell:LYRA_DEFAULT_tableEditCell,tableFilterLabel:LYRA_DEFAULT_tableFilterLabel,tableFilterPlaceholder:LYRA_DEFAULT_tableFilterPlaceholder,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,tableLoading:LYRA_DEFAULT_tableLoading,tableLoadingMore:LYRA_DEFAULT_tableLoadingMore,tableRowLimit:LYRA_DEFAULT_tableRowLimit,tableRowTotal:LYRA_DEFAULT_tableRowTotal}}static{this.styles=[LyraElement.styles,styles,srOnly]}isRebind(name,value,current){return this.assignedSources.isRebind(name,value,current)}get columns(){return this._columns}set columns(value){if(this.isRebind("columns",value,this._columns))return;const previous=this._columns,columns=[],seen=new Set;let length=0;try{if(Array.isArray(value)){const descriptor=Object.getOwnPropertyDescriptor(value,"length"),sourceLength=descriptor&&"value"in descriptor?descriptor.value:0;typeof sourceLength=="number"&&Number.isSafeInteger(sourceLength)&&sourceLength>=0&&(length=Math.min(sourceLength,MAX_TABLE_COLLECTION_ENTRIES))}}catch{length=0}for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const column=descriptor.value;try{const key=column?.key;if(typeof key!="string"||key.trim().length===0||seen.has(key))continue;seen.add(key),columns.push(column)}catch{}}this._columns=frozenArray(columns),this.requestUpdate("columns",previous)}get maxRows(){return this._maxRows}set maxRows(value){const limit=Math.max(1,finiteCount(value,MAX_TABLE_COLLECTION_ENTRIES,MAX_TABLE_ROWS)),previous=this._maxRows;if(previous!==limit){if(this._maxRows=limit,this._rows){const source=this.rowSource?.deref();source&&(this.rowSourceLength=source.length),this.admitRows(source??this._rows,this.rowSourceLength)}if(this._selectedKeys?.size>limit&&this.commitSelectedKeys(keySet(this._selectedKeys,limit)),this._expandedKeys?.size>limit){const previousKeys=this._expandedKeys,next=keySet(previousKeys,limit);this.isRebind("expandedRowKeys",next,previousKeys),this._expandedKeys=next,this.requestUpdate("expandedRowKeys",previousKeys)}this.requestUpdate("maxRows",previous)}}get rows(){return this._rows}set rows(value){this.isRebind("rows",value,this._rows)||(this.rowSource=Array.isArray(value)?new WeakRef(value):void 0,this.rowSourceLength=Array.isArray(value)?value.length:0,this.admitRows(value,this.rowSourceLength))}admitRows(value,sourceLength){const previous=this._rows;this._rows=frozenArray(Array.isArray(value)?value:[],this.maxRows),this._rowsTruncated=sourceLength>this._rows.length,this.requestUpdate("rows",previous)}get rowsTruncated(){return this._rowsTruncated}get layout(){return this._layout}set layout(next){const normalized=TABLE_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get selectedRowKeys(){return storedKeySetFacade(this._selectedKeys)}set selectedRowKeys(value){if(this.isRebind("selectedRowKeys",value,storedKeySetFacade(this._selectedKeys)))return;const previous=this._selectedKeys;this._selectedKeys=keySet(value??[],this.maxRows),this.requestUpdate("selectedRowKeys",previous)}get expandedRowKeys(){return storedKeySetFacade(this._expandedKeys)}set expandedRowKeys(value){if(this.isRebind("expandedRowKeys",value,storedKeySetFacade(this._expandedKeys)))return;const previous=this._expandedKeys;this._expandedKeys=keySet(value??[],this.maxRows),this.requestUpdate("expandedRowKeys",previous)}asKeySet(keys){return keys}asKeyList(keys){return keys}get emptySize(){return this._emptySize}set emptySize(value){const previous=this._emptySize,next=optionalSizeConverter.normalize(value);next!==previous&&(this._emptySize=next,this.requestUpdate("emptySize",previous))}get priorityColumnsToggleAvailable(){return this.priorityToggleAvailable}static{definePersistedProperty(this.prototype,"priorityColumnsVisible",{initial:!1,attribute:"priority-columns-visible",type:Boolean,reflect:!0})}get storageFullKey(){return this.storageKey?`lr-table:${this.storageKey}`:void 0}get activeColKey(){return this._activeColKey}set activeColKey(value){this._activeColKey=value,this.patchRovingTabStop("th[data-col-key]","data-col-key",value)}get activeRowKey(){return this._activeRowKey}set activeRowKey(value){this._activeRowKey=value,this.patchRovingTabStop("tbody tr[data-row-key]","data-row-key",value)}patchRovingTabStop(selector,attribute,value){const next=value===null?null:this.renderRoot?.querySelector(`${selector}[${attribute}="${CSS.escape(value)}"]`);if(!next)return;const previous=this.renderRoot.querySelector(`${selector}[tabindex="0"]`);previous&&previous!==next&&(previous.tabIndex=-1),next.tabIndex=0}get resizedColumnWidths(){return this._resizedColumnWidths}set resizedColumnWidths(value){const previous=this._resizedColumnWidths;this._resizedColumnWidths=value,markVetoGuardWrite(this.resizeWriteGuard),this.requestUpdate("resizedColumnWidths",previous)}parsePixelLength(value){if(!value)return;const trimmed=value.trim();if(!trimmed.endsWith("px"))return;const parsed=Number.parseFloat(trimmed);return Number.isFinite(parsed)?parsed:void 0}minimumResizeWidth(column){const explicit=this.parsePixelLength(column.minWidth);if(explicit!==void 0)return Math.max(0,explicit);const cached=this.themedResizeMinWidth;if(cached&&cached.document===this.ownerDocument)return cached.width;const width=this.resolveThemedResizeMinWidth();return this.themedResizeMinWidth={document:this.ownerDocument,width},width}resolveThemedResizeMinWidth(){const hostStyle=this.ownerDocument.defaultView?.getComputedStyle(this),themed=hostStyle?.getPropertyValue("--lr-table-resize-min-width").trim()||hostStyle?.getPropertyValue("--_lr-table-resize-min-width-default").trim()||"",resolved=resolveCssTokenLength(themed,{host:this});return resolved===void 0?DEFAULT_RESIZE_MIN_WIDTH_PX:Math.max(0,resolved)}maximumResizeWidth(column,minWidth){const explicit=this.parsePixelLength(column.maxWidth);return explicit===void 0?Number.POSITIVE_INFINITY:Math.max(minWidth,explicit)}currentResizeWidth(column,handle){const resized=this.resizedColumnWidths.get(column.key);if(resized!==void 0)return resized;const explicit=this.parsePixelLength(column.width);if(explicit!==void 0)return explicit;const rendered=handle?.closest("th[data-col-key]")?.getBoundingClientRect().width;return rendered&&rendered>0?rendered:this.minimumResizeWidth(column)}resizeValueText(width){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(width))})}resizeColumnTo(column,requestedWidth){const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=columnResizeWidth(requestedWidth,minWidth,maxWidth);this.resizedColumnWidths.get(column.key)!==width&&requestThenCommit({requestDetail:Object.freeze({columnKey:column.key,width}),emitRequest:(detail,init)=>this.emit("lr-column-resize-request",detail,init),guard:this.resizeWriteGuard,commit:()=>{this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(column.key,width),this.emit("lr-column-resize",Object.freeze({columnKey:column.key,width})),markVetoGuardWrite(this.resizeWriteGuard)}})}renderedColumnWidth(column){const resized=this.resizedColumnWidths.get(column.key);return resized===void 0?sanitizeCssLength(column.width,"height"):`${resized}px`}renderResizeHandle(column){if(!column.resizable)return nothing;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=this.currentResizeWidth(column),aria=columnResizeAriaValues(width,minWidth,maxWidth);return html`<span
|
|
1
|
+
import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{styleMap}from"lit/directives/style-map.js";import{sanitizeCssDeclarationValue,sanitizeCssLength}from"../../../internal/safe-css.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isRtl}from"../../../internal/rtl.js";import{srOnly,nextId}from"../../../internal/a11y.js";import{finiteCount,finiteInteger,finiteRatio}from"../../../internal/numbers.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{resolveCssTokenLength}from"../../../internal/css-token-length.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{CollectionSourceTracker}from"../../../internal/collection-source-tracker.js";import{readPersistedState,writePersistedState}from"../../../internal/persisted-state.js";import{definePersistedProperty,isPersistedPropertyExplicitlySet}from"../../../internal/persisted-restore.js";import{styles}from"./table.styles.js";import{chevronIcon,closeIcon,sortIcon}from"../../../internal/icons.js";import{minMax}from"../../../internal/numbers.js";import{literalSetConverter,trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{activeElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{normalizeSize,optionalSizeConverter}from"../../../internal/variants.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{ColumnResizePointerSession,columnResizeAriaValues,columnResizeKeyboardWidth,columnResizePointerWidth,columnResizeWidth}from"../../../internal/column-resize.js";import{renderDataState}from"../../../internal/data-state-renderer.js";import{LYRA_DEFAULT_noColumns,LYRA_DEFAULT_resizeColumn,LYRA_DEFAULT_showAllColumns,LYRA_DEFAULT_showFewerColumns,LYRA_DEFAULT_tableEditCell,LYRA_DEFAULT_tableFilterLabel,LYRA_DEFAULT_tableFilterPlaceholder,LYRA_DEFAULT_tableLoading,LYRA_DEFAULT_tableLoadingMore,LYRA_DEFAULT_tableRowLimit,LYRA_DEFAULT_tableRowTotal}from"../../../internal/default-strings/data.generated.js";import{LYRA_DEFAULT_clear,LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_expand,LYRA_DEFAULT_loadMore,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_noMatches,LYRA_DEFAULT_open,LYRA_DEFAULT_resizeValuePixels,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_tableLoadFailed}from"../../../internal/default-strings/shared.generated.js";const DEFAULT_SKELETON_ROWS=3,TABLE_OVERRIDE_MESSAGE_KEYS={tableLoading:"tableLoading",tableLoadingMore:"tableLoadingMore",tableLoadFailed:"tableLoadFailed",noColumns:"noColumns",noData:"noData",tableFilterLabel:"tableFilterLabel",tableFilterPlaceholder:"tableFilterPlaceholder",noMatches:"noMatches",showFewerColumns:"showFewerColumns",showAllColumns:"showAllColumns",loadMore:"loadMore"},MAX_SKELETON_ROWS=20,DEFAULT_PAGE_SIZE=100,MAX_PAGE_SIZE=500,MAX_TABLE_COLLECTION_ENTRIES=1e4,MAX_TABLE_ROWS=1e5,TABLE_SCROLL_OVERFLOW_TOLERANCE_PX=1,DEFAULT_RESIZE_MIN_WIDTH_PX=48,MISSING_CELL_RENDERER_WARNING="lyra-table-missing-cell-renderer",MISSING_ACCESSIBLE_NAME_WARNING="lyra-table-missing-accessible-name",INERT_PRIORITY_COLUMN_CONFIG_WARNING="lyra-table-inert-priority-column-config";function frozenArray(values,limit=MAX_TABLE_COLLECTION_ENTRIES){const snapshot=[];try{for(const value of values)if(snapshot.push(value),snapshot.length>=limit)break}catch{}return Object.freeze(snapshot)}function keySet(values,limit=MAX_TABLE_COLLECTION_ENTRIES){const snapshot=new Set;try{for(const value of values){if(typeof value=="string"){if(value.trim().length===0)continue}else if(typeof value!="number")continue;if(snapshot.add(value),snapshot.size>=limit)break}}catch{}return snapshot}function readonlyKeySet(snapshot){let facade;return facade={get size(){return snapshot.size},has:value=>snapshot.has(value),entries:()=>snapshot.entries(),keys:()=>snapshot.keys(),values:()=>snapshot.values(),[Symbol.iterator]:()=>snapshot[Symbol.iterator](),forEach(callback,thisArg){snapshot.forEach(value=>callback.call(thisArg,value,value,facade))}},Object.freeze(facade)}const keySetFacades=new WeakMap;function storedKeySetFacade(values){let facade=keySetFacades.get(values);return facade||(facade=readonlyKeySet(values),keySetFacades.set(values,facade)),facade}const COMPACT_EMPTY_SIZES=new Set(["2xs","xs","s"]),isCompactEmptySize=size=>COMPACT_EMPTY_SIZES.has(normalizeSize(size)),TABLE_LAYOUT=literalSetConverter(["auto","fixed"],"auto"),TABLE_PAGINATION_FORMAT=literalSetConverter(["standard","compact"],"compact"),INTERACTIVE_SELECTOR='button, a[href], input, select, textarea, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="menuitem"], [role="option"], [role="radio"], [role="separator"], [role="slider"], [role="spinbutton"], [role="switch"], [role="tab"], [role="textbox"]';function cellContentPartNames(value){if(typeof value!="string")return"";const names=new Set(value.split(/\s+/).filter(Boolean));return names.delete("cell-content"),[...names].join(" ")}function stickyDirection(sticky){if(sticky==="start"||sticky==="end")return sticky}const cellDeclarationVerdicts=new Map,CELL_DECLARATION_CACHE_LIMIT=1e3;function sanitizeCellStyle(cellStyle){const safe={};for(const[rawProperty,value]of Object.entries(cellStyle??{})){if(typeof value!="string")continue;const property2=normalizeStyleProperty(rawProperty.trim()),key=`${property2}\0${value}`;let verdict=cellDeclarationVerdicts.get(key);verdict===void 0&&(verdict=sanitizeCssDeclarationValue(property2,value)??"",cellDeclarationVerdicts.size>=CELL_DECLARATION_CACHE_LIMIT&&cellDeclarationVerdicts.clear(),cellDeclarationVerdicts.set(key,verdict)),verdict&&(safe[property2]=verdict)}return safe}function normalizeStyleProperty(property2){return property2.startsWith("--")?property2:property2.replace(/[A-Z]/g,"-$&").toLowerCase()}function normalizedEditTrigger(editTrigger){if(editTrigger==="always"||editTrigger==="double-click")return editTrigger}function encodeKey(key){return`${typeof key}:${key}`}function isImmutableSearchRow(value){if(value===null||typeof value!="object"&&typeof value!="function")return!0;try{return!Object.isFrozen(value)||"toJSON"in value||Object.getPrototypeOf(value)!==Object.prototype&&Object.getPrototypeOf(value)!==null?!1:Object.values(Object.getOwnPropertyDescriptors(value)).every(descriptor=>"value"in descriptor&&(descriptor.value===null||typeof descriptor.value!="object"&&typeof descriptor.value!="function"))}catch{return!1}}function createFilterStringifier(){let first,seen;const replace=(_key,value)=>{if(typeof value=="bigint")return value.toString();if(typeof value=="object"&&value!==null)if(first===void 0)first=value;else{if(value===first||(seen??=new Set,seen.has(value)))return"[Circular]";seen.add(value)}return value};return row=>{try{return JSON.stringify(row,replace)??""}catch{return""}finally{first=void 0,seen?.clear()}}}function asElement(value){return typeof value!="object"||!("nodeType"in value)||value.nodeType!==1||!("matches"in value)?null:value}function eventInteractiveTarget(event,boundary){for(const value of event.composedPath()){if(value===boundary)break;const element=asElement(value);if(element!==null&&(element.matches("[data-table-interactive]")||element.matches(INTERACTIVE_SELECTOR)&&!element.matches("[data-row-key], th[data-col-key]")))return element}return null}class LyraTable extends LyraElement{constructor(){super(...arguments),this.assignedSources=new CollectionSourceTracker,this._columns=Object.freeze([]),this._maxRows=MAX_TABLE_COLLECTION_ENTRIES,this.rowSourceLength=0,this._rows=Object.freeze([]),this._rowsTruncated=!1,this._layout="auto",this.sortKey="",this.sortDir="asc",this.sortIndicators="active",this.sortMode="client",this.defaultSortDir="asc",this.hostAccessibleLabel=null,this.caption="",this.captionId=nextId("lr-table-caption"),this.selectionMode="none",this.expansionMode="none",this.scrollMode="self",this._selectedKeys=new Set,this.filterable=!1,this.filterText="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.loading=!1,this.loadingAppearance="spinner",this.skeletonRows=0,this.pageSize=DEFAULT_PAGE_SIZE,this.page=1,this.totalItems=-1,this.paginationMode="client",this.unknownTotal=!1,this.paginationWithSummary=!1,this.paginationFormat="compact",this.hasNext=!0,this._expandedKeys=new Set,this.hasMore=!1,this.loadingMore=!1,this.error=!1,this.errorDescription="",this.announce=!1,this.emptyDescription="",this.emptyColumnsDescription="",this.hasHiddenPriorityColumns=!1,this.priorityToggleAvailable=!1,this.persistReady=!1,this.announcements=new AnnouncementSinkController(this,{eager:["polite","assertive"]}),this.firstUpdateAnnouncementsReady=!1,this._activeColKey=null,this._activeRowKey=null,this.editingCell=null,this.focusedEditorCell=null,this.editorHadFocusBeforeUpdate=!1,this.rovingFocusSnapshot=null,this._resizedColumnWidths=new Map,this.resizeWriteGuard=new VetoWriteGuard,this.resizePointer=new ColumnResizePointerSession(event=>this.onResizePointerMove(event),event=>this.onResizePointerEnd(event),event=>this.onResizePointerEnd(event)),this.rowsByKey=new Map,this.columnsByKey=new Map,this.layoutFrame=null,this.observedHeaders=new Set,this.priorityTierNaturalWidth=new Map,this.priorityTierHiddenAllocation=new Map,this.priorityTierRevealAllocation=new Map,this.onResizePointerDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0,header=handle.closest("th[data-col-key]");if(!key||!column||!header||!this.ownerDocument.defaultView)return;const replacedStartWidth=this.resizeState?.key===key?this.resizeState.startWidth:void 0;this.cancelResizeGesture();const minWidth=this.minimumResizeWidth(column);this.resizeState={key,pointerId:event.pointerId,startX:event.clientX,startWidth:replacedStartWidth??header.getBoundingClientRect().width,minWidth,maxWidth:this.maximumResizeWidth(column,minWidth),handle,previousWidth:this.resizedColumnWidths.get(key)},handle.toggleAttribute("data-resizing",!0),event.preventDefault(),event.stopPropagation(),this.resizePointer.start(event,handle)},this.onResizePointerMove=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;const width=columnResizePointerWidth(state2.startWidth,state2.startX,event.clientX,isRtl(this),state2.minWidth,state2.maxWidth);if(this.resizedColumnWidths.get(state2.key)===width)return;this._resizedColumnWidths=new Map(this.resizedColumnWidths).set(state2.key,width),markVetoGuardWrite(this.resizeWriteGuard),this.renderRoot.querySelector(`col[data-col-key="${CSS.escape(state2.key)}"]`)?.style.setProperty("inline-size",`${width}px`);const table=this.renderRoot.querySelector("table");table?.setAttribute("data-layout","fixed"),table?.setAttribute("data-has-column-widths",""),state2.handle.setAttribute("aria-valuenow",String(Math.round(width))),state2.handle.setAttribute("aria-valuetext",this.resizeValueText(width)),this.scheduleLayoutSync(),this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width}))},this.onResizeKeyDown=event=>{const handle=event.currentTarget,key=handle.dataset.colKey,column=key?this.columnsByKey.get(key):void 0;if(!column)return;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),currentWidth=this.currentResizeWidth(column,handle),requestedWidth=columnResizeKeyboardWidth(event,currentWidth,minWidth,maxWidth,isRtl(this));requestedWidth!==void 0&&(event.preventDefault(),event.stopPropagation(),this.resizeColumnTo(column,requestedWidth))},this.onResizePointerEnd=event=>{const state2=this.resizeState;if(!state2||event.pointerId!==state2.pointerId)return;if(state2.handle.removeAttribute("data-resizing"),this.resizeState=void 0,this.resizePointer.stop(),event.type!=="pointerup"){this.rollbackResizePreview(state2);return}this.requestUpdate("resizedColumnWidths");const committedWidth=this.resizedColumnWidths.get(state2.key);if(committedWidth===void 0||committedWidth===state2.previousWidth)return;this.resizeWriteGuard.open();const request=this.emit("lr-column-resize-request",Object.freeze({columnKey:state2.key,width:committedWidth}),{cancelable:!0});if(!this.resizeWriteGuard.touched){if(request.defaultPrevented){this.rollbackResizePreview(state2);return}this.emit("lr-column-resize",Object.freeze({columnKey:state2.key,width:committedWidth}))}},this.scheduleLayoutSync=()=>{if(this.layoutFrame)return;const owner=this.ownerDocument.defaultView;if(!owner)return;const frame={owner,handle:0};frame.handle=owner.requestAnimationFrame(()=>{this.layoutFrame===frame&&(this.layoutFrame=null,!(!this.isConnected||this.ownerDocument.defaultView!==owner)&&this.syncLayoutGeometry())}),this.layoutFrame=frame},this.cachedCanonicalRowEntries=null,this.canonicalRowEntriesInputs=null,this.cachedMatchingEntries=null,this.matchingEntriesInputs=null,this.cachedSortedEntries=null,this.sortedEntriesInputs=null,this.publicRowsMemo=new WeakMap,this.aggregateValues=new Map,this.onFilterInput=event=>{event.stopPropagation();const input=event.currentTarget;this.filterText=input.value,this.emit("lr-filter-change",Object.freeze({filterText:this.filterText}))},this.onClearFilter=()=>{this.filterText!==""&&(this.filterText="",this.emit("lr-filter-change",Object.freeze({filterText:""})),this.renderRoot.querySelector('[part="filter"]')?.focus())},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onNativeFocus=event=>{event.stopPropagation(),relayNativeEvent(this,event)},this.onNativeBlur=event=>{event.stopPropagation(),relayNativeEvent(this,event)},this.onPaginationChange=event=>{event.stopPropagation();const{page}=event.detail;this.paginationMode==="client"&&(this.page=page),this.emit("lr-page-change",Object.freeze({page}))},this.onTableFocusIn=event=>{const target=event.target,cell=target?.closest?.("td[data-col-key]"),row=target?.closest?.("[data-row-key]"),columnKey=cell?.dataset.colKey,rowKey=row?.dataset.rowKey;this.focusedEditorCell=target?.getAttribute("part")==="cell-editor"&&columnKey!==void 0&&rowKey!==void 0&&normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always"?{rowKey,columnKey}:null},this.onEditorKeyDown=(event,rowKey,columnKey)=>{event.stopPropagation();const alwaysOn=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="always";event.key==="Enter"?(event.preventDefault(),this.commitEdit(event,rowKey,columnKey)):event.key==="Escape"&&!alwaysOn&&(event.preventDefault(),this.editingCell=null)},this.onTableDoubleClick=event=>{const target=event.target,table=event.currentTarget;if(eventInteractiveTarget(event,table))return;const cell=target.closest('[part="cell"][data-col-key]'),row=target.closest("[data-row-key]");cell&&row?.dataset.rowKey&&cell.dataset.colKey&&this.startEditing(row.dataset.rowKey,cell.dataset.colKey)},this.toggleColumns=()=>{this.priorityColumnsVisible=!this.priorityColumnsVisible,this.emit("lr-priority-columns-visibility-change",Object.freeze({visible:this.priorityColumnsVisible}))},this.onExpandToggleClick=event=>{const token=event.currentTarget.closest("tr[data-row-key]")?.dataset.rowKey,entry=token===void 0?void 0:this.rowsByKey.get(token);entry&&this.activateExpandToggle(entry.key)},this.onTableClick=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table))return;const th=target.closest("th[data-col-key]");if(th)return this.activateColumn(th.dataset.colKey);const tr=target.closest("[data-row-key]");tr&&this.activateRow(tr.dataset.rowKey)},this.onTableKeyDown=e=>{const target=e.target,table=e.currentTarget;if(eventInteractiveTarget(e,table)||(e.altKey||e.metaKey)&&e.key.startsWith("Arrow"))return;const th=target.closest("th[data-col-key]");if(th)return this.onHeaderKeyDown(e,th);const tr=target.closest("[data-row-key]");tr&&this.onRowKeyDown(e,tr)}}static{this.defaultStrings={...super.defaultStrings,clear:LYRA_DEFAULT_clear,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,expand:LYRA_DEFAULT_expand,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noColumns:LYRA_DEFAULT_noColumns,noData:LYRA_DEFAULT_noData,noMatches:LYRA_DEFAULT_noMatches,open:LYRA_DEFAULT_open,resizeColumn:LYRA_DEFAULT_resizeColumn,resizeValuePixels:LYRA_DEFAULT_resizeValuePixels,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showAllColumns:LYRA_DEFAULT_showAllColumns,showFewerColumns:LYRA_DEFAULT_showFewerColumns,tableEditCell:LYRA_DEFAULT_tableEditCell,tableFilterLabel:LYRA_DEFAULT_tableFilterLabel,tableFilterPlaceholder:LYRA_DEFAULT_tableFilterPlaceholder,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,tableLoading:LYRA_DEFAULT_tableLoading,tableLoadingMore:LYRA_DEFAULT_tableLoadingMore,tableRowLimit:LYRA_DEFAULT_tableRowLimit,tableRowTotal:LYRA_DEFAULT_tableRowTotal}}static{this.styles=[LyraElement.styles,styles,srOnly]}isRebind(name,value,current){return this.assignedSources.isRebind(name,value,current)}get columns(){return this._columns}set columns(value){if(this.isRebind("columns",value,this._columns))return;const previous=this._columns,columns=[],seen=new Set;let length=0;try{if(Array.isArray(value)){const descriptor=Object.getOwnPropertyDescriptor(value,"length"),sourceLength=descriptor&&"value"in descriptor?descriptor.value:0;typeof sourceLength=="number"&&Number.isSafeInteger(sourceLength)&&sourceLength>=0&&(length=Math.min(sourceLength,MAX_TABLE_COLLECTION_ENTRIES))}}catch{length=0}for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const column=descriptor.value;try{const key=column?.key;if(typeof key!="string"||key.trim().length===0||seen.has(key))continue;seen.add(key),columns.push(column)}catch{}}this._columns=frozenArray(columns),this.requestUpdate("columns",previous)}get maxRows(){return this._maxRows}set maxRows(value){const limit=Math.max(1,finiteCount(value,MAX_TABLE_COLLECTION_ENTRIES,MAX_TABLE_ROWS)),previous=this._maxRows;if(previous!==limit){if(this._maxRows=limit,this._rows){const source=this.rowSource?.deref();source&&(this.rowSourceLength=source.length),this.admitRows(source??this._rows,this.rowSourceLength)}if(this._selectedKeys?.size>limit&&this.commitSelectedKeys(keySet(this._selectedKeys,limit)),this._expandedKeys?.size>limit){const previousKeys=this._expandedKeys,next=keySet(previousKeys,limit);this.isRebind("expandedRowKeys",next,previousKeys),this._expandedKeys=next,this.requestUpdate("expandedRowKeys",previousKeys)}this.requestUpdate("maxRows",previous)}}get rows(){return this._rows}set rows(value){this.isRebind("rows",value,this._rows)||(this.rowSource=Array.isArray(value)?new WeakRef(value):void 0,this.rowSourceLength=Array.isArray(value)?value.length:0,this.admitRows(value,this.rowSourceLength))}admitRows(value,sourceLength){const previous=this._rows;this._rows=frozenArray(Array.isArray(value)?value:[],this.maxRows),this._rowsTruncated=sourceLength>this._rows.length,this.requestUpdate("rows",previous)}get rowsTruncated(){return this._rowsTruncated}get layout(){return this._layout}set layout(next){const normalized=TABLE_LAYOUT.normalizeReflected(this,"layout",next),old=this._layout;old!==normalized&&(this._layout=normalized,this.requestUpdate("layout",old))}get selectedRowKeys(){return storedKeySetFacade(this._selectedKeys)}set selectedRowKeys(value){if(this.isRebind("selectedRowKeys",value,storedKeySetFacade(this._selectedKeys)))return;const previous=this._selectedKeys;this._selectedKeys=keySet(value??[],this.maxRows),this.requestUpdate("selectedRowKeys",previous)}get expandedRowKeys(){return storedKeySetFacade(this._expandedKeys)}set expandedRowKeys(value){if(this.isRebind("expandedRowKeys",value,storedKeySetFacade(this._expandedKeys)))return;const previous=this._expandedKeys;this._expandedKeys=keySet(value??[],this.maxRows),this.requestUpdate("expandedRowKeys",previous)}asKeySet(keys){return keys}asKeyList(keys){return keys}get emptySize(){return this._emptySize}set emptySize(value){const previous=this._emptySize,next=optionalSizeConverter.normalize(value);next!==previous&&(this._emptySize=next,this.requestUpdate("emptySize",previous))}get priorityColumnsToggleAvailable(){return this.priorityToggleAvailable}static{definePersistedProperty(this.prototype,"priorityColumnsVisible",{initial:!1,attribute:"priority-columns-visible",type:Boolean,reflect:!0})}get storageFullKey(){return this.storageKey?`lr-table:${this.storageKey}`:void 0}get activeColKey(){return this._activeColKey}set activeColKey(value){this._activeColKey=value,this.patchRovingTabStop("th[data-col-key]","data-col-key",value)}get activeRowKey(){return this._activeRowKey}set activeRowKey(value){this._activeRowKey=value,this.patchRovingTabStop("tbody tr[data-row-key]","data-row-key",value)}patchRovingTabStop(selector,attribute,value){const next=value===null?null:this.renderRoot?.querySelector(`${selector}[${attribute}="${CSS.escape(value)}"]`);if(!next)return;const previous=this.renderRoot.querySelector(`${selector}[tabindex="0"]`);previous&&previous!==next&&(previous.tabIndex=-1),next.tabIndex=0}get resizedColumnWidths(){return this._resizedColumnWidths}set resizedColumnWidths(value){const previous=this._resizedColumnWidths;this._resizedColumnWidths=value,markVetoGuardWrite(this.resizeWriteGuard),this.requestUpdate("resizedColumnWidths",previous)}parsePixelLength(value){if(!value)return;const trimmed=value.trim();if(!trimmed.endsWith("px"))return;const parsed=Number.parseFloat(trimmed);return Number.isFinite(parsed)?parsed:void 0}minimumResizeWidth(column){const explicit=this.parsePixelLength(column.minWidth);if(explicit!==void 0)return Math.max(0,explicit);const cached=this.themedResizeMinWidth;if(cached&&cached.document===this.ownerDocument)return cached.width;const width=this.resolveThemedResizeMinWidth();return this.themedResizeMinWidth={document:this.ownerDocument,width},width}resolveThemedResizeMinWidth(){const hostStyle=this.ownerDocument.defaultView?.getComputedStyle(this),themed=hostStyle?.getPropertyValue("--lr-table-resize-min-width").trim()||hostStyle?.getPropertyValue("--_lr-table-resize-min-width-default").trim()||"",resolved=resolveCssTokenLength(themed,{host:this});return resolved===void 0?DEFAULT_RESIZE_MIN_WIDTH_PX:Math.max(0,resolved)}maximumResizeWidth(column,minWidth){const explicit=this.parsePixelLength(column.maxWidth);return explicit===void 0?Number.POSITIVE_INFINITY:Math.max(minWidth,explicit)}currentResizeWidth(column,handle){const resized=this.resizedColumnWidths.get(column.key);if(resized!==void 0)return resized;const explicit=this.parsePixelLength(column.width);if(explicit!==void 0)return explicit;const rendered=handle?.closest("th[data-col-key]")?.getBoundingClientRect().width;return rendered&&rendered>0?rendered:this.minimumResizeWidth(column)}resizeValueText(width){return this.localize("resizeValuePixels",void 0,{value:getNumberFormat(this.effectiveLocale).format(Math.round(width))})}resizeColumnTo(column,requestedWidth){const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=columnResizeWidth(requestedWidth,minWidth,maxWidth);this.resizedColumnWidths.get(column.key)!==width&&requestThenCommit({requestDetail:Object.freeze({columnKey:column.key,width}),emitRequest:(detail,init)=>this.emit("lr-column-resize-request",detail,init),guard:this.resizeWriteGuard,commit:()=>{this.resizedColumnWidths=new Map(this.resizedColumnWidths).set(column.key,width),this.emit("lr-column-resize",Object.freeze({columnKey:column.key,width})),markVetoGuardWrite(this.resizeWriteGuard)}})}renderedColumnWidth(column){const resized=this.resizedColumnWidths.get(column.key);return resized===void 0?sanitizeCssLength(column.width,"height"):`${resized}px`}renderResizeHandle(column){if(!column.resizable)return nothing;const minWidth=this.minimumResizeWidth(column),maxWidth=this.maximumResizeWidth(column,minWidth),width=this.currentResizeWidth(column),aria=columnResizeAriaValues(width,minWidth,maxWidth);return html`<span
|
|
2
2
|
part="resize-handle"
|
|
3
3
|
data-col-key=${column.key}
|
|
4
4
|
role="separator"
|
|
@@ -11,7 +11,7 @@ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/nat
|
|
|
11
11
|
aria-valuemax=${aria.max}
|
|
12
12
|
@pointerdown=${this.onResizePointerDown}
|
|
13
13
|
@keydown=${this.onResizeKeyDown}
|
|
14
|
-
></span>`}syncResizeHandleValues(writes){const measurements=[];for(const handle of this.renderRoot.querySelectorAll('[part="resize-handle"]')){const key=handle.dataset.colKey;if(!key)continue;const column=this.columnsByKey.get(key);if(!column||this.resizedColumnWidths.has(key)||this.parsePixelLength(column.width)!==void 0)continue;const rendered=handle.closest("th[data-col-key]")?.getBoundingClientRect().width;if(rendered&&rendered>0){const width=Math.round(rendered);measurements.push({handle,width})}}const apply=()=>{for(const{handle,width}of measurements)handle.setAttribute("aria-valuenow",String(width)),handle.setAttribute("aria-valuetext",this.resizeValueText(width))};writes.push(apply)}rollbackResizePreview(state2){const reverted=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted.delete(state2.key):reverted.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted;const column=this.columnsByKey.get(state2.key),col=this.renderRoot.querySelector(`col[data-col-key="${CSS.escape(state2.key)}"]`),width=column?this.renderedColumnWidth(column):void 0;width?col?.style.setProperty("inline-size",width):col?.style.removeProperty("inline-size");const hasWidths=this.columns.some(column2=>column2.width||this.resizedColumnWidths.has(column2.key)),table=this.renderRoot.querySelector("table");table?.toggleAttribute("data-has-column-widths",hasWidths),table?.setAttribute("data-layout",this.layout==="fixed"||hasWidths||this.resizeState?"fixed":"auto")}cancelResizeGesture(){const state2=this.resizeState;this.resizeState=void 0,this.resizePointer.stop(),state2&&(state2.handle.removeAttribute("data-resizing"),this.rollbackResizePreview(state2))}syncLayoutGeometry(){const writes=[];this.syncAutoScrollMode(writes),this.applyStickyOffsets(writes),this.syncResizeHandleValues(writes),this.recomputeHiddenPriorityColumns(writes);for(const apply of writes)apply()}firstUpdated(changed){super.firstUpdated(changed),!this.hasAttribute("aria-label")&&!this.caption&&devWarnOnce(MISSING_ACCESSIBLE_NAME_WARNING,"<lr-table> has no accessible name: set a host `aria-label` or `caption` so assistive technology can identify the grid.")}connectedCallback(){super.connectedCallback();const owner=this.ownerDocument.defaultView,ResizeObserverCtor=owner?.ResizeObserver;let observer;ResizeObserverCtor&&(observer=new ResizeObserverCtor(()=>{!this.isConnected||this.ownerDocument.defaultView!==owner||this.resizeObserver!==observer||this.scheduleLayoutSync()})),this.resizeObserver=observer;const base=this.renderRoot?.querySelector('[part="base"]');base&&(this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),this.observeHeaders())}disconnectedCallback(){super.disconnectedCallback(),this.cancelResizeGesture(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0;const frame=this.layoutFrame;frame&&frame.owner.cancelAnimationFrame(frame.handle),this.layoutFrame=null,this.observedBase=void 0,this.observedTable=void 0,this.observedHeaders.clear()}adoptedCallback(){super.adoptedCallback(),this.announcements.adopted()}localizedOverride(key,override){return override??this.localize(TABLE_OVERRIDE_MESSAGE_KEYS[key])}loadingText(){return this.localizedOverride("tableLoading",this.loadingLabel)}loadingMoreText(){return this.localizedOverride("tableLoadingMore",this.loadingMoreLabel)}onLoadMore(){this.loadingMore||this.emit("lr-load-more")}observeBase(base){this.observedBase!==base&&(this.observedBase&&this.resizeObserver?.unobserve(this.observedBase),this.resizeObserver?.observe(base),this.observedBase=base)}observeTable(table){this.observedTable!==table&&(this.observedTable&&this.resizeObserver?.unobserve(this.observedTable),table&&this.resizeObserver?.observe(table),this.observedTable=table)}syncAutoScrollMode(writes){const base=this.renderRoot.querySelector('[part="base"]');if(!base)return;const overflows=(this.scrollMode==="auto"||this.scrollMode==="page")&&base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,apply=()=>base.toggleAttribute("data-scroll-overflow",overflows);writes.push(apply)}observeHeaders(){const headers=new Set(this.columns.some(column=>column.sticky||column.resizable)?this.renderRoot.querySelectorAll("th[data-col-key]"):[]);for(const header of this.observedHeaders)headers.has(header)||(this.resizeObserver?.unobserve(header),this.observedHeaders.delete(header));for(const header of headers)this.observedHeaders.has(header)||(this.observedHeaders.add(header),this.resizeObserver?.observe(header))}priorityTierHeaders(tier){return[...this.renderRoot.querySelectorAll(`th[data-priority="${tier}"]`)]}recomputeHiddenPriorityColumns(writes){const hasLowColumn=this.columns.some(col=>col.priority==="low"),hasMediumColumn=this.columns.some(col=>col.priority==="medium"),base=this.renderRoot.querySelector('[part="base"]');if(!hasLowColumn&&!hasMediumColumn){this.priorityTierNaturalWidth.clear(),this.alwaysVisibleNaturalWidth=void 0,this.priorityTierHiddenAllocation.clear(),this.priorityTierRevealAllocation.clear();const visible=this.activeColKey===null?[]:this.visibleHeaders(),apply=()=>{base?.removeAttribute("data-hide-priority-low"),base?.removeAttribute("data-hide-priority-medium"),this.rehomeFocusedColumn(visible)};writes.push(apply),this.priorityToggleAvailable&&(this.priorityToggleAvailable=!1),this.hasHiddenPriorityColumns&&(this.hasHiddenPriorityColumns=!1);return}if(!base||base.clientWidth<=0){this.rehomeFocusedColumn();return}const genuineOverflow=base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,lowHeaders=hasLowColumn?this.priorityTierHeaders("low"):[],mediumHeaders=hasMediumColumn?this.priorityTierHeaders("medium"):[],refreshNaturalWidth=(tier,headers)=>{if(headers.length===0)return!1;const currentlyHidden=headers.every(header=>header.offsetParent===null);if(!currentlyHidden&&genuineOverflow){const width=headers.reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);width>0&&this.priorityTierNaturalWidth.set(tier,width)}return currentlyHidden},lowActuallyHidden=refreshNaturalWidth("low",lowHeaders),mediumActuallyHidden=refreshNaturalWidth("medium",mediumHeaders);if(genuineOverflow){const alwaysWidth=[...this.renderRoot.querySelectorAll('[part="head"] > tr > th')].filter(header=>!header.hasAttribute("data-priority")).reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);alwaysWidth>0&&(this.alwaysVisibleNaturalWidth=alwaysWidth)}const lowNaturalWidth=this.priorityTierNaturalWidth.get("low")??0,mediumNaturalWidth=this.priorityTierNaturalWidth.get("medium")??0,overflowAtFull=(lowActuallyHidden||mediumActuallyHidden?(this.alwaysVisibleNaturalWidth??0)+lowNaturalWidth+mediumNaturalWidth:base.scrollWidth)-base.clientWidth,measuredLow=hasLowColumn&&overflowAtFull>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,overflowAfterLow=measuredLow?overflowAtFull-lowNaturalWidth:overflowAtFull,measuredMedium=hasMediumColumn&&overflowAfterLow>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,allocation=base.offsetWidth,needsMedium=this.settlePriorityTier(base,"medium",measuredMedium,mediumActuallyHidden,allocation,writes),needsLow=this.settlePriorityTier(base,"low",hasLowColumn&&(measuredLow||needsMedium),lowActuallyHidden,allocation,writes);if(this.activeColKey!==null){const visible=this.visibleHeaders().filter(header=>this.priorityColumnsVisible||!(header.dataset.priority==="low"&&needsLow)&&!(header.dataset.priority==="medium"&&needsMedium)),apply=()=>this.rehomeFocusedColumn(visible);writes.push(apply)}const toggleAvailable=needsLow||needsMedium,anyPriorityHidden=toggleAvailable&&!this.priorityColumnsVisible;this.priorityToggleAvailable!==toggleAvailable&&(this.priorityToggleAvailable=toggleAvailable),this.hasHiddenPriorityColumns!==anyPriorityHidden&&(this.hasHiddenPriorityColumns=anyPriorityHidden)}settlePriorityTier(base,tier,measured,actuallyHidden,allocation,writes){const attribute=tier==="low"?"data-hide-priority-low":"data-hide-priority-medium",wasMarked=base.hasAttribute(attribute),revealedAt=this.priorityTierRevealAllocation.get(tier);this.priorityTierRevealAllocation.delete(tier);const hiddenAt=this.priorityTierHiddenAllocation.get(tier),held=actuallyHidden&&hiddenAt!==void 0&&allocation<=hiddenAt+TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,hide=measured||held;hide?(!wasMarked||hiddenAt===void 0)&&this.priorityTierHiddenAllocation.set(tier,Math.max(allocation,revealedAt??allocation)):(this.priorityTierHiddenAllocation.delete(tier),wasMarked&&actuallyHidden&&this.priorityTierRevealAllocation.set(tier,allocation));const apply=()=>base.toggleAttribute(attribute,hide);return writes.push(apply),hide}rehomeFocusedColumn(headers){if(this.activeColKey===null)return;const visible=headers??this.visibleHeaders();visible.length!==0&&(visible.some(header=>header.dataset.colKey===this.activeColKey)||(this.activeColKey=visible[0].dataset.colKey??null))}keyOf(row,index){try{const key=this.rowKey?this.rowKey(row):index;return typeof key=="string"?key.trim().length===0?void 0:key:typeof key=="number"?key:void 0}catch{return}}canonicalRowEntries(){const inputs=this.canonicalRowEntriesInputs;if(this.cachedCanonicalRowEntries!==null&&inputs?.rows===this.rows&&inputs.rowKey===this.rowKey)return this.cachedCanonicalRowEntries;const entries=[],seen=new Set;return this.rows.forEach((row,index)=>{const key=this.keyOf(row,index);if(key===void 0)return;const encoded=encodeKey(key);seen.has(encoded)||(seen.add(encoded),entries.push({row,index,key,token:encoded}))}),this.canonicalRowEntriesInputs={rows:this.rows,rowKey:this.rowKey},this.cachedCanonicalRowEntries=entries,entries}matchingEntries(){const text=(this.filterText??"").trim(),locale=text===""?"":this.effectiveLocale,canonicalEntries=this.sortedCanonicalEntries(),inputs=this.matchingEntriesInputs;if(this.cachedMatchingEntries!==null&&inputs!==null&&inputs.entries===canonicalEntries&&inputs.filter===this.filter&&inputs.text===text&&inputs.locale===locale)return this.cachedMatchingEntries;let entries;if(text==="")entries=canonicalEntries;else{const stringify=createFilterStringifier(),intlLocale=this.effectiveLocale,normalized=text.toLocaleLowerCase(intlLocale);entries=canonicalEntries.filter(entry=>{if(this.filter)return this.filter(entry.row,text);let haystack=entry.search?.locale===intlLocale?entry.search.text:void 0;return haystack===void 0&&(haystack=stringify(entry.row).toLocaleLowerCase(intlLocale),isImmutableSearchRow(entry.row)&&(entry.search={locale:intlLocale,text:haystack})),haystack.includes(normalized)})}return this.matchingEntriesInputs={entries:canonicalEntries,filter:this.filter,text,locale},this.cachedMatchingEntries=entries,entries}get normalizedPageSize(){return finiteInteger(this.pageSize,DEFAULT_PAGE_SIZE,1,MAX_PAGE_SIZE)}get effectiveSkeletonRows(){const explicit=finiteCount(this.skeletonRows,0,MAX_SKELETON_ROWS);if(explicit>0)return explicit;const pageSize=this.normalizedPageSize;return pageSize===DEFAULT_PAGE_SIZE?DEFAULT_SKELETON_ROWS:Math.min(pageSize,MAX_SKELETON_ROWS)}get matchingTotalItems(){const totalItems=finiteInteger(this.totalItems,-1);return totalItems>=0?totalItems:this.matchingEntries().length}get serverUnknownTotal(){return this.paginationMode==="server"&&this.unknownTotal}get pageCount(){const pageSize=this.normalizedPageSize;return pageSize>0?Math.ceil(this.matchingTotalItems/pageSize):0}get appliedPage(){return this.pageCount===0?1:finiteInteger(this.page,1,1,this.pageCount)}sortedEntries(){return this.matchingEntries()}sortedCanonicalEntries(){const entries=this.canonicalRowEntries();if(this.sortMode!=="client"||this.sortKey==="")return entries;const col=this.columnsByKey.get(this.sortKey);if(!col?.sortable)return entries;const locale=this.effectiveLocale,inputs=this.sortedEntriesInputs;if(this.cachedSortedEntries!==null&&inputs!==null&&inputs.entries===entries&&inputs.columns===this.columns&&inputs.mode===this.sortMode&&inputs.key===this.sortKey&&inputs.dir===this.sortDir&&inputs.locale===locale&&inputs.groupBy===this.groupBy)return this.cachedSortedEntries;const collator=getCollator(locale,{numeric:!0}),dir=this.sortDir==="desc"?-1:1,decorated=entries.map(entry=>{const raw=typeof col.sortValue=="function"?col.sortValue(entry.row):typeof col.cell=="function"?String(col.cell(entry.row)??""):"";return{entry,value:typeof raw=="number"&&!Number.isFinite(raw)?null:raw}}),compare=(a,b)=>{const av=a.value,bv=b.value;return av==null&&bv==null?0:av==null?1:bv==null?-1:typeof av=="number"&&typeof bv=="number"?(av-bv)*dir:collator.compare(String(av),String(bv))*dir};let sorted;const groupBy=this.groupBy;if(groupBy===void 0)decorated.sort(compare),sorted=decorated.map(decoration=>decoration.entry);else{const buckets=new Map;for(const decoration of decorated){const groupKey=groupBy(decoration.entry.row),bucket=buckets.get(groupKey);bucket===void 0?buckets.set(groupKey,[decoration]):bucket.push(decoration)}const ordered=[...buckets.values()],constantWithinEveryGroup=ordered.every(bucket=>bucket.every(decoration=>compare(decoration,bucket[0])===0));constantWithinEveryGroup&&ordered.sort((a,b)=>compare(a[0],b[0])),sorted=[];for(const bucket of ordered){constantWithinEveryGroup||bucket.sort(compare);for(const decoration of bucket)sorted.push(decoration.entry)}}return this.sortedEntriesInputs={entries,columns:this.columns,mode:this.sortMode,key:this.sortKey,dir:this.sortDir,locale,groupBy},this.cachedSortedEntries=sorted,sorted}renderedEntries(){const entries=this.sortedEntries(),size=this.normalizedPageSize,start=this.paginationMode==="server"?0:(this.appliedPage-1)*size,cached=this.pageEntriesMemo;if(cached&&cached.entries===entries&&cached.start===start&&cached.size===size)return cached.result;const result=entries.slice(start,start+size);return this.pageEntriesMemo={entries,start,size,result},result}publicRows(entries){let rows=this.publicRowsMemo.get(entries);return rows||(rows=Object.freeze(entries.map(entry=>entry.row)),this.publicRowsMemo.set(entries,rows)),rows}aggregate(callback,key=callback,receiver=this){if(!callback)return"";const rows=this.viewRows;return(rows!==this.aggregateRows||this.columns!==this.aggregateColumns||this.effectiveLocale!==this.aggregateLocale)&&(this.aggregateRows=rows,this.aggregateColumns=this.columns,this.aggregateLocale=this.effectiveLocale,this.aggregateValues.clear()),this.aggregateValues.has(key)||this.aggregateValues.set(key,callback.call(receiver,rows)),this.aggregateValues.get(key)}get viewRows(){return this.publicRows(this.sortedEntries())}get pageRows(){return this.publicRows(this.renderedEntries())}focusedColKey(displayed){const visibleKeys=displayed??this.visibleHeaders().map(el=>el.dataset.colKey).filter(key=>key!==void 0&&this.columnsByKey.has(key));return this.activeColKey!==null&&this.columnsByKey.has(this.activeColKey)&&(visibleKeys.length===0||visibleKeys.includes(this.activeColKey))?this.activeColKey:visibleKeys[0]??this.columns[0]?.key??null}displayedColumnKeys(){const base=this.renderRoot?.querySelector?.('[part="base"]'),hideLow=!this.priorityColumnsVisible&&!!base?.hasAttribute("data-hide-priority-low"),hideMedium=!this.priorityColumnsVisible&&!!base?.hasAttribute("data-hide-priority-medium");return this.columns.filter(col=>!(hideLow&&col.priority==="low")&&!(hideMedium&&col.priority==="medium")).map(col=>col.key)}focusedRowKey(){if(this.activeRowKey!==null&&this.rowsByKey.has(this.activeRowKey))return this.activeRowKey;const selectedKey=this._selectedKeys.values().next().value;if(selectedKey!==void 0){const selected=encodeKey(selectedKey);if(this.rowsByKey.has(selected))return selected}const first=this.renderedEntries()[0];return first?encodeKey(first.key):null}rowsAffectingRovingFocusChanged(changed){return changed.has("rows")||changed.has("rowKey")||changed.has("filterText")||changed.has("filter")||changed.has("page")||changed.has("pageSize")||changed.has("paginationMode")||changed.has("totalItems")||changed.has("columns")||changed.has("sortKey")||changed.has("sortDir")||changed.has("sortMode")||changed.has("groupBy")||this.rowsLocale!==this.effectiveLocale}captureRovingFocus(changed){this.rovingFocusSnapshot=null;const active=shadowFocusTarget(this),HTMLElementCtor=this.ownerDocument?.defaultView?.HTMLElement;if(!(!HTMLElementCtor||!(active instanceof HTMLElementCtor))){if(changed.has("columns")&&active.matches("th[data-col-key]")){const headers=this.visibleHeaders(),key=active.dataset.colKey,index=headers.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"header",key,index,targetKey:null,element:active});return}if(this.rowsAffectingRovingFocusChanged(changed)&&active.matches("tr[data-row-key]")){const renderedRows=[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],key=active.dataset.rowKey,index=renderedRows.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"row",key,index,targetKey:null,element:active})}}}resolveRovingFocusTarget(){const snapshot=this.rovingFocusSnapshot;if(snapshot===null)return;const keys=snapshot.kind==="header"?this.columns.map(column=>column.key):[...this.rowsByKey.keys()];snapshot.targetKey=keys.includes(snapshot.key)?snapshot.key:keys[Math.min(snapshot.index,keys.length-1)]??null,snapshot.kind==="header"?this.activeColKey=snapshot.targetKey:this.activeRowKey=snapshot.targetKey}willUpdate(changed){if(super.willUpdate(changed),this.themedResizeMinWidth=void 0,this.captureRovingFocus(changed),this.selectionMode==="single"&&this._selectedKeys.size>1&&(changed.has("selectionMode")||changed.has("selectedRowKeys"))){const first=this._selectedKeys.values().next().value;if(this.selectedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first])),this.hasUpdated){const rowKeys=this.asKeyList(Object.freeze(first===void 0?[]:[first]));this.emit("lr-selection-change",Object.freeze({selectedRowKeys:rowKeys}))}}if(this.expansionMode==="single"&&this._expandedKeys.size>1&&(changed.has("expansionMode")||changed.has("expandedRowKeys"))){const first=this._expandedKeys.values().next().value;this.expandedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first]))}if(!this.hasUpdated){const parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);parsed&&typeof parsed.priorityColumnsVisible=="boolean"&&!isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&(this.priorityColumnsVisible=parsed.priorityColumnsVisible)}if(changed.has("columns")&&(this.columnsByKey=new Map(this.columns.map(c=>[c.key,c]))),this.rowsAffectingRovingFocusChanged(changed)&&(this.rowsByKey=new Map(this.renderedEntries().map(entry=>[entry.token,entry])),this.rowsLocale=this.effectiveLocale),this.resolveRovingFocusTarget(),this.editingCell!==null){const column=this.columnsByKey.get(this.editingCell.columnKey);(!this.rowsByKey.has(this.editingCell.rowKey)||normalizedEditTrigger(column?.editTrigger)!=="double-click")&&(this.editingCell=null)}this.editorHadFocusBeforeUpdate=this.focusedEditorCell!==null&&shadowFocusTarget(this)===this.editorElementFor(this.focusedEditorCell.rowKey,this.focusedEditorCell.columnKey)}stickyOffsets(){const offsets=new Map,headerWidths=new Map;for(const el of this.renderRoot.querySelectorAll("th[data-col-key]")){const key=el.dataset.colKey;key!==void 0&&!headerWidths.has(key)&&headerWidths.set(key,el.offsetWidth)}const headerWidth=key=>headerWidths.get(key)??0;let runningStart=0;for(const col of this.columns)stickyDirection(col.sticky)==="start"&&(offsets.set(col.key,runningStart),runningStart+=headerWidth(col.key));let runningEnd=0;for(let i=this.columns.length-1;i>=0;i--){const col=this.columns[i];col&&stickyDirection(col.sticky)==="end"&&(offsets.set(col.key,runningEnd),runningEnd+=headerWidth(col.key))}return offsets}computeHeatDomain(hasHeatTint){if(!hasHeatTint)return null;const entries=this.matchingEntries(),min=this.heatTintScale?.min,max=this.heatTintScale?.max,cached=this.heatDomainCache;if(cached&&cached.entries===entries&&cached.columns===this.columns&&cached.min===min&&cached.max===max)return cached.domain;const domain=this.deriveHeatDomain(entries);return this.heatDomainCache={entries,columns:this.columns,min,max,domain},domain}deriveHeatDomain(entries){const values=[];for(const entry of entries)for(const col of this.columns){const v=col.heatValue?.(entry.row);v!=null&&Number.isFinite(v)&&values.push(v)}const auto=minMax(values),lo=this.heatTintScale?.min??auto?.[0],hi=this.heatTintScale?.max??auto?.[1];return lo===void 0||hi===void 0?null:[lo,hi]}heatShare(col,row,domain){if(!col.heatValue||!domain)return null;const v=col.heatValue(row);if(v==null||!Number.isFinite(v))return null;const[lo,hi]=domain;return`${(finiteRatio(v,lo,hi)*100).toFixed(2)}%`}applyStickyOffsets(writes){if(!this.columns.some(c=>c.sticky))return;const offsets=this.stickyOffsets(),cells=this.renderRoot.querySelectorAll("th[data-col-key], td[data-col-key]"),apply=()=>cells.forEach(el=>{const key=el.dataset.colKey;key!==void 0&&offsets.has(key)&&el.style.setProperty("--lr-table-sticky-offset",`${offsets.get(key)}px`)});writes.push(apply)}updated(changed){super.updated(changed),this.firstUpdateAnnouncementsReady&&this.rowsTruncated&&(changed.has("rows")||changed.has("maxRows"))&&this.announcements.announcePolite(this.localize("tableRowLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.rows.length)})),this.firstUpdateAnnouncementsReady&&changed.has("loading")&&this.loading&&this.announcements.announcePolite(this.loadingText()),this.firstUpdateAnnouncementsReady&&changed.has("loadingMore")&&this.loadingMore&&!this.loading&&this.shadowRoot?.querySelector('[part="more-button"]')&&this.announcements.announcePolite(this.loadingMoreText());const announcesErrorTransition=this.firstUpdateAnnouncementsReady&&changed.has("error")&&this.error,announcesMountedError=!this.firstUpdateAnnouncementsReady&&this.announce&&this.error;if((announcesErrorTransition||announcesMountedError)&&this.announcements.announceAssertive(this.localizedOverride("tableLoadFailed",this.errorHeading)),this.firstUpdateAnnouncementsReady=!0,this.persistReady&&changed.has("priorityColumnsVisible")&&writePersistedState(this.storageFullKey,{priorityColumnsVisible:this.priorityColumnsVisible}),this.persistReady=!0,changed.has("columns")||changed.has("revealColumnsLabel")||changed.has("columnsHideLabel")||changed.has("priorityColumnsVisible")||changed.has("storageKey")){const inertMembers=[],labelsInert=this.revealColumnsLabel!==void 0||this.columnsHideLabel!==void 0;labelsInert&&inertMembers.push("`revealColumnsLabel`/`columnsHideLabel`"),isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&inertMembers.push("`priorityColumnsVisible`"),this.storageKey&&inertMembers.push("`storageKey`"),inertMembers.length>0&&this.columns.length>0&&!this.columns.some(col=>col.priority)&&devWarnOnce(INERT_PRIORITY_COLUMN_CONFIG_WARNING,`<lr-table>: ${inertMembers.join(", ")} `+(inertMembers.length>1||labelsInert?"have":"has")+" no effect unless at least one column declares `priority`.")}const geometryChanged=changed.size===0||[...changed.keys()].some(key=>key!=="selectedRowKeys"&&key!=="selectionMode"&&key!=="activeRowKey"&&key!=="activeColKey"),base=this.renderRoot.querySelector('[part="base"]');if(base&&this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),geometryChanged&&this.observeHeaders(),this.restoreRovingFocus(),this.hasAlwaysOnEditors&&this.restoreAlwaysOnEditorFocus(),changed.has("editingCell"))if(this.editingCell){const{rowKey,columnKey}=this.editingCell;queueMicrotask(()=>this.editorElementFor(rowKey,columnKey)?.focus())}else{const previous=changed.get("editingCell");if(previous){const{rowKey,columnKey}=previous;queueMicrotask(()=>this.cellElementForToken(rowKey,columnKey)?.focus())}}geometryChanged&&queueMicrotask(()=>this.syncLayoutGeometry())}restoreRovingFocus(){const snapshot=this.rovingFocusSnapshot;if(this.rovingFocusSnapshot=null,snapshot===null)return;const internalActive=shadowFocusTarget(this);if(internalActive!==null&&internalActive!==snapshot.element)return;const documentActive=activeElementIn(this.ownerDocument);if(documentActive!==null&&documentActive!==this&&documentActive!==this.ownerDocument.body)return;const candidates=snapshot.kind==="header"?this.visibleHeaders():[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],target=candidates.find(candidate=>snapshot.kind==="header"?candidate.dataset.colKey===snapshot.targetKey:candidate.dataset.rowKey===snapshot.targetKey)??candidates[Math.min(snapshot.index,candidates.length-1)]??null;snapshot.kind==="header"?this.focusHeader(target):this.focusRow(target)}activateColumn(key){this.activeColKey=key;const col=this.columnsByKey.get(key);if(!col?.sortable)return;const sortDir=this.sortKey===key?this.sortDir==="asc"?"desc":"asc":col.defaultSortDir??this.defaultSortDir,request=Object.freeze({phase:"request",sortKey:col.key,sortDir});this.emit("lr-sort-request",request,{cancelable:!0}).defaultPrevented||(this.sortMode==="client"&&(this.sortKey=col.key,this.sortDir=sortDir),this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:col.key,sortDir})))}commitSelectedKeys(next){next.size>this.maxRows&&(next=keySet(next,this.maxRows));const previous=this._selectedKeys;this.isRebind("selectedRowKeys",next,previous),this._selectedKeys=next,this.requestUpdate("selectedRowKeys",previous)}activateRow(key){this.activeRowKey=key;const entry=this.rowsByKey.get(key);if(entry===void 0)return;const{row,key:selectedKey}=entry;if(this.emit("lr-row-activate",Object.freeze({row})),this.selectionMode==="single"){this.commitSelectedKeys(new Set([selectedKey]));const rowKeys=this.asKeyList(Object.freeze([selectedKey]));this.emit("lr-selection-change",Object.freeze({selectedRowKeys:rowKeys}))}else if(this.selectionMode==="multiple"){const rawKey=selectedKey,next=new Set(this._selectedKeys);next.has(rawKey)?next.delete(rawKey):next.add(rawKey),this.commitSelectedKeys(next);const rowKeys=this.asKeyList(Object.freeze([...this._selectedKeys]));this.emit("lr-selection-change",Object.freeze({selectedRowKeys:rowKeys}))}}get hasAlwaysOnEditors(){return this.columns.some(col=>normalizedEditTrigger(col.editTrigger)==="always")}editorValue(row,column){const value=column.editValue?.(row)??row[column.key]??"";return String(value)}startEditing(rowKey,columnKey){const column=this.columnsByKey.get(columnKey);normalizedEditTrigger(column?.editTrigger)!=="double-click"||!this.rowsByKey.has(rowKey)||(this.editingCell={rowKey,columnKey})}commitEdit(event,rowKey,columnKey){event.stopPropagation();const field=event.currentTarget,entry=this.rowsByKey.get(rowKey),column=this.columnsByKey.get(columnKey),isTransient=this.editingCell?.rowKey===rowKey&&this.editingCell.columnKey===columnKey;if(!entry||!column||normalizedEditTrigger(column.editTrigger)===void 0){isTransient&&(this.editingCell=null);return}const value=column.editType==="number"&&field.value!==""?Number(field.value):field.value;this.emit("lr-cell-edit",Object.freeze({row:entry.row,columnKey,value})),isTransient&&(this.editingCell=null)}editorElementFor(rowKey,columnKey){return this.cellElementForToken(rowKey,columnKey)?.querySelector('[part="cell-editor"]')??null}restoreAlwaysOnEditorFocus(){const cell=this.focusedEditorCell;if(cell===null)return;const editor=this.editorElementFor(cell.rowKey,cell.columnKey);editor===null?this.focusedEditorCell=null:this.editorHadFocusBeforeUpdate&&shadowFocusTarget(this)!==editor&&editor.focus(),this.editorHadFocusBeforeUpdate=!1}activateExpandToggle(key){const entry=this.rowsByKey.get(encodeKey(key));if(entry===void 0)return;const expanded=!this._expandedKeys.has(key),detail=Object.freeze({row:entry.row,rowKey:key,expanded});if(this.expansionMode!=="single"&&this.expansionMode!=="multiple"){this.emit("lr-row-expand-toggle",detail);return}requestThenCommit({requestDetail:detail,emitRequest:(requestDetail,init)=>this.emit("lr-row-expand-request",requestDetail,init),commit:()=>{let next=this.expansionMode==="single"?new Set:new Set(this._expandedKeys);expanded?next.add(key):next.delete(key),next.size>this.maxRows&&(next=keySet(next,this.maxRows));const displaced=[...this._expandedKeys].filter(other=>other!==key&&!next.has(other)),previous=this._expandedKeys;this.isRebind("expandedRowKeys",next,previous),this._expandedKeys=next,this.requestUpdate("expandedRowKeys",previous);for(const other of displaced){const displacedEntry=this.rowsByKey.get(encodeKey(other));displacedEntry!==void 0&&this.emit("lr-row-expand-toggle",Object.freeze({row:displacedEntry.row,rowKey:other,expanded:!1}))}this.emit("lr-row-expand-toggle",Object.freeze({...detail,expanded:next.has(key)}))}})}rowElement(rowKey){return this.rowElementForToken(encodeKey(rowKey))}cellElement(rowKey,columnKey){return this.cellElementForToken(encodeKey(rowKey),columnKey)}editCell(rowKey,columnKey){const token=encodeKey(rowKey),trigger=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger);if(!(trigger===void 0||!this.rowsByKey.has(token))){if(trigger==="always"){this.editorElementFor(token,columnKey)?.focus();return}this.startEditing(token,columnKey)}}expandedContentElement(rowKey){const token=encodeKey(rowKey);return[...this.renderRoot.querySelectorAll("tbody tr[data-expanded-row-key]")].find(el=>el.dataset.expandedRowKey===token)?.querySelector('[part="expanded-cell"]')??null}rowElementForToken(token){return[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")].find(el=>el.dataset.rowKey===token)??null}cellElementForToken(token,columnKey){return[...this.rowElementForToken(token)?.querySelectorAll("td[data-col-key]")??[]].find(el=>el.dataset.colKey===columnKey)??null}visibleHeaders(){return[...this.renderRoot?.querySelectorAll("th[data-col-key]")??[]].filter(el=>el.offsetParent!==null)}focusHeader(el){el?.dataset.colKey&&(this.activeColKey=el.dataset.colKey,el.focus())}focusRow(el){el?.dataset.rowKey&&(this.activeRowKey=el.dataset.rowKey,el.focus())}onHeaderKeyDown(e,th){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateColumn(th.dataset.colKey);return}const headers=this.visibleHeaders(),index=headers.indexOf(th);if(index<0)return;const rtl=isRtl(this);switch(e.key){case"ArrowLeft":e.preventDefault(),this.focusHeader(headers[rtl?Math.min(headers.length-1,index+1):Math.max(0,index-1)]??null);return;case"ArrowRight":e.preventDefault(),this.focusHeader(headers[rtl?Math.max(0,index-1):Math.min(headers.length-1,index+1)]??null);return;case"Home":e.preventDefault(),this.focusHeader(headers[0]??null);return;case"End":e.preventDefault(),this.focusHeader(headers[headers.length-1]??null);return;case"ArrowDown":{e.preventDefault();const rows=[...this.renderRoot.querySelectorAll("[data-row-key]")],key=this.focusedRowKey();this.focusRow(rows.find(r=>r.dataset.rowKey===key)??rows[0]??null);return}default:return}}editableCellFor(target){const columnKey=target.dataset.colKey;return target.tagName!=="TD"||columnKey===void 0?null:normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="double-click"?{element:target,columnKey}:null}editableCellsInRow(tr){return[...tr.querySelectorAll("td[data-editable]")].filter(td=>td.offsetParent!==null&&!td.inert&&!td.closest("[inert]"))}onRowKeyDown(e,tr){const cell=this.editableCellFor(e.target);if((e.key==="Enter"||e.key==="F2")&&cell){e.preventDefault(),this.startEditing(tr.dataset.rowKey,cell.columnKey);return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateRow(tr.dataset.rowKey);return}if(e.key==="ArrowLeft"||e.key==="ArrowRight"){this.onRowLateralKeyDown(e,tr,cell);return}const bodyRows=[...this.renderRoot.querySelectorAll("[data-row-key]")],index=bodyRows.indexOf(tr);if(!(index<0))switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(bodyRows[Math.min(bodyRows.length-1,index+1)]??null);return;case"ArrowUp":if(e.preventDefault(),index===0){const headers=this.visibleHeaders(),key=this.focusedColKey();this.focusHeader(headers.find(h=>h.dataset.colKey===key)??headers[0]??null)}else this.focusRow(bodyRows[index-1]??null);return;case"Home":e.preventDefault(),this.focusRow(bodyRows[0]??null);return;case"End":e.preventDefault(),this.focusRow(bodyRows[bodyRows.length-1]??null);return;default:return}}onRowLateralKeyDown(e,tr,cell){const cells=this.editableCellsInRow(tr);if(cells.length===0)return;e.preventDefault();const forward=e.key===(isRtl(this)?"ArrowLeft":"ArrowRight");if(cell===null){(forward?cells[0]:cells[cells.length-1])?.focus();return}const index=cells.indexOf(cell.element);forward?cells[index+1]?.focus():index<=0?this.focusRow(tr):cells[index-1]?.focus()}renderCellValue(col,row){return typeof col.cell=="function"?col.cell(row):(devWarnOnce(MISSING_CELL_RENDERER_WARNING,"<lr-table>: a column has no required `cell` renderer, so its cells render empty. Supply a `cell` callback for every column."),nothing)}renderCellEditor(row,col,rowKey,alwaysOn){const type=col.editType??"text",value=this.editorValue(row,col),label=col.editLabel?.(row)??this.localize("tableEditCell",void 0,{column:col.label}),onChange=event=>this.commitEdit(event,rowKey,col.key),onKeyDown=event=>this.onEditorKeyDown(event,rowKey,col.key);if(type==="select"){const options=col.editOptions??[];return html`<select
|
|
14
|
+
></span>`}syncResizeHandleValues(writes){const measurements=[];for(const handle of this.renderRoot.querySelectorAll('[part="resize-handle"]')){const key=handle.dataset.colKey;if(!key)continue;const column=this.columnsByKey.get(key);if(!column||this.resizedColumnWidths.has(key)||this.parsePixelLength(column.width)!==void 0)continue;const rendered=handle.closest("th[data-col-key]")?.getBoundingClientRect().width;if(rendered&&rendered>0){const width=Math.round(rendered);measurements.push({handle,width})}}const apply=()=>{for(const{handle,width}of measurements)handle.setAttribute("aria-valuenow",String(width)),handle.setAttribute("aria-valuetext",this.resizeValueText(width))};writes.push(apply)}rollbackResizePreview(state2){const reverted=new Map(this.resizedColumnWidths);state2.previousWidth===void 0?reverted.delete(state2.key):reverted.set(state2.key,state2.previousWidth),this.resizedColumnWidths=reverted;const column=this.columnsByKey.get(state2.key),col=this.renderRoot.querySelector(`col[data-col-key="${CSS.escape(state2.key)}"]`),width=column?this.renderedColumnWidth(column):void 0;width?col?.style.setProperty("inline-size",width):col?.style.removeProperty("inline-size");const hasWidths=this.columns.some(column2=>column2.width||this.resizedColumnWidths.has(column2.key)),table=this.renderRoot.querySelector("table");table?.toggleAttribute("data-has-column-widths",hasWidths),table?.setAttribute("data-layout",this.layout==="fixed"||hasWidths||this.resizeState?"fixed":"auto")}cancelResizeGesture(){const state2=this.resizeState;this.resizeState=void 0,this.resizePointer.stop(),state2&&(state2.handle.removeAttribute("data-resizing"),this.rollbackResizePreview(state2))}syncLayoutGeometry(){const writes=[];this.syncAutoScrollMode(writes),this.applyStickyOffsets(writes),this.syncResizeHandleValues(writes),this.recomputeHiddenPriorityColumns(writes);for(const apply of writes)apply()}firstUpdated(changed){super.firstUpdated(changed),!this.hasAttribute("aria-label")&&!this.caption&&devWarnOnce(MISSING_ACCESSIBLE_NAME_WARNING,"<lr-table> has no accessible name: set a host `aria-label` or `caption` so assistive technology can identify the grid.")}connectedCallback(){super.connectedCallback();const owner=this.ownerDocument.defaultView,ResizeObserverCtor=owner?.ResizeObserver;let observer;ResizeObserverCtor&&(observer=new ResizeObserverCtor(()=>{!this.isConnected||this.ownerDocument.defaultView!==owner||this.resizeObserver!==observer||this.scheduleLayoutSync()})),this.resizeObserver=observer;const base=this.renderRoot?.querySelector('[part="base"]');base&&(this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),this.observeHeaders())}disconnectedCallback(){super.disconnectedCallback(),this.cancelResizeGesture(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0;const frame=this.layoutFrame;frame&&frame.owner.cancelAnimationFrame(frame.handle),this.layoutFrame=null,this.observedBase=void 0,this.observedTable=void 0,this.observedHeaders.clear()}adoptedCallback(){super.adoptedCallback(),this.announcements.adopted()}localizedOverride(key,override){return override??this.localize(TABLE_OVERRIDE_MESSAGE_KEYS[key])}loadingText(){return this.localizedOverride("tableLoading",this.loadingLabel)}loadingMoreText(){return this.localizedOverride("tableLoadingMore",this.loadingMoreLabel)}onLoadMore(){this.loadingMore||this.emit("lr-load-more")}observeBase(base){this.observedBase!==base&&(this.observedBase&&this.resizeObserver?.unobserve(this.observedBase),this.resizeObserver?.observe(base),this.observedBase=base)}observeTable(table){this.observedTable!==table&&(this.observedTable&&this.resizeObserver?.unobserve(this.observedTable),table&&this.resizeObserver?.observe(table),this.observedTable=table)}syncAutoScrollMode(writes){const base=this.renderRoot.querySelector('[part="base"]');if(!base)return;const overflows=(this.scrollMode==="auto"||this.scrollMode==="page")&&base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,apply=()=>base.toggleAttribute("data-scroll-overflow",overflows);writes.push(apply)}observeHeaders(){const headers=new Set(this.columns.some(column=>column.sticky||column.resizable)?this.renderRoot.querySelectorAll("th[data-col-key]"):[]);for(const header of this.observedHeaders)headers.has(header)||(this.resizeObserver?.unobserve(header),this.observedHeaders.delete(header));for(const header of headers)this.observedHeaders.has(header)||(this.observedHeaders.add(header),this.resizeObserver?.observe(header))}priorityTierHeaders(tier){return[...this.renderRoot.querySelectorAll(`th[data-priority="${tier}"]`)]}recomputeHiddenPriorityColumns(writes){const hasLowColumn=this.columns.some(col=>col.priority==="low"),hasMediumColumn=this.columns.some(col=>col.priority==="medium"),base=this.renderRoot.querySelector('[part="base"]');if(!hasLowColumn&&!hasMediumColumn){this.priorityTierNaturalWidth.clear(),this.alwaysVisibleNaturalWidth=void 0,this.priorityTierHiddenAllocation.clear(),this.priorityTierRevealAllocation.clear();const visible=this.activeColKey===null?[]:this.visibleHeaders(),apply=()=>{base?.removeAttribute("data-hide-priority-low"),base?.removeAttribute("data-hide-priority-medium"),this.rehomeFocusedColumn(visible)};writes.push(apply),this.priorityToggleAvailable&&(this.priorityToggleAvailable=!1),this.hasHiddenPriorityColumns&&(this.hasHiddenPriorityColumns=!1);return}if(!base||base.clientWidth<=0){this.rehomeFocusedColumn();return}const genuineOverflow=base.scrollWidth-base.clientWidth>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,lowHeaders=hasLowColumn?this.priorityTierHeaders("low"):[],mediumHeaders=hasMediumColumn?this.priorityTierHeaders("medium"):[],refreshNaturalWidth=(tier,headers)=>{if(headers.length===0)return!1;const currentlyHidden=headers.every(header=>header.offsetParent===null);if(!currentlyHidden&&genuineOverflow){const width=headers.reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);width>0&&this.priorityTierNaturalWidth.set(tier,width)}return currentlyHidden},lowActuallyHidden=refreshNaturalWidth("low",lowHeaders),mediumActuallyHidden=refreshNaturalWidth("medium",mediumHeaders);if(genuineOverflow){const alwaysWidth=[...this.renderRoot.querySelectorAll('[part="head"] > tr > th')].filter(header=>!header.hasAttribute("data-priority")).reduce((sum,header)=>sum+header.getBoundingClientRect().width,0);alwaysWidth>0&&(this.alwaysVisibleNaturalWidth=alwaysWidth)}const lowNaturalWidth=this.priorityTierNaturalWidth.get("low")??0,mediumNaturalWidth=this.priorityTierNaturalWidth.get("medium")??0,overflowAtFull=(lowActuallyHidden||mediumActuallyHidden?(this.alwaysVisibleNaturalWidth??0)+lowNaturalWidth+mediumNaturalWidth:base.scrollWidth)-base.clientWidth,measuredLow=hasLowColumn&&overflowAtFull>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,overflowAfterLow=measuredLow?overflowAtFull-lowNaturalWidth:overflowAtFull,measuredMedium=hasMediumColumn&&overflowAfterLow>TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,allocation=base.offsetWidth,needsMedium=this.settlePriorityTier(base,"medium",measuredMedium,mediumActuallyHidden,allocation,writes),needsLow=this.settlePriorityTier(base,"low",hasLowColumn&&(measuredLow||needsMedium),lowActuallyHidden,allocation,writes);if(this.activeColKey!==null){const visible=this.visibleHeaders().filter(header=>this.priorityColumnsVisible||!(header.dataset.priority==="low"&&needsLow)&&!(header.dataset.priority==="medium"&&needsMedium)),apply=()=>this.rehomeFocusedColumn(visible);writes.push(apply)}const toggleAvailable=needsLow||needsMedium,anyPriorityHidden=toggleAvailable&&!this.priorityColumnsVisible;this.priorityToggleAvailable!==toggleAvailable&&(this.priorityToggleAvailable=toggleAvailable),this.hasHiddenPriorityColumns!==anyPriorityHidden&&(this.hasHiddenPriorityColumns=anyPriorityHidden)}settlePriorityTier(base,tier,measured,actuallyHidden,allocation,writes){const attribute=tier==="low"?"data-hide-priority-low":"data-hide-priority-medium",wasMarked=base.hasAttribute(attribute),revealedAt=this.priorityTierRevealAllocation.get(tier);this.priorityTierRevealAllocation.delete(tier);const hiddenAt=this.priorityTierHiddenAllocation.get(tier),held=actuallyHidden&&hiddenAt!==void 0&&allocation<=hiddenAt+TABLE_SCROLL_OVERFLOW_TOLERANCE_PX,hide=measured||held;hide?(!wasMarked||hiddenAt===void 0)&&this.priorityTierHiddenAllocation.set(tier,Math.max(allocation,revealedAt??allocation)):(this.priorityTierHiddenAllocation.delete(tier),wasMarked&&actuallyHidden&&this.priorityTierRevealAllocation.set(tier,allocation));const apply=()=>base.toggleAttribute(attribute,hide);return writes.push(apply),hide}rehomeFocusedColumn(headers){if(this.activeColKey===null)return;const visible=headers??this.visibleHeaders();visible.length!==0&&(visible.some(header=>header.dataset.colKey===this.activeColKey)||(this.activeColKey=visible[0].dataset.colKey??null))}keyOf(row,index){try{const key=this.rowKey?this.rowKey(row):index;return typeof key=="string"?key.trim().length===0?void 0:key:typeof key=="number"?key:void 0}catch{return}}canonicalRowEntries(){const inputs=this.canonicalRowEntriesInputs;if(this.cachedCanonicalRowEntries!==null&&inputs?.rows===this.rows&&inputs.rowKey===this.rowKey)return this.cachedCanonicalRowEntries;const entries=[],seen=new Set;return this.rows.forEach((row,index)=>{const key=this.keyOf(row,index);if(key===void 0)return;const encoded=encodeKey(key);seen.has(encoded)||(seen.add(encoded),entries.push({row,index,key,token:encoded}))}),this.canonicalRowEntriesInputs={rows:this.rows,rowKey:this.rowKey},this.cachedCanonicalRowEntries=entries,entries}matchingEntries(){const text=(this.filterText??"").trim(),locale=text===""?"":this.effectiveLocale,canonicalEntries=this.sortedCanonicalEntries(),inputs=this.matchingEntriesInputs;if(this.cachedMatchingEntries!==null&&inputs!==null&&inputs.entries===canonicalEntries&&inputs.filter===this.filter&&inputs.text===text&&inputs.locale===locale)return this.cachedMatchingEntries;let entries;if(text==="")entries=canonicalEntries;else{const stringify=createFilterStringifier(),intlLocale=this.effectiveLocale,normalized=text.toLocaleLowerCase(intlLocale);entries=canonicalEntries.filter(entry=>{if(this.filter)return this.filter(entry.row,text);let haystack=entry.search?.locale===intlLocale?entry.search.text:void 0;return haystack===void 0&&(haystack=stringify(entry.row).toLocaleLowerCase(intlLocale),isImmutableSearchRow(entry.row)&&(entry.search={locale:intlLocale,text:haystack})),haystack.includes(normalized)})}return this.matchingEntriesInputs={entries:canonicalEntries,filter:this.filter,text,locale},this.cachedMatchingEntries=entries,entries}get normalizedPageSize(){return finiteInteger(this.pageSize,DEFAULT_PAGE_SIZE,1,MAX_PAGE_SIZE)}get effectiveSkeletonRows(){const explicit=finiteCount(this.skeletonRows,0,MAX_SKELETON_ROWS);if(explicit>0)return explicit;const pageSize=this.normalizedPageSize;return pageSize===DEFAULT_PAGE_SIZE?DEFAULT_SKELETON_ROWS:Math.min(pageSize,MAX_SKELETON_ROWS)}get matchingTotalItems(){const totalItems=finiteInteger(this.totalItems,-1);return totalItems>=0?totalItems:this.matchingEntries().length}get serverUnknownTotal(){return this.paginationMode==="server"&&this.unknownTotal}get pageCount(){const pageSize=this.normalizedPageSize;return pageSize>0?Math.ceil(this.matchingTotalItems/pageSize):0}get appliedPage(){return this.pageCount===0?1:finiteInteger(this.page,1,1,this.pageCount)}sortedEntries(){return this.matchingEntries()}sortedCanonicalEntries(){const entries=this.canonicalRowEntries();if(this.sortMode!=="client"||this.sortKey==="")return entries;const col=this.columnsByKey.get(this.sortKey);if(!col?.sortable)return entries;const locale=this.effectiveLocale,inputs=this.sortedEntriesInputs;if(this.cachedSortedEntries!==null&&inputs!==null&&inputs.entries===entries&&inputs.columns===this.columns&&inputs.mode===this.sortMode&&inputs.key===this.sortKey&&inputs.dir===this.sortDir&&inputs.locale===locale&&inputs.groupBy===this.groupBy)return this.cachedSortedEntries;const collator=getCollator(locale,{numeric:!0}),dir=this.sortDir==="desc"?-1:1,decorated=entries.map(entry=>{const raw=typeof col.sortValue=="function"?col.sortValue(entry.row):typeof col.cell=="function"?String(col.cell(entry.row)??""):"";return{entry,value:typeof raw=="number"&&!Number.isFinite(raw)?null:raw}}),compare=(a,b)=>{const av=a.value,bv=b.value;return av==null&&bv==null?0:av==null?1:bv==null?-1:typeof av=="number"&&typeof bv=="number"?(av-bv)*dir:collator.compare(String(av),String(bv))*dir};let sorted;const groupBy=this.groupBy;if(groupBy===void 0)decorated.sort(compare),sorted=decorated.map(decoration=>decoration.entry);else{const buckets=new Map;for(const decoration of decorated){const groupKey=groupBy(decoration.entry.row),bucket=buckets.get(groupKey);bucket===void 0?buckets.set(groupKey,[decoration]):bucket.push(decoration)}const ordered=[...buckets.values()],constantWithinEveryGroup=ordered.every(bucket=>bucket.every(decoration=>compare(decoration,bucket[0])===0));constantWithinEveryGroup&&ordered.sort((a,b)=>compare(a[0],b[0])),sorted=[];for(const bucket of ordered){constantWithinEveryGroup||bucket.sort(compare);for(const decoration of bucket)sorted.push(decoration.entry)}}return this.sortedEntriesInputs={entries,columns:this.columns,mode:this.sortMode,key:this.sortKey,dir:this.sortDir,locale,groupBy},this.cachedSortedEntries=sorted,sorted}renderedEntries(){const entries=this.sortedEntries(),size=this.normalizedPageSize,start=this.paginationMode==="server"?0:(this.appliedPage-1)*size,cached=this.pageEntriesMemo;if(cached&&cached.entries===entries&&cached.start===start&&cached.size===size)return cached.result;const result=entries.slice(start,start+size);return this.pageEntriesMemo={entries,start,size,result},result}publicRows(entries){let rows=this.publicRowsMemo.get(entries);return rows||(rows=Object.freeze(entries.map(entry=>entry.row)),this.publicRowsMemo.set(entries,rows)),rows}aggregate(callback,key=callback,receiver=this){if(!callback)return"";const rows=this.viewRows;return(rows!==this.aggregateRows||this.columns!==this.aggregateColumns||this.effectiveLocale!==this.aggregateLocale)&&(this.aggregateRows=rows,this.aggregateColumns=this.columns,this.aggregateLocale=this.effectiveLocale,this.aggregateValues.clear()),this.aggregateValues.has(key)||this.aggregateValues.set(key,callback.call(receiver,rows)),this.aggregateValues.get(key)}get viewRows(){return this.publicRows(this.sortedEntries())}get pageRows(){return this.publicRows(this.renderedEntries())}focusedColKey(displayed){const visibleKeys=displayed??this.visibleHeaders().map(el=>el.dataset.colKey).filter(key=>key!==void 0&&this.columnsByKey.has(key));return this.activeColKey!==null&&this.columnsByKey.has(this.activeColKey)&&(visibleKeys.length===0||visibleKeys.includes(this.activeColKey))?this.activeColKey:visibleKeys[0]??this.columns[0]?.key??null}displayedColumnKeys(){const base=this.renderRoot?.querySelector?.('[part="base"]'),hideLow=!this.priorityColumnsVisible&&!!base?.hasAttribute("data-hide-priority-low"),hideMedium=!this.priorityColumnsVisible&&!!base?.hasAttribute("data-hide-priority-medium");return this.columns.filter(col=>!(hideLow&&col.priority==="low")&&!(hideMedium&&col.priority==="medium")).map(col=>col.key)}focusedRowKey(){if(this.activeRowKey!==null&&this.rowsByKey.has(this.activeRowKey))return this.activeRowKey;const selectedKey=this._selectedKeys.values().next().value;if(selectedKey!==void 0){const selected=encodeKey(selectedKey);if(this.rowsByKey.has(selected))return selected}const first=this.renderedEntries()[0];return first?encodeKey(first.key):null}rowsAffectingRovingFocusChanged(changed){return changed.has("rows")||changed.has("rowKey")||changed.has("filterText")||changed.has("filter")||changed.has("page")||changed.has("pageSize")||changed.has("paginationMode")||changed.has("totalItems")||changed.has("columns")||changed.has("sortKey")||changed.has("sortDir")||changed.has("sortMode")||changed.has("groupBy")||this.rowsLocale!==this.effectiveLocale}captureRovingFocus(changed){this.rovingFocusSnapshot=null;const active=shadowFocusTarget(this),HTMLElementCtor=this.ownerDocument?.defaultView?.HTMLElement;if(!(!HTMLElementCtor||!(active instanceof HTMLElementCtor))){if(changed.has("columns")&&active.matches("th[data-col-key]")){const headers=this.visibleHeaders(),key=active.dataset.colKey,index=headers.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"header",key,index,targetKey:null,element:active});return}if(this.rowsAffectingRovingFocusChanged(changed)&&active.matches("tr[data-row-key]")){const renderedRows=[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],key=active.dataset.rowKey,index=renderedRows.indexOf(active);key!==void 0&&index>=0&&(this.rovingFocusSnapshot={kind:"row",key,index,targetKey:null,element:active})}}}resolveRovingFocusTarget(){const snapshot=this.rovingFocusSnapshot;if(snapshot===null)return;const keys=snapshot.kind==="header"?this.columns.map(column=>column.key):[...this.rowsByKey.keys()];snapshot.targetKey=keys.includes(snapshot.key)?snapshot.key:keys[Math.min(snapshot.index,keys.length-1)]??null,snapshot.kind==="header"?this.activeColKey=snapshot.targetKey:this.activeRowKey=snapshot.targetKey}willUpdate(changed){if(super.willUpdate(changed),this.themedResizeMinWidth=void 0,this.captureRovingFocus(changed),this.selectionMode==="single"&&this._selectedKeys.size>1&&(changed.has("selectionMode")||changed.has("selectedRowKeys"))){const first=this._selectedKeys.values().next().value;if(this.selectedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first])),this.hasUpdated){const rowKeys=this.asKeyList(Object.freeze(first===void 0?[]:[first]));this.emit("lr-selection-change",Object.freeze({selectedRowKeys:rowKeys}))}}if(this.expansionMode==="single"&&this._expandedKeys.size>1&&(changed.has("expansionMode")||changed.has("expandedRowKeys"))){const first=this._expandedKeys.values().next().value;this.expandedRowKeys=this.asKeySet(first===void 0?new Set:new Set([first]))}if(!this.hasUpdated){const parsed=readPersistedState(this.storageFullKey,v=>typeof v=="object"&&v!==null);parsed&&typeof parsed.priorityColumnsVisible=="boolean"&&!isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&(this.priorityColumnsVisible=parsed.priorityColumnsVisible)}if(changed.has("columns")&&(this.columnsByKey=new Map(this.columns.map(c=>[c.key,c]))),this.rowsAffectingRovingFocusChanged(changed)&&(this.rowsByKey=new Map(this.renderedEntries().map(entry=>[entry.token,entry])),this.rowsLocale=this.effectiveLocale),this.resolveRovingFocusTarget(),this.editingCell!==null){const column=this.columnsByKey.get(this.editingCell.columnKey);(!this.rowsByKey.has(this.editingCell.rowKey)||normalizedEditTrigger(column?.editTrigger)!=="double-click")&&(this.editingCell=null)}this.editorHadFocusBeforeUpdate=this.focusedEditorCell!==null&&shadowFocusTarget(this)===this.editorElementFor(this.focusedEditorCell.rowKey,this.focusedEditorCell.columnKey)}stickyOffsets(){const offsets=new Map,headerWidths=new Map;for(const el of this.renderRoot.querySelectorAll("th[data-col-key]")){const key=el.dataset.colKey;key!==void 0&&!headerWidths.has(key)&&headerWidths.set(key,el.offsetWidth)}const headerWidth=key=>headerWidths.get(key)??0;let runningStart=0;for(const col of this.columns)stickyDirection(col.sticky)==="start"&&(offsets.set(col.key,runningStart),runningStart+=headerWidth(col.key));let runningEnd=0;for(let i=this.columns.length-1;i>=0;i--){const col=this.columns[i];col&&stickyDirection(col.sticky)==="end"&&(offsets.set(col.key,runningEnd),runningEnd+=headerWidth(col.key))}return offsets}computeHeatDomain(hasHeatTint){if(!hasHeatTint)return null;const entries=this.matchingEntries(),min=this.heatTintScale?.min,max=this.heatTintScale?.max,cached=this.heatDomainCache;if(cached&&cached.entries===entries&&cached.columns===this.columns&&cached.min===min&&cached.max===max)return cached.domain;const domain=this.deriveHeatDomain(entries);return this.heatDomainCache={entries,columns:this.columns,min,max,domain},domain}deriveHeatDomain(entries){const values=[];for(const entry of entries)for(const col of this.columns){const v=col.heatValue?.(entry.row);v!=null&&Number.isFinite(v)&&values.push(v)}const auto=minMax(values),lo=this.heatTintScale?.min??auto?.[0],hi=this.heatTintScale?.max??auto?.[1];return lo===void 0||hi===void 0?null:[lo,hi]}heatShare(col,row,domain){if(!col.heatValue||!domain)return null;const v=col.heatValue(row);if(v==null||!Number.isFinite(v))return null;const[lo,hi]=domain;return`${(finiteRatio(v,lo,hi)*100).toFixed(2)}%`}applyStickyOffsets(writes){if(!this.columns.some(c=>c.sticky))return;const offsets=this.stickyOffsets(),cells=this.renderRoot.querySelectorAll("th[data-col-key], td[data-col-key]"),apply=()=>cells.forEach(el=>{const key=el.dataset.colKey;key!==void 0&&offsets.has(key)&&el.style.setProperty("--lr-table-sticky-offset",`${offsets.get(key)}px`)});writes.push(apply)}updated(changed){super.updated(changed),this.firstUpdateAnnouncementsReady&&this.rowsTruncated&&(changed.has("rows")||changed.has("maxRows"))&&this.announcements.announcePolite(this.localize("tableRowLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.rows.length)})),this.firstUpdateAnnouncementsReady&&changed.has("loading")&&this.loading&&this.announcements.announcePolite(this.loadingText()),this.firstUpdateAnnouncementsReady&&changed.has("loadingMore")&&this.loadingMore&&!this.loading&&this.shadowRoot?.querySelector('[part="more-button"]')&&this.announcements.announcePolite(this.loadingMoreText());const announcesErrorTransition=this.firstUpdateAnnouncementsReady&&changed.has("error")&&this.error,announcesMountedError=!this.firstUpdateAnnouncementsReady&&this.announce&&this.error;if((announcesErrorTransition||announcesMountedError)&&this.announcements.announceAssertive(this.localizedOverride("tableLoadFailed",this.errorHeading)),this.firstUpdateAnnouncementsReady=!0,this.persistReady&&changed.has("priorityColumnsVisible")&&writePersistedState(this.storageFullKey,{priorityColumnsVisible:this.priorityColumnsVisible}),this.persistReady=!0,changed.has("columns")||changed.has("revealColumnsLabel")||changed.has("columnsHideLabel")||changed.has("priorityColumnsVisible")||changed.has("storageKey")){const inertMembers=[],labelsInert=this.revealColumnsLabel!==void 0||this.columnsHideLabel!==void 0;labelsInert&&inertMembers.push("`revealColumnsLabel`/`columnsHideLabel`"),isPersistedPropertyExplicitlySet(this,"priorityColumnsVisible")&&inertMembers.push("`priorityColumnsVisible`"),this.storageKey&&inertMembers.push("`storageKey`"),inertMembers.length>0&&this.columns.length>0&&!this.columns.some(col=>col.priority)&&devWarnOnce(INERT_PRIORITY_COLUMN_CONFIG_WARNING,`<lr-table>: ${inertMembers.join(", ")} `+(inertMembers.length>1||labelsInert?"have":"has")+" no effect unless at least one column declares `priority`.")}const geometryChanged=changed.size===0||[...changed.keys()].some(key=>key!=="selectedRowKeys"&&key!=="selectionMode"&&key!=="activeRowKey"&&key!=="activeColKey"),base=this.renderRoot.querySelector('[part="base"]');if(base&&this.observeBase(base),this.observeTable(this.renderRoot.querySelector('[part="table"]')??void 0),geometryChanged&&this.observeHeaders(),this.restoreRovingFocus(),this.hasAlwaysOnEditors&&this.restoreAlwaysOnEditorFocus(),changed.has("editingCell"))if(this.editingCell){const{rowKey,columnKey}=this.editingCell;queueMicrotask(()=>this.editorElementFor(rowKey,columnKey)?.focus())}else{const previous=changed.get("editingCell");if(previous){const{rowKey,columnKey}=previous;queueMicrotask(()=>this.cellElementForToken(rowKey,columnKey)?.focus())}}geometryChanged&&queueMicrotask(()=>this.syncLayoutGeometry())}restoreRovingFocus(){const snapshot=this.rovingFocusSnapshot;if(this.rovingFocusSnapshot=null,snapshot===null)return;const internalActive=shadowFocusTarget(this);if(internalActive!==null&&internalActive!==snapshot.element)return;const documentActive=activeElementIn(this.ownerDocument);if(documentActive!==null&&documentActive!==this&&documentActive!==this.ownerDocument.body)return;const candidates=snapshot.kind==="header"?this.visibleHeaders():[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")],target=candidates.find(candidate=>snapshot.kind==="header"?candidate.dataset.colKey===snapshot.targetKey:candidate.dataset.rowKey===snapshot.targetKey)??candidates[Math.min(snapshot.index,candidates.length-1)]??null;snapshot.kind==="header"?this.focusHeader(target):this.focusRow(target)}activateColumn(key){this.activeColKey=key;const col=this.columnsByKey.get(key);if(!col?.sortable)return;const sortDir=this.sortKey===key?this.sortDir==="asc"?"desc":"asc":col.defaultSortDir??this.defaultSortDir,request=Object.freeze({phase:"request",sortKey:col.key,sortDir});this.emit("lr-sort-request",request,{cancelable:!0}).defaultPrevented||(this.sortMode==="client"&&(this.sortKey=col.key,this.sortDir=sortDir),this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:col.key,sortDir})))}commitSelectedKeys(next){next.size>this.maxRows&&(next=keySet(next,this.maxRows));const previous=this._selectedKeys;this.isRebind("selectedRowKeys",next,previous),this._selectedKeys=next,this.requestUpdate("selectedRowKeys",previous)}activateRow(key){this.activeRowKey=key;const entry=this.rowsByKey.get(key);if(entry===void 0)return;const{row,key:selectedKey}=entry;if(this.emit("lr-row-activate",Object.freeze({row})),this.selectionMode==="single"){this.commitSelectedKeys(new Set([selectedKey]));const rowKeys=this.asKeyList(Object.freeze([selectedKey]));this.emit("lr-selection-change",Object.freeze({selectedRowKeys:rowKeys}))}else if(this.selectionMode==="multiple"){const rawKey=selectedKey,next=new Set(this._selectedKeys);next.has(rawKey)?next.delete(rawKey):next.add(rawKey),this.commitSelectedKeys(next);const rowKeys=this.asKeyList(Object.freeze([...this._selectedKeys]));this.emit("lr-selection-change",Object.freeze({selectedRowKeys:rowKeys}))}}get hasAlwaysOnEditors(){return this.columns.some(col=>normalizedEditTrigger(col.editTrigger)==="always")}editorValue(row,column){const value=column.editValue?.(row)??row[column.key]??"";return String(value)}startEditing(rowKey,columnKey){const column=this.columnsByKey.get(columnKey);normalizedEditTrigger(column?.editTrigger)!=="double-click"||!this.rowsByKey.has(rowKey)||(this.editingCell={rowKey,columnKey})}commitEdit(event,rowKey,columnKey){event.stopPropagation();const field=event.currentTarget,entry=this.rowsByKey.get(rowKey),column=this.columnsByKey.get(columnKey),isTransient=this.editingCell?.rowKey===rowKey&&this.editingCell.columnKey===columnKey;if(!entry||!column||normalizedEditTrigger(column.editTrigger)===void 0){isTransient&&(this.editingCell=null);return}const value=column.editType==="number"&&field.value!==""?Number(field.value):field.value;this.emit("lr-cell-edit",Object.freeze({row:entry.row,columnKey,value})),isTransient&&(this.editingCell=null)}editorElementFor(rowKey,columnKey){return this.cellElementForToken(rowKey,columnKey)?.querySelector('[part="cell-editor"]')??null}restoreAlwaysOnEditorFocus(){const cell=this.focusedEditorCell;if(cell===null)return;const editor=this.editorElementFor(cell.rowKey,cell.columnKey);editor===null?this.focusedEditorCell=null:this.editorHadFocusBeforeUpdate&&shadowFocusTarget(this)!==editor&&editor.focus(),this.editorHadFocusBeforeUpdate=!1}activateExpandToggle(key){const entry=this.rowsByKey.get(encodeKey(key));if(entry===void 0)return;const expanded=!this._expandedKeys.has(key),detail=Object.freeze({row:entry.row,rowKey:key,expanded});if(this.expansionMode!=="single"&&this.expansionMode!=="multiple"){this.emit("lr-row-expand-toggle",detail);return}requestThenCommit({requestDetail:detail,emitRequest:(requestDetail,init)=>this.emit("lr-row-expand-request",requestDetail,init),commit:()=>{let next=this.expansionMode==="single"?new Set:new Set(this._expandedKeys);expanded?next.add(key):next.delete(key),next.size>this.maxRows&&(next=keySet(next,this.maxRows));const displaced=[...this._expandedKeys].filter(other=>other!==key&&!next.has(other)),previous=this._expandedKeys;this.isRebind("expandedRowKeys",next,previous),this._expandedKeys=next,this.requestUpdate("expandedRowKeys",previous);for(const other of displaced){const displacedEntry=this.rowsByKey.get(encodeKey(other));displacedEntry!==void 0&&this.emit("lr-row-expand-toggle",Object.freeze({row:displacedEntry.row,rowKey:other,expanded:!1}))}this.emit("lr-row-expand-toggle",Object.freeze({...detail,expanded:next.has(key)}))}})}rowElement(rowKey){return this.rowElementForToken(encodeKey(rowKey))}cellElement(rowKey,columnKey){return this.cellElementForToken(encodeKey(rowKey),columnKey)}editCell(rowKey,columnKey){const token=encodeKey(rowKey),trigger=normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger);if(!(trigger===void 0||!this.rowsByKey.has(token))){if(trigger==="always"){this.editorElementFor(token,columnKey)?.focus();return}this.startEditing(token,columnKey)}}expandedContentElement(rowKey){const token=encodeKey(rowKey);return[...this.renderRoot.querySelectorAll("tbody tr[data-expanded-row-key]")].find(el=>el.dataset.expandedRowKey===token)?.querySelector('[part="expanded-cell"]')??null}rowElementForToken(token){return[...this.renderRoot.querySelectorAll("tbody tr[data-row-key]")].find(el=>el.dataset.rowKey===token)??null}cellElementForToken(token,columnKey){return[...this.rowElementForToken(token)?.querySelectorAll("td[data-col-key]")??[]].find(el=>el.dataset.colKey===columnKey)??null}visibleHeaders(){return[...this.renderRoot?.querySelectorAll("th[data-col-key]")??[]].filter(el=>el.offsetParent!==null)}focusHeader(el){el?.dataset.colKey&&(this.activeColKey=el.dataset.colKey,el.focus())}focusRow(el){el?.dataset.rowKey&&(this.activeRowKey=el.dataset.rowKey,el.focus())}onHeaderKeyDown(e,th){if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateColumn(th.dataset.colKey);return}const headers=this.visibleHeaders(),index=headers.indexOf(th);if(index<0)return;const rtl=isRtl(this);switch(e.key){case"ArrowLeft":e.preventDefault(),this.focusHeader(headers[rtl?Math.min(headers.length-1,index+1):Math.max(0,index-1)]??null);return;case"ArrowRight":e.preventDefault(),this.focusHeader(headers[rtl?Math.max(0,index-1):Math.min(headers.length-1,index+1)]??null);return;case"Home":e.preventDefault(),this.focusHeader(headers[0]??null);return;case"End":e.preventDefault(),this.focusHeader(headers[headers.length-1]??null);return;case"ArrowDown":{e.preventDefault();const rows=[...this.renderRoot.querySelectorAll("[data-row-key]")],key=this.focusedRowKey();this.focusRow(rows.find(r=>r.dataset.rowKey===key)??rows[0]??null);return}default:return}}editableCellFor(target){const columnKey=target.dataset.colKey;return target.tagName!=="TD"||columnKey===void 0?null:normalizedEditTrigger(this.columnsByKey.get(columnKey)?.editTrigger)==="double-click"?{element:target,columnKey}:null}editableCellsInRow(tr){return[...tr.querySelectorAll("td[data-editable]")].filter(td=>td.offsetParent!==null&&!td.inert&&!td.closest("[inert]"))}onRowKeyDown(e,tr){const cell=this.editableCellFor(e.target);if((e.key==="Enter"||e.key==="F2")&&cell){e.preventDefault(),this.startEditing(tr.dataset.rowKey,cell.columnKey);return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.activateRow(tr.dataset.rowKey);return}if(e.key==="ArrowLeft"||e.key==="ArrowRight"){this.onRowLateralKeyDown(e,tr,cell);return}const bodyRows=[...this.renderRoot.querySelectorAll("[data-row-key]")],index=bodyRows.indexOf(tr);if(!(index<0))switch(e.key){case"ArrowDown":e.preventDefault(),this.focusRow(bodyRows[Math.min(bodyRows.length-1,index+1)]??null);return;case"ArrowUp":if(e.preventDefault(),index===0){const headers=this.visibleHeaders(),key=this.focusedColKey();this.focusHeader(headers.find(h=>h.dataset.colKey===key)??headers[0]??null)}else this.focusRow(bodyRows[index-1]??null);return;case"Home":e.preventDefault(),this.focusRow(bodyRows[0]??null);return;case"End":e.preventDefault(),this.focusRow(bodyRows[bodyRows.length-1]??null);return;default:return}}onRowLateralKeyDown(e,tr,cell){const cells=this.editableCellsInRow(tr);if(cells.length===0)return;e.preventDefault();const forward=e.key===(isRtl(this)?"ArrowLeft":"ArrowRight");if(cell===null){(forward?cells[0]:cells[cells.length-1])?.focus();return}const index=cells.indexOf(cell.element);forward?cells[index+1]?.focus():index<=0?this.focusRow(tr):cells[index-1]?.focus()}renderCellContent(col,row){const value=this.renderCellValue(col,row);if(typeof col.cellPart!="function")return value;const extraParts=cellContentPartNames(col.cellPart(row));return html`<div part="cell-content ${extraParts}">${value}</div>`}renderCellValue(col,row){return typeof col.cell=="function"?col.cell(row):(devWarnOnce(MISSING_CELL_RENDERER_WARNING,"<lr-table>: a column has no required `cell` renderer, so its cells render empty. Supply a `cell` callback for every column."),nothing)}renderCellEditor(row,col,rowKey,alwaysOn){const type=col.editType??"text",value=this.editorValue(row,col),label=col.editLabel?.(row)??this.localize("tableEditCell",void 0,{column:col.label}),onChange=event=>this.commitEdit(event,rowKey,col.key),onKeyDown=event=>this.onEditorKeyDown(event,rowKey,col.key);if(type==="select"){const options=col.editOptions??[];return html`<select
|
|
15
15
|
part="cell-editor"
|
|
16
16
|
aria-label=${label}
|
|
17
17
|
@change=${onChange}
|
|
@@ -173,7 +173,7 @@ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/nat
|
|
|
173
173
|
title=${cellTitle||nothing}
|
|
174
174
|
style=${tintedStyle&&Object.keys(tintedStyle).length?styleMap(tintedStyle):nothing}
|
|
175
175
|
>
|
|
176
|
-
${editing?this.renderCellEditor(row,col,token,alwaysOn):this.
|
|
176
|
+
${editing?this.renderCellEditor(row,col,token,alwaysOn):this.renderCellContent(col,row)}
|
|
177
177
|
</td>`})}
|
|
178
178
|
${hasRowTotal?html`<td part="row-total-cell">${this.rowTotal?.(row)}</td>`:nothing}
|
|
179
179
|
</tr>`,rowExpanded?html`<tr part="expanded-row" role="row" data-expanded-row-key=${token}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{raiseWhileOverlayOpen}from"../../../internal/open-overlay-raise.styles.js";import{dataStateRetryStyles,dataStateSurfaceStyles}from"../../../internal/data-state-renderer.styles.js";const styles=css` :host { display: block; inline-size: 100%; --_lr-table-heat-tint-lo-default: var(--lr-color-brand-quiet); --_lr-table-heat-tint-hi-default: var(--lr-color-brand); --_lr-table-resize-min-width-default: var(--lr-size-3rem); --_lr-table-resize-handle-opacity-default: 0.12; } [part='base'] { overflow: auto; max-block-size: var(--lr-table-max-height, none); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-table-radius, var(--lr-radius-container)); background: var(--lr-table-surface, var(--lr-color-surface)); scrollbar-width: var(--lr-theme-scrollbar-width, auto); scrollbar-gutter: var(--lr-theme-scrollbar-gutter, auto); } [part='row-limit'] { padding: var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } :host([scroll-mode='page']) [part='base'], :host([scroll-mode='auto']) [part='base']:not([data-scroll-overflow]) { overflow: visible; max-block-size: none; } :host([scroll-mode='page']) [part='base']:not([data-scroll-overflow]), :host([scroll-mode='auto']) [part='base']:not([data-scroll-overflow]) { overflow: clip; } [part='filter-label'] { display: flex; align-items: center; gap: var(--lr-space-s); padding: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-md-sm); } [part='filter'] { min-inline-size: 0; flex: 1; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; } [part='filter']:focus-visible { ${focusRing} } :where([part='filter']):hover { background: var(--lr-color-brand-quiet); } :where([part='filter']):active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='filter']::placeholder { color: var(--lr-color-text-quiet); opacity: 1; } [part='filter'][type='search']::-webkit-search-cancel-button, [part='filter'][type='search']::-webkit-search-decoration { appearance: none; } [part='filter-clear'] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; ${iconHitTarget} border: 0; border-radius: var(--lr-radius-xs); background: transparent; cursor: pointer; color: var(--lr-color-text-quiet); padding: var(--lr-space-xs); transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } [part='filter-clear']:hover { color: var(--lr-color-text); } [part='filter-clear']:active { color: var(--lr-color-text); background: color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='filter-clear']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-width)); } [part='loading']:not(.sr-only) { display: grid; place-items: center; min-block-size: var(--lr-size-8rem); padding: var(--lr-space-l); } [part='pagination'] { display: block; border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } [part='base'][data-hide-priority-low]:not([data-force-visible]) [data-priority='low'] { display: none; } [part='base'][data-hide-priority-medium]:not([data-force-visible]) [data-priority='medium'] { display: none; } [part='table'] { inline-size: 100%; border-collapse: collapse; font: inherit; font-size: var(--lr-table-font-size, inherit); } [part='table'][data-layout='fixed'] { table-layout: fixed; } [part='row'], [part='head'] > tr, [part='footer-row'] { block-size: max( var(--lr-size-24px), var(--lr-table-row-height, calc(var(--lr-table-row-min-height) * var(--_lr-density-control, 1))), var(--_lr-density-target-min, 0px) ); } [part='header-cell'] { position: sticky; inset-block-start: 0; background: var(--_lr-table-header-bg, var(--lr-table-surface, var(--lr-color-surface))); text-align: start; font-weight: var(--lr-font-weight-semibold); padding: var(--lr-table-cell-padding, var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); cursor: default; white-space: nowrap; } [part='header-cell'][data-resizable] { padding-inline-end: calc(var(--lr-space-s) + var(--lr-size-0-5rem)); } [part='resize-handle'] { position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: var(--lr-size-0-5rem); ${iconHitTarget} cursor: col-resize; touch-action: none; } [part='resize-handle']:hover, [part='resize-handle']:focus-visible { background: var(--lr-table-resize-handle-hover-bg, var(--lr-color-brand)); opacity: var( --lr-table-resize-handle-hover-opacity, var(--lr-table-resize-handle-opacity, var(--_lr-table-resize-handle-opacity-default)) ); } [part='resize-handle']:active, [part='resize-handle'][data-resizing] { background: var( --lr-table-resize-handle-active-bg, var(--lr-table-resize-handle-hover-bg, var(--lr-color-brand)) ); opacity: var( --lr-table-resize-handle-active-opacity, calc( var( --lr-table-resize-handle-hover-opacity, var(--lr-table-resize-handle-opacity, var(--_lr-table-resize-handle-opacity-default)) ) * 2 ) ); } [part='resize-handle']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * max(var(--lr-focus-ring-width), calc(var(--lr-focus-ring-width) + var(--lr-focus-ring-offset)))); } :where([part='header-cell'][aria-sort]:not([aria-sort='none'])), :where([part='header-cell'][data-sortable]) { cursor: pointer; } [part='header-cell']:where([aria-sort]:not([aria-sort='none'])) { --_lr-table-header-bg: var(--lr-table-header-sorted-bg, var(--lr-table-surface, var(--lr-color-surface))); background: var(--_lr-table-header-bg); color: var(--lr-table-header-sorted-color, inherit); } [part='header-cell'][data-sortable]:hover { background: var(--lr-color-brand-quiet); } [part='header-cell'][data-sortable]:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='header-cell']:focus-visible { ${focusRing} } [part='header-cell'][data-align='end'] { text-align: end; } [part~='sort-icon'] { display: inline-block; margin-inline-start: var(--lr-space-xs); vertical-align: middle; transition: transform var(--lr-transition-fast); } [part~='sort-icon-inactive'] { color: var(--lr-color-text-quiet); } @media (forced-colors: active) { [part~='sort-icon-inactive'] { color: CanvasText !important; } } [part~='sort-icon'] svg { display: block; } [part~='sort-icon'][data-dir='asc'] { transform: rotate(-90deg); } [part~='sort-icon'][data-dir='desc'] { transform: rotate(90deg); } @media (prefers-reduced-motion: reduce) { [part~='sort-icon'] { transition: none !important; } } [part='row'][data-stripe] { background: var(--lr-table-row-stripe-bg, transparent); --_lr-table-row-bg: var(--lr-table-row-stripe-bg, var(--lr-table-surface, var(--lr-color-surface))); } [part='row'][aria-selected='true'] { --_lr-table-row-bg: var(--lr-table-row-selected-bg, var(--lr-color-brand-quiet)); background: var(--_lr-table-row-bg); } [part='row']:hover { --_lr-table-row-bg: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); background: var(--_lr-table-row-bg); } [part='row']:active { --_lr-table-row-bg: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); background: var(--_lr-table-row-bg); } @media (forced-colors: active) { :where([part~='row'][aria-selected='true']) { outline: var(--lr-border-width-medium) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } :where([part~='row']:hover:not([aria-selected='true'])) { outline: var(--lr-border-width-thin) dashed Highlight; outline-offset: calc(-1 * var(--lr-border-width-thin)); } } [part='group-cell'] { padding: var(--lr-table-cell-padding-compact, var(--lr-space-xs) var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); background: var(--lr-color-surface-raised); color: var(--lr-color-text-quiet); font-weight: var(--lr-font-weight-semibold); text-align: start; } [part='row']:focus-visible { ${focusRing} } [part='cell'] { padding: var(--lr-table-cell-padding, var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); color: var(--lr-table-cell-color, inherit); } [part='cell'][data-editable] { transition: var(--lr-transition-interactive); } :where([part='cell'][data-editable]):hover { cursor: pointer; background: var(--lr-color-brand-quiet); } :where([part='cell'][data-editable]):active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='cell'][data-editable]:focus-visible { ${focusRing} } [part='cell'] a:where(:any-link) { color: var(--lr-table-cell-link-color, var(--lr-color-brand)); } [part='cell'] a:where(:any-link):hover, [part='cell'] a:where(:any-link):focus-visible, [part='cell'] a:where(:any-link):active { color: var( --lr-table-cell-link-hover-color, var(--lr-table-cell-link-color, var(--lr-color-brand)) ); text-decoration-thickness: var(--lr-border-width-medium); } [part='cell-editor'] { box-sizing: border-box; inline-size: 100%; min-inline-size: 0; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-brand); border-radius: var(--lr-radius-xs); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; } [part='cell-editor']:focus-visible { ${focusRing} } :where([part='cell-editor']):hover { background: var(--lr-color-brand-quiet); } :where([part='cell-editor']):active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='cell-editor'][type='number'] { appearance: textfield; } [part='cell-editor'][type='number']::-webkit-inner-spin-button, [part='cell-editor'][type='number']::-webkit-outer-spin-button { appearance: none; margin: 0; } select[part='cell-editor'] { appearance: none; padding-inline-end: calc(var(--lr-space-s) + var(--lr-size-0-75rem)); cursor: pointer; } select[part='cell-editor'] option { background: var(--lr-color-surface); color: var(--lr-color-text); } [part='cell']:has(> select[part='cell-editor']) { position: relative; } [part='cell']:has(> select[part='cell-editor'])::after { content: ''; position: absolute; inset-inline-end: var(--lr-space-s); inset-block-start: 50%; inline-size: var(--lr-size-0-75rem); block-size: var(--lr-size-0-75rem); color: var(--lr-color-text-quiet); background: currentColor; mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpolyline points="9 6 15 12 9 18"%3E%3C/polyline%3E%3C/svg%3E') center / contain no-repeat; transform: translateY(-50%) rotate(90deg); pointer-events: none; } @media (forced-colors: active) { [part='cell']:has(> select[part='cell-editor'])::after { forced-color-adjust: none; color: ButtonText; } } [part='cell'][data-align='end'] { text-align: end; } [part='row-total-cell'] { padding: var(--lr-table-cell-padding, var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); font-weight: var(--lr-font-weight-semibold); text-align: end; } [part='cell'][data-heat] { background: color-mix( in srgb, var(--lr-table-heat-tint-hi, var(--_lr-table-heat-tint-hi-default)) var(--lr-table-heat-t), var(--lr-table-heat-tint-lo, var(--_lr-table-heat-tint-lo-default)) ); } [part='expand-toggle-cell'] { padding: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); text-align: center; } [part='row-expand-toggle'] { display: inline-flex; align-items: center; justify-content: center; font: inherit; border: none; background: none; padding: var(--lr-space-xs); cursor: pointer; color: inherit; ${iconHitTarget} } [part='row-expand-toggle']:hover { background: var(--lr-color-brand-quiet); } [part='row-expand-toggle']:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='row-expand-toggle']:focus-visible { ${focusRing} } [part='row-expand-icon'] { display: inline-block; transition: transform var(--lr-transition-fast); } [part='row-expand-icon'] svg { display: block; } [part='row-expand-toggle'][aria-expanded='true'] [part='row-expand-icon'] { transform: rotate(90deg); } :host(:dir(rtl)) [part='row-expand-icon'] { transform: rotate(180deg); } :host(:dir(rtl)) [part='row-expand-toggle'][aria-expanded='true'] [part='row-expand-icon'] { transform: rotate(90deg); } @media (prefers-reduced-motion: reduce) { [part='row-expand-icon'] { transition: none !important; } } [part='expanded-row'] [part='expanded-cell'] { padding: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); background: var(--lr-table-surface, var(--lr-color-surface)); } [part='header-cell'][data-sticky], [part='cell'][data-sticky] { position: sticky; inset-inline-start: var(--lr-table-sticky-offset, 0); z-index: var(--lr-layer-content); box-shadow: var(--lr-size-1px) 0 0 0 var(--lr-color-border-subtle); } [part='cell'][data-sticky] { background: var(--_lr-table-row-bg, var(--lr-table-surface, var(--lr-color-surface))); } [part='header-cell'][data-sticky] { background: var(--_lr-table-header-bg, var(--lr-table-surface, var(--lr-color-surface))); } [part='header-cell'][data-sticky='end'], [part='cell'][data-sticky='end'] { inset-inline-start: auto; inset-inline-end: var(--lr-table-sticky-offset, 0); box-shadow: calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border-subtle); } :host(:dir(rtl)) [part='header-cell'][data-sticky], :host(:dir(rtl)) [part='cell'][data-sticky] { box-shadow: calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border-subtle); } :host(:dir(rtl)) [part='header-cell'][data-sticky='end'], :host(:dir(rtl)) [part='cell'][data-sticky='end'] { box-shadow: var(--lr-size-1px) 0 0 0 var(--lr-color-border-subtle); } ${raiseWhileOverlayOpen("[part='cell'][data-sticky]","var(--lr-layer-popover)","calc(var(--lr-layer-content) + 1)")} [part='foot'] { position: sticky; inset-block-end: 0; background: var(--lr-table-surface, var(--lr-color-surface)); } [part='footer-cell'] { padding: var(--lr-table-cell-padding-compact, var(--lr-space-xs) var(--lr-space-s)); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); font-weight: var(--lr-font-weight-semibold); text-align: start; } [part='footer-cell'][data-align='end'] { text-align: end; } [part='more-button'], [part='reveal-columns-button'] { display: block; inline-size: 100%; padding: var(--lr-space-s); border: none; background: none; color: var(--lr-color-brand); font: inherit; cursor: pointer; border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); } [part='more-button']:hover:where(:not([aria-disabled='true'])), [part='reveal-columns-button']:hover { background: var(--lr-color-brand-quiet); } [part='more-button']:active:where(:not([aria-disabled='true'])), [part='reveal-columns-button']:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='more-button']:focus-visible, [part='reveal-columns-button']:focus-visible { ${focusRing} } [part='more-button']:where([aria-disabled='true']) { cursor: progress; } ${dataStateSurfaceStyles("error")} ${dataStateRetryStyles} `;export{styles};
|
|
1
|
+
import{iconHitTarget,focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";import{raiseWhileOverlayOpen}from"../../../internal/open-overlay-raise.styles.js";import{dataStateRetryStyles,dataStateSurfaceStyles}from"../../../internal/data-state-renderer.styles.js";const styles=css` :host { display: block; inline-size: 100%; --_lr-table-heat-tint-lo-default: var(--lr-color-brand-quiet); --_lr-table-heat-tint-hi-default: var(--lr-color-brand); --_lr-table-resize-min-width-default: var(--lr-size-3rem); --_lr-table-resize-handle-opacity-default: 0.12; } [part='base'] { overflow: auto; max-block-size: var(--lr-table-max-height, none); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); border-radius: var(--lr-table-radius, var(--lr-radius-container)); background: var(--lr-table-surface, var(--lr-color-surface)); scrollbar-width: var(--lr-theme-scrollbar-width, auto); scrollbar-gutter: var(--lr-theme-scrollbar-gutter, auto); } [part='row-limit'] { padding: var(--lr-space-s); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-sm); } :host([scroll-mode='page']) [part='base'], :host([scroll-mode='auto']) [part='base']:not([data-scroll-overflow]) { overflow: visible; max-block-size: none; } :host([scroll-mode='page']) [part='base']:not([data-scroll-overflow]), :host([scroll-mode='auto']) [part='base']:not([data-scroll-overflow]) { overflow: clip; } [part='filter-label'] { display: flex; align-items: center; gap: var(--lr-space-s); padding: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-md-sm); } [part='filter'] { min-inline-size: 0; flex: 1; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; } [part='filter']:focus-visible { ${focusRing} } :where([part='filter']):hover { background: var(--lr-color-brand-quiet); } :where([part='filter']):active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='filter']::placeholder { color: var(--lr-color-text-quiet); opacity: 1; } [part='filter'][type='search']::-webkit-search-cancel-button, [part='filter'][type='search']::-webkit-search-decoration { appearance: none; } [part='filter-clear'] { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; ${iconHitTarget} border: 0; border-radius: var(--lr-radius-xs); background: transparent; cursor: pointer; color: var(--lr-color-text-quiet); padding: var(--lr-space-xs); transition: background-color var(--lr-transition-fast), color var(--lr-transition-fast); } [part='filter-clear']:hover { color: var(--lr-color-text); } [part='filter-clear']:active { color: var(--lr-color-text); background: color-mix( in oklab, var(--lr-color-surface), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='filter-clear']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * var(--lr-focus-ring-width)); } [part='loading']:not(.sr-only) { display: grid; place-items: center; min-block-size: var(--lr-size-8rem); padding: var(--lr-space-l); } [part='pagination'] { display: block; border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); } [part='base'][data-hide-priority-low]:not([data-force-visible]) [data-priority='low'] { display: none; } [part='base'][data-hide-priority-medium]:not([data-force-visible]) [data-priority='medium'] { display: none; } [part='table'] { inline-size: 100%; border-collapse: collapse; font: inherit; font-size: var(--lr-table-font-size, inherit); } [part='table'][data-layout='fixed'] { table-layout: fixed; } [part='row'], [part='head'] > tr, [part='footer-row'] { block-size: max( var(--lr-size-24px), var(--lr-table-row-height, calc(var(--lr-table-row-min-height) * var(--_lr-density-control, 1))), var(--_lr-density-target-min, 0px) ); } [part='header-cell'] { position: sticky; inset-block-start: 0; background: var(--_lr-table-header-bg, var(--lr-table-surface, var(--lr-color-surface))); text-align: start; font-weight: var(--lr-font-weight-semibold); padding: var(--lr-table-cell-padding, var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); cursor: default; white-space: nowrap; } [part='header-cell'][data-resizable] { padding-inline-end: calc(var(--lr-space-s) + var(--lr-size-0-5rem)); } [part='resize-handle'] { position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: var(--lr-size-0-5rem); ${iconHitTarget} cursor: col-resize; touch-action: none; } [part='resize-handle']:hover, [part='resize-handle']:focus-visible { background: var(--lr-table-resize-handle-hover-bg, var(--lr-color-brand)); opacity: var( --lr-table-resize-handle-hover-opacity, var(--lr-table-resize-handle-opacity, var(--_lr-table-resize-handle-opacity-default)) ); } [part='resize-handle']:active, [part='resize-handle'][data-resizing] { background: var( --lr-table-resize-handle-active-bg, var(--lr-table-resize-handle-hover-bg, var(--lr-color-brand)) ); opacity: var( --lr-table-resize-handle-active-opacity, calc( var( --lr-table-resize-handle-hover-opacity, var(--lr-table-resize-handle-opacity, var(--_lr-table-resize-handle-opacity-default)) ) * 2 ) ); } [part='resize-handle']:focus-visible { outline: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color); outline-offset: calc(-1 * max(var(--lr-focus-ring-width), calc(var(--lr-focus-ring-width) + var(--lr-focus-ring-offset)))); } :where([part='header-cell'][aria-sort]:not([aria-sort='none'])), :where([part='header-cell'][data-sortable]) { cursor: pointer; } [part='header-cell']:where([aria-sort]:not([aria-sort='none'])) { --_lr-table-header-bg: var(--lr-table-header-sorted-bg, var(--lr-table-surface, var(--lr-color-surface))); background: var(--_lr-table-header-bg); color: var(--lr-table-header-sorted-color, inherit); } [part='header-cell'][data-sortable]:hover { background: var(--lr-color-brand-quiet); } [part='header-cell'][data-sortable]:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='header-cell']:focus-visible { ${focusRing} } [part='header-cell'][data-align='end'] { text-align: end; } [part~='sort-icon'] { display: inline-block; margin-inline-start: var(--lr-space-xs); vertical-align: middle; transition: transform var(--lr-transition-fast); } [part~='sort-icon-inactive'] { color: var(--lr-color-text-quiet); } @media (forced-colors: active) { [part~='sort-icon-inactive'] { color: CanvasText !important; } } [part~='sort-icon'] svg { display: block; } [part~='sort-icon'][data-dir='asc'] { transform: rotate(-90deg); } [part~='sort-icon'][data-dir='desc'] { transform: rotate(90deg); } @media (prefers-reduced-motion: reduce) { [part~='sort-icon'] { transition: none !important; } } [part='row'][data-stripe] { background: var(--lr-table-row-stripe-bg, transparent); --_lr-table-row-bg: var(--lr-table-row-stripe-bg, var(--lr-table-surface, var(--lr-color-surface))); } [part='row'][aria-selected='true'] { --_lr-table-row-bg: var(--lr-table-row-selected-bg, var(--lr-color-brand-quiet)); background: var(--_lr-table-row-bg); } [part='row']:hover { --_lr-table-row-bg: color-mix(in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); background: var(--_lr-table-row-bg); } [part='row']:active { --_lr-table-row-bg: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); background: var(--_lr-table-row-bg); } @media (forced-colors: active) { :where([part~='row'][aria-selected='true']) { outline: var(--lr-border-width-medium) solid Highlight; outline-offset: calc(-1 * var(--lr-border-width-medium)); } :where([part~='row']:hover:not([aria-selected='true'])) { outline: var(--lr-border-width-thin) dashed Highlight; outline-offset: calc(-1 * var(--lr-border-width-thin)); } } [part='group-cell'] { padding: var(--lr-table-cell-padding-compact, var(--lr-space-xs) var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); background: var(--lr-color-surface-raised); color: var(--lr-color-text-quiet); font-weight: var(--lr-font-weight-semibold); text-align: start; } [part='row']:focus-visible { ${focusRing} } [part='cell'] { padding: var(--lr-table-cell-padding, var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); color: var(--lr-table-cell-color, inherit); } [part~='cell-content'] { display: block; min-inline-size: 0; } [part='cell'][data-editable] { transition: var(--lr-transition-interactive); } :where([part='cell'][data-editable]):hover { cursor: pointer; background: var(--lr-color-brand-quiet); } :where([part='cell'][data-editable]):active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='cell'][data-editable]:focus-visible { ${focusRing} } [part='cell'] a:where(:any-link) { color: var(--lr-table-cell-link-color, var(--lr-color-brand)); } [part='cell'] a:where(:any-link):hover, [part='cell'] a:where(:any-link):focus-visible, [part='cell'] a:where(:any-link):active { color: var( --lr-table-cell-link-hover-color, var(--lr-table-cell-link-color, var(--lr-color-brand)) ); text-decoration-thickness: var(--lr-border-width-medium); } [part='cell-editor'] { box-sizing: border-box; inline-size: 100%; min-inline-size: 0; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-brand); border-radius: var(--lr-radius-xs); background: var(--lr-color-surface); color: var(--lr-color-text); font: inherit; } [part='cell-editor']:focus-visible { ${focusRing} } :where([part='cell-editor']):hover { background: var(--lr-color-brand-quiet); } :where([part='cell-editor']):active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='cell-editor'][type='number'] { appearance: textfield; } [part='cell-editor'][type='number']::-webkit-inner-spin-button, [part='cell-editor'][type='number']::-webkit-outer-spin-button { appearance: none; margin: 0; } select[part='cell-editor'] { appearance: none; padding-inline-end: calc(var(--lr-space-s) + var(--lr-size-0-75rem)); cursor: pointer; } select[part='cell-editor'] option { background: var(--lr-color-surface); color: var(--lr-color-text); } [part='cell']:has(> select[part='cell-editor']) { position: relative; } [part='cell']:has(> select[part='cell-editor'])::after { content: ''; position: absolute; inset-inline-end: var(--lr-space-s); inset-block-start: 50%; inline-size: var(--lr-size-0-75rem); block-size: var(--lr-size-0-75rem); color: var(--lr-color-text-quiet); background: currentColor; mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpolyline points="9 6 15 12 9 18"%3E%3C/polyline%3E%3C/svg%3E') center / contain no-repeat; transform: translateY(-50%) rotate(90deg); pointer-events: none; } @media (forced-colors: active) { [part='cell']:has(> select[part='cell-editor'])::after { forced-color-adjust: none; color: ButtonText; } } [part='cell'][data-align='end'] { text-align: end; } [part='row-total-cell'] { padding: var(--lr-table-cell-padding, var(--lr-space-s)); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); font-weight: var(--lr-font-weight-semibold); text-align: end; } [part='cell'][data-heat] { background: color-mix( in srgb, var(--lr-table-heat-tint-hi, var(--_lr-table-heat-tint-hi-default)) var(--lr-table-heat-t), var(--lr-table-heat-tint-lo, var(--_lr-table-heat-tint-lo-default)) ); } [part='expand-toggle-cell'] { padding: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); text-align: center; } [part='row-expand-toggle'] { display: inline-flex; align-items: center; justify-content: center; font: inherit; border: none; background: none; padding: var(--lr-space-xs); cursor: pointer; color: inherit; ${iconHitTarget} } [part='row-expand-toggle']:hover { background: var(--lr-color-brand-quiet); } [part='row-expand-toggle']:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='row-expand-toggle']:focus-visible { ${focusRing} } [part='row-expand-icon'] { display: inline-block; transition: transform var(--lr-transition-fast); } [part='row-expand-icon'] svg { display: block; } [part='row-expand-toggle'][aria-expanded='true'] [part='row-expand-icon'] { transform: rotate(90deg); } :host(:dir(rtl)) [part='row-expand-icon'] { transform: rotate(180deg); } :host(:dir(rtl)) [part='row-expand-toggle'][aria-expanded='true'] [part='row-expand-icon'] { transform: rotate(90deg); } @media (prefers-reduced-motion: reduce) { [part='row-expand-icon'] { transition: none !important; } } [part='expanded-row'] [part='expanded-cell'] { padding: var(--lr-space-s); border-block-end: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); background: var(--lr-table-surface, var(--lr-color-surface)); } [part='header-cell'][data-sticky], [part='cell'][data-sticky] { position: sticky; inset-inline-start: var(--lr-table-sticky-offset, 0); z-index: var(--lr-layer-content); box-shadow: var(--lr-size-1px) 0 0 0 var(--lr-color-border-subtle); } [part='cell'][data-sticky] { background: var(--_lr-table-row-bg, var(--lr-table-surface, var(--lr-color-surface))); } [part='header-cell'][data-sticky] { background: var(--_lr-table-header-bg, var(--lr-table-surface, var(--lr-color-surface))); } [part='header-cell'][data-sticky='end'], [part='cell'][data-sticky='end'] { inset-inline-start: auto; inset-inline-end: var(--lr-table-sticky-offset, 0); box-shadow: calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border-subtle); } :host(:dir(rtl)) [part='header-cell'][data-sticky], :host(:dir(rtl)) [part='cell'][data-sticky] { box-shadow: calc(-1 * var(--lr-size-1px)) 0 0 0 var(--lr-color-border-subtle); } :host(:dir(rtl)) [part='header-cell'][data-sticky='end'], :host(:dir(rtl)) [part='cell'][data-sticky='end'] { box-shadow: var(--lr-size-1px) 0 0 0 var(--lr-color-border-subtle); } ${raiseWhileOverlayOpen("[part='cell'][data-sticky]","var(--lr-layer-popover)","calc(var(--lr-layer-content) + 1)")} [part='foot'] { position: sticky; inset-block-end: 0; background: var(--lr-table-surface, var(--lr-color-surface)); } [part='footer-cell'] { padding: var(--lr-table-cell-padding-compact, var(--lr-space-xs) var(--lr-space-s)); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); font-weight: var(--lr-font-weight-semibold); text-align: start; } [part='footer-cell'][data-align='end'] { text-align: end; } [part='more-button'], [part='reveal-columns-button'] { display: block; inline-size: 100%; padding: var(--lr-space-s); border: none; background: none; color: var(--lr-color-brand); font: inherit; cursor: pointer; border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); } [part='more-button']:hover:where(:not([aria-disabled='true'])), [part='reveal-columns-button']:hover { background: var(--lr-color-brand-quiet); } [part='more-button']:active:where(:not([aria-disabled='true'])), [part='reveal-columns-button']:active { background: color-mix( in oklab, var(--lr-color-brand-quiet), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part='more-button']:focus-visible, [part='reveal-columns-button']:focus-visible { ${focusRing} } [part='more-button']:where([aria-disabled='true']) { cursor: progress; } ${dataStateSurfaceStyles("error")} ${dataStateRetryStyles} `;export{styles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SET_TIMELINE_CLUSTER_PRESENTATION=Symbol.for("@aceshooting/lyra-ui/timeline/cluster-presentation/v1"),timeValueChanged=(value,old)=>value instanceof Date&&old instanceof Date?!Object.is(value.getTime(),old.getTime()):!Object.is(value,old),OBSERVE_TIMELINE_ITEM_TIMESTAMP=Symbol.for("@aceshooting/lyra-ui/timeline/timestamp-observer/v1");function isTimelineClusterItemContract(value){const candidate=value;return typeof candidate[SET_TIMELINE_CLUSTER_PRESENTATION]=="function"&&typeof candidate[OBSERVE_TIMELINE_ITEM_TIMESTAMP]=="function"}export{OBSERVE_TIMELINE_ITEM_TIMESTAMP,SET_TIMELINE_CLUSTER_PRESENTATION,isTimelineClusterItemContract,timeValueChanged};
|
|
1
|
+
const SET_TIMELINE_CLUSTER_PRESENTATION=Symbol.for("@aceshooting/lyra-ui/timeline/cluster-presentation/v1"),timeValueChanged=(value,old)=>value instanceof Date&&old instanceof Date?!Object.is(value.getTime(),old.getTime()):!Object.is(value,old),OBSERVE_TIMELINE_ITEM_TIMESTAMP=Symbol.for("@aceshooting/lyra-ui/timeline/timestamp-observer/v1");function isTimelineClusterItemContract(value){const candidate=value;return typeof candidate[SET_TIMELINE_CLUSTER_PRESENTATION]=="function"&&typeof candidate[OBSERVE_TIMELINE_ITEM_TIMESTAMP]=="function"}const SET_TIMELINE_ITEM_ORDINAL=Symbol.for("@aceshooting/lyra-ui/timeline/item-ordinal/v1"),TIMELINE_ITEM_ORDINAL_OF=Symbol.for("@aceshooting/lyra-ui/timeline/ordinal-of/v1");function isTimelineOrdinalItem(value){return typeof value[SET_TIMELINE_ITEM_ORDINAL]=="function"}function isTimelineOrdinalOwner(value){return value!==null&&typeof value[TIMELINE_ITEM_ORDINAL_OF]=="function"}export{OBSERVE_TIMELINE_ITEM_TIMESTAMP,SET_TIMELINE_CLUSTER_PRESENTATION,SET_TIMELINE_ITEM_ORDINAL,TIMELINE_ITEM_ORDINAL_OF,isTimelineClusterItemContract,isTimelineOrdinalItem,isTimelineOrdinalOwner,timeValueChanged};
|
|
@@ -52,8 +52,13 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
|
|
|
52
52
|
* (marker beside content), `column` in horizontal-timeline mode (marker above content).
|
|
53
53
|
* @csspart track - Wrapper around the marker and rail (the "spine"). Always the opposite axis from
|
|
54
54
|
* `[part="base"]` -- see the class doc's rail-mechanism note.
|
|
55
|
-
* @csspart marker - The dot/icon circle.
|
|
56
|
-
*
|
|
55
|
+
* @csspart marker - The dot/icon circle. `aria-hidden="true"` -- purely decorative, the item's
|
|
56
|
+
* accessible content is its title/timestamp/description text -- except inside an `ordered`
|
|
57
|
+
* `<lr-timeline>`, where it is a ring (`--lr-timeline-marker-color` border, transparent fill)
|
|
58
|
+
* around `marker-number`, is exposed to assistive technology, and replaces the `marker-icon`
|
|
59
|
+
* slot. Its default size there is `--lr-size-1-5rem`, and it widens for a long number.
|
|
60
|
+
* @csspart marker-number - The step number inside the marker, rendered only inside an `ordered`
|
|
61
|
+
* `<lr-timeline>`: real text formatted for the effective locale.
|
|
57
62
|
* @csspart rail - The connecting line segment extending from this item's marker toward the next
|
|
58
63
|
* item's marker. Hidden (`visibility: hidden`, not removed) for the last item in a
|
|
59
64
|
* `<lr-timeline>` -- see the class doc.
|
|
@@ -71,6 +76,8 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
|
|
|
71
76
|
* @cssprop [--lr-timeline-marker-size=var(--lr-size-1-25rem)] - Diameter of the marker circle
|
|
72
77
|
* (both inline-size and block-size, so the default dot stays circular). Inherits from theme
|
|
73
78
|
* ancestors.
|
|
79
|
+
* @cssprop [--lr-timeline-marker-number-color=var(--lr-color-text)] - Step-number colour inside an
|
|
80
|
+
* `ordered` timeline's marker ring.
|
|
74
81
|
* @cssprop [--lr-timeline-rail-width=var(--lr-border-width-medium)] - Thickness of the
|
|
75
82
|
* connecting rail line. Inherits from theme ancestors.
|
|
76
83
|
* @cssprop [--lr-timeline-rail-color=var(--lr-color-border-subtle)] - Color of the connecting rail
|
|
@@ -109,4 +116,4 @@ sync:boolean;private _variant;get variant():LyraVariant;set variant(value:LyraVa
|
|
|
109
116
|
/** Marks this as the current/in-progress item (e.g. "the agent is executing this step right now"),
|
|
110
117
|
* as opposed to a resolved past entry. Drives a pulsing marker (disabled under
|
|
111
118
|
* `prefers-reduced-motion: reduce`) and an explicit `aria-current` state on the host. */
|
|
112
|
-
active:boolean;private hasIconSlot;private hasTimestampSlot;private hasDescriptionSlot;private clusterPresentation?;private markerIconSlot?;private timestampSlotEl?;private descriptionSlotEl?;private readonly timestampObservers;private timestampObserversReady;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private get normalizedTimestamp();private onIconSlotChange;private collectIconSlotAssignment;private onTimestampSlotChange;private collectTimestampSlotAssignment;private onDescriptionSlotChange;private collectDescriptionSlotAssignment;protected firstUpdated(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-timeline-item':LyraTimelineItem;}}
|
|
119
|
+
active:boolean;private hasIconSlot;private hasTimestampSlot;private hasDescriptionSlot;private clusterPresentation?;private ordinal?;private markerIconSlot?;private timestampSlotEl?;private descriptionSlotEl?;private readonly timestampObservers;private timestampObserversReady;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private get normalizedTimestamp();private onIconSlotChange;private collectIconSlotAssignment;private onTimestampSlotChange;private collectTimestampSlotAssignment;private onDescriptionSlotChange;private collectDescriptionSlotAssignment;protected firstUpdated(changed:PropertyValues):void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-timeline-item':LyraTimelineItem;}}
|