@mndw/cli 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/meta.json +3 -3
- package/dist/mndw.js +5 -2
- package/host-dev/assets/{index-DhiLr-OP.js → index-CwQLpAUa.js} +3 -3
- package/host-dev/assets/{sandbox-url-ClgdqetH.js → sandbox-url-BRfzhk02.js} +1 -1
- package/host-dev/index.html +2 -2
- package/host-dev/shared/{mndw-ui@0.1.3.js → mndw-ui@0.1.4.js} +36 -6
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as o}from"./index-
|
|
1
|
+
import{s as o}from"./index-CwQLpAUa.js";import"/shared/mndw-ui@0.1.4.js";import"/shared/rxjs@7.8.2.js";import"/shared/rci-tools-core@0.6.0.js";const i="/@mndw-dev/plugin.js",s="/@mndw-dev/manifest.js",a="mndw:dev-plugin-update",m="mndw:dev-manifest-update",p=n=>import(n);function r(n=p){return{importPluginModule:()=>n(i),importManifestModule:async()=>await n(s)}}function _(n,e=window){const d=o(n,r());e.addEventListener(a,t=>{d.plugin(t.detail)}),e.addEventListener(m,t=>{d.manifest(t.detail)})}export{m as DEV_MANIFEST_UPDATE_EVENT,s as DEV_MANIFEST_URL,a as DEV_PLUGIN_UPDATE_EVENT,i as DEV_PLUGIN_URL,r as sandboxUrlImports,_ as setupSandboxUrlHmr};
|
package/host-dev/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"rxjs/operators": "/shared/rxjs-operators@7.8.2.js",
|
|
13
13
|
"hash-wasm": "/shared/hash-wasm@4.12.0.js",
|
|
14
14
|
"d3": "/shared/d3@7.9.0.js",
|
|
15
|
-
"@mndw/ui": "/shared/mndw-ui@0.1.
|
|
15
|
+
"@mndw/ui": "/shared/mndw-ui@0.1.4.js",
|
|
16
16
|
"vue": "/shared/vue@3.5.39.js",
|
|
17
17
|
"zone.js": "/shared/zone@0.15.1.js",
|
|
18
18
|
"@angular/core": "/shared/angular-core@21.2.18.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
</script>
|
|
26
|
-
<script type="module" crossorigin src="/assets/index-
|
|
26
|
+
<script type="module" crossorigin src="/assets/index-CwQLpAUa.js"></script>
|
|
27
27
|
<link rel="stylesheet" crossorigin href="/assets/index-D8Vmvhf6.css">
|
|
28
28
|
|
|
29
29
|
</head>
|
|
@@ -1341,23 +1341,53 @@ var yt=globalThis,St=yt.ShadowRoot&&(yt.ShadyCSS===void 0||yt.ShadyCSS.nativeSha
|
|
|
1341
1341
|
[part='option']:focus-visible {
|
|
1342
1342
|
${L}
|
|
1343
1343
|
}
|
|
1344
|
+
|
|
1345
|
+
[part='indicator'] {
|
|
1346
|
+
display: inline-grid;
|
|
1347
|
+
width: 1.125rem;
|
|
1348
|
+
height: 1.125rem;
|
|
1349
|
+
place-items: center;
|
|
1350
|
+
border: 1px solid var(--mndw-border);
|
|
1351
|
+
border-radius: var(--mndw-radius-sm);
|
|
1352
|
+
background: var(--mndw-surface);
|
|
1353
|
+
color: var(--mndw-accent-contrast);
|
|
1354
|
+
flex: 0 0 auto;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
[part='indicator'][data-checked='true'] {
|
|
1358
|
+
border-color: var(--mndw-accent);
|
|
1359
|
+
background: var(--mndw-accent);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
[part='checkmark'] {
|
|
1363
|
+
width: 0.3rem;
|
|
1364
|
+
height: 0.55rem;
|
|
1365
|
+
border: solid currentColor;
|
|
1366
|
+
border-width: 0 2px 2px 0;
|
|
1367
|
+
transform: translateY(-0.0625rem) rotate(45deg);
|
|
1368
|
+
}
|
|
1344
1369
|
`;workingHidden=new Set;constructor(){super(),this.columns=[],this.hiddenColumns=[]}connectedCallback(){super.connectedCallback(),this.workingHidden=new Set(this.hiddenColumns)}firstUpdated(){this.focusOption(0)}render(){return u`
|
|
1345
1370
|
<div
|
|
1346
1371
|
part="menu"
|
|
1347
1372
|
role="menu"
|
|
1348
1373
|
@keydown=${this.handleKeydown}
|
|
1349
1374
|
>
|
|
1350
|
-
${this.columns.map(e=>u`
|
|
1375
|
+
${this.columns.map(e=>{let t=!this.workingHidden.has(e.id);return u`
|
|
1351
1376
|
<button
|
|
1352
1377
|
type="button"
|
|
1353
1378
|
part="option"
|
|
1354
1379
|
role="menuitemcheckbox"
|
|
1355
1380
|
tabindex="-1"
|
|
1356
1381
|
data-column-id=${e.id}
|
|
1357
|
-
aria-checked=${String(
|
|
1382
|
+
aria-checked=${String(t)}
|
|
1358
1383
|
@click=${()=>this.toggle(e.id)}
|
|
1359
|
-
|
|
1360
|
-
|
|
1384
|
+
>
|
|
1385
|
+
<span part="indicator" data-checked=${String(t)} aria-hidden="true">
|
|
1386
|
+
${t?u`<span part="checkmark"></span>`:null}
|
|
1387
|
+
</span>
|
|
1388
|
+
${e.label}
|
|
1389
|
+
</button>
|
|
1390
|
+
`})}
|
|
1361
1391
|
</div>
|
|
1362
1392
|
`}toggle(e){this.workingHidden.has(e)?this.workingHidden.delete(e):this.workingHidden.add(e),this.requestUpdate(),this.dispatchEvent(new CustomEvent(Zr,{bubbles:!0,composed:!0,detail:{hidden:[...this.workingHidden]}}))}focusFirstOption(){this.focusOption(0)}focusOption(e){let t=[...this.renderRoot.querySelectorAll("button[data-column-id]")];t.length!==0&&t[(e%t.length+t.length)%t.length]?.focus()}handleKeydown=e=>{let t=[...this.renderRoot.querySelectorAll("button[data-column-id]")],r=t.indexOf(e.target);switch(e.key){case"ArrowDown":e.preventDefault(),this.focusOption(r+1);break;case"ArrowUp":e.preventDefault(),this.focusOption(r-1);break;case"Home":e.preventDefault(),this.focusOption(0);break;case"End":e.preventDefault(),this.focusOption(t.length-1);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.dismiss(!0);break;case"Tab":e.preventDefault(),this.dismiss(!1);break;default:break}};dismiss(e){this.dispatchEvent(new CustomEvent("mndwpaneldismiss",{bubbles:!0,composed:!0,detail:{restoreFocus:e}}))}};var Xt="mndwselectionchange",Qr="mndwsortchange",ei="mndwrowreorder",ti="mndwcolumnvisibilitychange",ri="mndwerror",ii="mndwrowexpand",W="__mndw_detail__";var Jt=class{entries=new Map;host;nextSlotId=1;constructor(e){this.host=e}reconcile(e,t,r,n,o,a=new Set,s){let l=new Set;for(let c of e)this.reconcileRow(c,t(c),r,n,o,l,a,s);this.pruneRemoved(l)}reconcileRow(e,t,r,n,o,a,s,l){let c=this.entries.get(t);c===void 0&&(c=new Map,this.entries.set(t,c));for(let d of r){if(d.renderer===void 0||!n.has(d.id))continue;a.add(`${t}\0${d.id}`);let h=c.get(d.id),m={node:h?.node??document.createElement("div"),row:e,value:o(d,e),colId:d.id};if(h?.rendererFactory===d.renderer){h.renderer.update(m);continue}h!==void 0&&(h.renderer.destroy(),h.node.remove());let f=d.renderer(),p=m.node;p.setAttribute("slot",`mc-${this.nextSlotId++}`),this.host.appendChild(p);let S={slotId:p.getAttribute("slot")??"",node:p,renderer:f,rendererFactory:d.renderer,rowKey:t,colId:d.id};f.mount({node:p,row:e,value:m.value,colId:d.id}),c.set(d.id,S)}if(l!==void 0&&s.has(t)){a.add(`${t}\0${W}`);let d=c.get(W),h={node:d?.node??document.createElement("div"),row:e,value:e,colId:W};if(d?.rendererFactory===l)d.renderer.update(h);else{d!==void 0&&(d.renderer.destroy(),d.node.remove());let m=l(),f=h.node;f.setAttribute("slot",`mc-${this.nextSlotId++}`),this.host.appendChild(f),m.mount({node:f,row:e,value:e,colId:W}),c.set(W,{slotId:f.getAttribute("slot")??"",node:f,renderer:m,rendererFactory:l,rowKey:t,colId:W})}}}pruneRemoved(e){for(let[t,r]of this.entries){for(let[n,o]of r)e.has(`${t}\0${n}`)||(o.renderer.destroy(),o.node.remove(),r.delete(n));r.size===0&&this.entries.delete(t)}}getSlotId(e,t){return this.entries.get(e)?.get(t)?.slotId}getRowKeyForNode(e){for(let[t,r]of this.entries)for(let n of r.values())if(n.node===e||n.node.contains(e))return t}drain(){for(let e of this.entries.values())for(let t of e.values())t.renderer.destroy(),t.node.remove();this.entries.clear()}};function En(i){for(let e=i.length-1;e>=0;e-=1){let t=i[e]?.rowKey;if(t!==void 0)return t}}var Tn=new WeakMap;function Mn(i,e){Tn.set(i,e)}function Zt(i){return Tn.get(i)}function An(){return{createResizeObserver(i){return typeof ResizeObserver>"u"?null:new ResizeObserver(i)},requestAnimationFrame(i){return requestAnimationFrame(i)},cancelAnimationFrame(i){cancelAnimationFrame(i)},measure(i){return i.getBoundingClientRect()},getViewportScrollTop(i){return i.scrollTop},setViewportScrollTop(i,e){i.scrollTop=e},getViewportClientHeight(i){return i.clientHeight},getViewportContentWidth(i){return i.clientWidth}}}function ue(i){return i!==void 0&&Number.isFinite(i)&&i>0}function Rn(i,e){return ue(i)?i:e}function kn(i){let e=Rn(i.estimatedRowHeight,1),t=Rn(i.detailEstimate,1);return i.keys.map(r=>{let n=i.measurements.get(r),o=ue(n?.summary)?n.summary:e,a=i.expandedKeys.has(r)?ue(n?.detail)?n.detail:t:0;return o+a})}function _n(i){let e=[0];for(let t of i)e.push(e[e.length-1]+t);return e}function Pn(i,e){let t=0,r=i.length-1;for(;t<r;){let n=Math.floor((t+r)/2);i[n+1]<e?t=n+1:r=n}return Math.min(t,i.length-2)}function fa(i,e){let t=0,r=i.length-2;for(;t<r;){let n=Math.ceil((t+r)/2);i[n]<=e?t=n:r=n-1}return Math.max(0,t)}function Ln(i){if(i.keys.length===0)return{start:0,end:0,paddingBefore:0,paddingAfter:0,totalHeight:0};let e=_n(kn(i)),t=e[e.length-1],r=Math.max(0,Number.isFinite(i.scrollOffset)?i.scrollOffset:0),n=Math.max(0,Number.isFinite(i.viewportHeight)?i.viewportHeight:0),o=Math.max(0,Number.isFinite(i.overscan)?i.overscan:0),a=Math.max(0,r-o),s=r+n+o,l=Pn(e,a),c=fa(e,s),d=Math.max(l+1,c+1);return{start:l,end:d,paddingBefore:e[l],paddingAfter:Math.max(0,t-e[d]),totalHeight:t}}var Qt=class{config;keys=[];expandedKeys=new Set;measurements=new Map;prefix=[0];prefixDirty=!0;bootstrapSamples=new Map;frozenMean;initialCohortKeys;constructor(e){this.config={...e}}configure(e){let t=this.config.estimatedRowHeight!==e.estimatedRowHeight||this.config.detailEstimate!==e.detailEstimate;this.config={...e},t&&this.frozenMean===void 0&&this.bootstrapSamples.size<4&&(this.prefixDirty=!0)}setRows(e,t){this.keys=[...e],this.expandedKeys=new Set(t),this.removeMissingKeys(new Set(this.keys)),this.prefixDirty=!0}recordSummaryMeasurement(e,t){if(!this.keys.includes(e)||!ue(t))return!1;let r=this.measurements.get(e)?.summary;if(ue(r)&&Math.abs(r-t)<=.25)return!1;let n=this.measurements.get(e)??{};return n.summary=t,this.measurements.set(e,n),this.prefixDirty=!0,this.frozenMean===void 0&&(this.bootstrapSamples.set(e,t),this.freezeBootstrapIfReady()),!0}recordDetailMeasurement(e,t){if(!this.keys.includes(e)||!ue(t))return!1;let r=this.measurements.get(e)?.detail;if(ue(r)&&Math.abs(r-t)<=.25)return!1;let n=this.measurements.get(e)??{};return n.detail=t,this.measurements.set(e,n),this.prefixDirty=!0,!0}clearDetailMeasurement(e){let t=this.measurements.get(e);return t?.detail===void 0?!1:(delete t.detail,t.summary===void 0&&this.measurements.delete(e),this.prefixDirty=!0,!0)}removeMissingKeys(e){for(let t of this.measurements.keys())e.has(t)||this.measurements.delete(t);for(let t of this.bootstrapSamples.keys())e.has(t)||this.bootstrapSamples.delete(t);if(this.initialCohortKeys!==void 0)for(let t of this.initialCohortKeys)e.has(t)||this.initialCohortKeys.delete(t);this.prefixDirty=!0}resetWidthEpoch(){this.measurements.clear(),this.bootstrapSamples.clear(),this.frozenMean=void 0,this.initialCohortKeys=void 0,this.prefixDirty=!0}effectiveSummaryEstimate(){return this.frozenMean!==void 0?this.frozenMean:this.bootstrapSamples.size>=4?this.runningMean():this.config.estimatedRowHeight}range(e,t,r){if(this.initialCohortKeys===void 0&&this.keys.length>0){let n=Ln(this.input(e,t,r));this.initialCohortKeys=new Set(this.keys.slice(n.start,n.end))}return Ln(this.input(e,t,r))}offsetOf(e){let t=this.keys.indexOf(e);if(!(t<0))return this.ensurePrefix(),this.prefix[t]}captureAnchor(e){if(this.keys.length===0)return;this.ensurePrefix();let t=Math.max(0,e),r=Math.min(this.keys.length-1,Pn(this.prefix,t));return{key:this.keys[r],logicalIndex:r,intraRowOffset:Math.max(0,t-this.prefix[r])}}restoreAnchor(e,t){this.ensurePrefix();let r=this.keys.indexOf(e.key),n=r>=0?r:Math.min(Math.max(e.logicalIndex,0),Math.max(0,this.keys.length-1)),o=this.prefix[n]+e.intraRowOffset;return Math.min(Math.max(0,t),Math.max(0,o))}offsetForRow(e,t,r,n){let o=this.keys.indexOf(e);if(o<0)return;this.ensurePrefix();let a=this.prefix[o],s=this.prefix[o+1],l=s-a,c=Math.max(0,r),d=Math.max(0,n);return t==="center"?Math.max(0,a-(c-l)/2):t==="end"?Math.max(0,s-c):t==="nearest"?a<d?a:s>d+c?Math.max(0,s-c):d:a}input(e,t,r){return{keys:this.keys,expandedKeys:this.expandedKeys,measurements:this.measurements,estimatedRowHeight:this.effectiveSummaryEstimate(),detailEstimate:this.config.detailEstimate,scrollOffset:e,viewportHeight:t,overscan:r}}ensurePrefix(){this.prefixDirty&&(this.prefix=_n(kn(this.input(0,0,0))),this.prefixDirty=!1)}runningMean(){let e=0;for(let t of this.bootstrapSamples.values())e+=t;return e/this.bootstrapSamples.size}freezeBootstrapIfReady(){if(this.bootstrapSamples.size<4)return;let e=this.initialCohortKeys!==void 0&&this.initialCohortKeys.size>=4&&[...this.initialCohortKeys].every(t=>this.bootstrapSamples.has(t));(this.bootstrapSamples.size>=16||e)&&(this.frozenMean=this.runningMean())}};function A(i,e){if(typeof i=="function")return i(e);let t=e[i];return typeof t=="string"?t:""}function $n(i,e){let t=[],r=new Set,n=new Set,o=0;for(let s of i){let l=A(e,s);if(l===""){o++;continue}if(r.has(l)){n.add(l);continue}r.add(l),t.push(s)}let a=[];return n.size>0&&a.push({category:"duplicate-row-key",rowKeys:[...n]}),o>0&&a.push({category:"empty-row-key",count:o}),{rows:t,violations:a}}function On(i){let e=[],t=new Set,r=new Set;for(let o of i)t.has(o.id)&&r.add(o.id),t.add(o.id);r.size>0&&e.push({category:"duplicate-column-id",columnIds:[...r]});let n=i.map(o=>o.id).filter(o=>o.startsWith("__mndw_"));return n.length>0&&e.push({category:"reserved-column-id",columnIds:n}),e}function In(i,e){return i.find(t=>t.id===e)}function tr(i,e){let t=i.accessor;return t===void 0?e[i.id]:typeof t=="function"?t(e):e[t]}function Fn(i,e,t){return e==null||In(i,e.columnId)?.sortable!==!0||t.has(e.columnId)?null:e}function Hn(i,e){return i?.columnId!==e?{columnId:e,direction:"asc"}:i.direction==="asc"?{columnId:e,direction:"desc"}:null}function Dn(i){return i==null||typeof i=="number"&&Number.isNaN(i)}function va(i,e,t){let r=i.localeCompare(e,t,{sensitivity:"base"});return r!==0?r:i.localeCompare(e,t,{sensitivity:"case"})}function ga(i,e,t,r="en"){return i.comparator!==void 0?i.comparator(e,t):i.kind==="number"||i.kind==="boolean"?Number(e)-Number(t):va(String(e),String(t),r)}function Vn(i,e,t,r="en"){if(t==null)return i;let n=In(e,t.columnId);if(n?.sortable!==!0)return i;let o=t.direction==="desc"?-1:1,a=i.map((s,l)=>({row:s,index:l,value:tr(n,s)}));return a.sort((s,l)=>{let c=Dn(s.value),d=Dn(l.value);if(c&&d)return s.index-l.index;if(c)return 1;if(d)return-1;let h=ga(n,s.value,l.value,r);return h!==0?h*o:s.index-l.index}),a.map(s=>s.row)}function rr(i,e){if(e.length===0)return"none";let t=0;for(let r of e)i.has(r)&&t++;return t===e.length?"all":t===0?"none":"indeterminate"}function zn(i,e){let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),[...t]}function Un(i,e){let t=new Set(i);if(rr(t,e)==="all")for(let n of e)t.delete(n);else for(let n of e)t.add(n);return[...t]}function Nn(i){return new Set(i.filter(e=>e.hideable!==!1).map(e=>e.id))}function wa(i,e){let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),t}var er=class{internalHidden=new Set;seededIds=new Set;lastEffective=new Set;wasControlled=!1;effectiveHidden(e,t){this.seed(e);let r=Nn(e);if(t!==void 0){let o=new Set;for(let a of t)r.has(a)&&o.add(a);return this.lastEffective=new Set(o),this.wasControlled=!0,o}this.wasControlled&&(this.internalHidden=new Set(this.lastEffective),this.wasControlled=!1);let n=new Set;for(let o of this.internalHidden)r.has(o)&&n.add(o);return n}toggle(e,t,r){let n=this.effectiveHidden(e,t),o=wa(n,r),a=Nn(e),s=[...o].filter(l=>a.has(l));return t===void 0&&(this.internalHidden=new Set(s)),s}applyInternal(e){this.internalHidden=new Set(e),this.wasControlled=!1}seed(e){for(let t of e)this.seededIds.has(t.id)||(this.seededIds.add(t.id),t.hidden===!0&&this.internalHidden.add(t.id))}};var mt="mndw-table",he={bubbles:!0,composed:!0,cancelable:!1};function ir(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??""))}function J(i){return i.length>0?i.join(" "):b}function ya(){return{selectRow:i=>ir(w("table.selectRow"),{rowName:i}),selectAll:w("table.selectAll"),sortBy:i=>ir(w("table.sortBy"),{column:i}),columnMenu:w("table.columnMenu"),rowFallback:i=>ir(w("table.rowFallback"),{index:i}),reordered:(i,e,t)=>ir(w("table.reordered"),{rowName:i,pos:e,total:t}),invalidData:w("table.invalidData"),expandRow:i=>`Expand ${i}`,collapseRow:i=>`Collapse ${i}`}}var bt=class i extends g{static properties={columns:{type:Array,attribute:!1},rows:{type:Array,attribute:!1},rowKey:{type:String,attribute:"row-key"},virtual:{type:Boolean,reflect:!0},estimatedRowHeight:{type:Number,attribute:"estimated-row-height",reflect:!0},overscan:{type:Number,attribute:"overscan",reflect:!0},selectable:{type:Boolean,reflect:!0},selected:{type:Array,attribute:!1},reorderable:{type:Boolean,reflect:!0},expandable:{type:Boolean,attribute:!1},expandOn:{type:String,attribute:"expand-on"},toggleCell:{type:String,attribute:"toggle-cell"},toggleAfterColumn:{type:String,attribute:"toggle-after-column"},expanded:{type:Array,attribute:!1},expandedRenderer:{type:Object,attribute:!1},sort:{type:Object,attribute:!1},sortMode:{type:String,attribute:"sort-mode"},hiddenColumns:{type:Array,attribute:!1},columnMenu:{type:Boolean,attribute:!1},columnMenuPanelClass:{type:String,attribute:"column-menu-panel-class"},caption:{type:String},rowLabel:{type:Object,attribute:!1},labels:{type:Object,attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},layout:{type:String,reflect:!0},minWidth:{type:String,attribute:"min-width"},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0}};static styles=v`
|
|
1363
1393
|
:host {
|
|
@@ -1579,7 +1609,7 @@ var yt=globalThis,St=yt.ShadowRoot&&(yt.ShadyCSS===void 0||yt.ShadyCSS.nativeSha
|
|
|
1579
1609
|
[part='column-menu-trigger']:focus-visible {
|
|
1580
1610
|
${L}
|
|
1581
1611
|
}
|
|
1582
|
-
`;visibilityState=new er;geometryProvider;virtualizer=null;resizeObserver=null;observedElements=new Set;observedViewport=null;pendingGeometryFrame=null;observerAttempted=!1;warnedInactiveReason=null;warnedStickyReason=null;pinState={byKey:new Map,inactiveReason:null,inactiveColumnId:null};lastViewportContentWidth;pendingScrollTarget=null;expectedProgrammaticScrollTop;cellRegistry=null;localeController=new k(this);menuLayer=null;effectiveColumns=[];displayRows=[];effectiveHidden=new Set;effectiveSortState=null;selectedKeySet=new Set;lastCellReconcileSignature=null;lastExpandedKeys=new Set;windowRows=[];virtualRange=null;violations=[];lastViolationSignature="";optimisticOrder=null;dragKey=null;announceText="";static WIDTH_EPSILON=1;static UTILITY_COL_WIDTH="2.5rem";static PIN_KEYS={expandLead:"__mndw_pin_expandLead",select:"__mndw_pin_select",drag:"__mndw_pin_drag"};constructor(e){super(),this.geometryProvider=e??An(),this.columns=[],this.rows=[],this.rowKey="id",this.virtual=!1,this.estimatedRowHeight=49,this.overscan=400,this.selectable=!1,this.selected=[],this.reorderable=!1,this.expandable=!1,this.expandOn="toggle",this.toggleCell="leading",this.toggleAfterColumn=void 0,this.expanded=[],this.expandedRenderer=void 0,this.sort=null,this.sortMode="client",this.hiddenColumns=void 0,this.columnMenu=!0,this.columnMenuPanelClass="",this.caption="",this.rowLabel=void 0,this.labels=void 0,this.emptyLabel="",this.layout="fixed",this.minWidth="",this.stickyHeader=!1,this.addEventListener("mndwchange",this.handleCheckboxChange),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}connectedCallback(){super.connectedCallback(),this.observerAttempted=!1,this.cellRegistry=new Jt(this),this.lastCellReconcileSignature=null}disconnectedCallback(){this.teardownGeometry(),this.closeColumnMenu(),this.cellRegistry?.drain(),this.cellRegistry=null,super.disconnectedCallback()}willUpdate(e){!this.hasUpdated||e.size>0?this.reconcileState(!0):this.updateVirtualWindow(),this.unobserveStaleGeometryTargets()}reconcileState(e){let t=this.effectiveSortState,r=this.logicalStructureSignature(this.displayRows,this.lastExpandedKeys),n=this.captureCurrentAnchor();this.configureGeometryMode(),this.configureLayoutMode();let o=On(this.columns),{rows:a,violations:s}=$n(this.rows,this.rowKey);this.violations=[...o,...s],this.emitErrorIfChanged(),this.effectiveColumns=this.columns.filter((m,f,p)=>p.findIndex(S=>S.id===m.id)===f).filter(m=>!m.id.startsWith("__mndw_")),this.effectiveHidden=this.visibilityState.effectiveHidden(this.effectiveColumns,this.hiddenColumns),this.effectiveSortState=Fn(this.effectiveColumns,this.sort,this.effectiveHidden),this.pinState=this.computePinState(),this.applyStickyInactive(this.pinState);let l=!this.sameSortState(t,this.effectiveSortState),c=new Set(this.effectiveColumns.filter(m=>!this.effectiveHidden.has(m.id)).map(m=>m.id));this.optimisticOrder!==null?this.displayRows=this.optimisticOrder:this.sortMode==="client"&&this.effectiveSortState!==null?this.displayRows=Vn(a,this.effectiveColumns,this.effectiveSortState,this.locale()):this.displayRows=a;let d=this.expandedSet();this.selectedKeySet=new Set(this.selected);let h=r!==this.logicalStructureSignature(this.displayRows,d);if(this.isVirtualRenderingActive()){let m=this.getVirtualizer(),f=this.displayRows.map(p=>A(this.rowKey,p));for(let p of this.lastExpandedKeys)d.has(p)||m.clearDetailMeasurement(p);if(m.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),m.setRows(f,d),this.updateVirtualWindow(!1),l){let p=this.viewportElement(),S=this.headerElement();p!==null&&S!==null&&(this.pendingScrollTarget=null,this.writeBodyScrollOffset(p,S,0),this.updateVirtualWindow(!1))}else if(h&&n!==void 0){let p=this.viewportElement(),S=this.headerElement();if(p!==null&&S!==null){let T=m.range(this.bodyScrollOffset(p,S),this.geometryProvider.getViewportClientHeight(p),this.normalizedOverscan()),R=Math.max(0,T.totalHeight-this.geometryProvider.getViewportClientHeight(p)),M=m.restoreAnchor(n,R);this.writeBodyScrollOffset(p,S,M),this.updateVirtualWindow(!1)}}this.lastExpandedKeys=new Set(d)}else this.virtualRange=null,this.windowRows=this.displayRows;this.pendingScrollTarget!==null&&!this.displayRows.some(m=>A(this.rowKey,m)===this.pendingScrollTarget?.key)&&(this.pendingScrollTarget=null),this.reconcileVisibleCells(e,c)}updated(e){if(
|
|
1612
|
+
`;visibilityState=new er;geometryProvider;virtualizer=null;resizeObserver=null;observedElements=new Set;observedViewport=null;pendingGeometryFrame=null;observerAttempted=!1;warnedInactiveReason=null;warnedStickyReason=null;pinState={byKey:new Map,inactiveReason:null,inactiveColumnId:null};lastViewportContentWidth;pendingScrollTarget=null;expectedProgrammaticScrollTop;cellRegistry=null;localeController=new k(this);menuLayer=null;effectiveColumns=[];displayRows=[];effectiveHidden=new Set;internalVisibilityNeedsReconcile=!1;effectiveSortState=null;selectedKeySet=new Set;lastCellReconcileSignature=null;lastExpandedKeys=new Set;windowRows=[];virtualRange=null;violations=[];lastViolationSignature="";optimisticOrder=null;dragKey=null;announceText="";static WIDTH_EPSILON=1;static UTILITY_COL_WIDTH="2.5rem";static PIN_KEYS={expandLead:"__mndw_pin_expandLead",select:"__mndw_pin_select",drag:"__mndw_pin_drag"};constructor(e){super(),this.geometryProvider=e??An(),this.columns=[],this.rows=[],this.rowKey="id",this.virtual=!1,this.estimatedRowHeight=49,this.overscan=400,this.selectable=!1,this.selected=[],this.reorderable=!1,this.expandable=!1,this.expandOn="toggle",this.toggleCell="leading",this.toggleAfterColumn=void 0,this.expanded=[],this.expandedRenderer=void 0,this.sort=null,this.sortMode="client",this.hiddenColumns=void 0,this.columnMenu=!0,this.columnMenuPanelClass="",this.caption="",this.rowLabel=void 0,this.labels=void 0,this.emptyLabel="",this.layout="fixed",this.minWidth="",this.stickyHeader=!1,this.addEventListener("mndwchange",this.handleCheckboxChange),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}connectedCallback(){super.connectedCallback(),this.observerAttempted=!1,this.cellRegistry=new Jt(this),this.lastCellReconcileSignature=null}disconnectedCallback(){this.teardownGeometry(),this.closeColumnMenu(),this.cellRegistry?.drain(),this.cellRegistry=null,super.disconnectedCallback()}willUpdate(e){!this.hasUpdated||e.size>0||this.internalVisibilityNeedsReconcile?(this.internalVisibilityNeedsReconcile=!1,this.reconcileState(!0)):this.updateVirtualWindow(),this.unobserveStaleGeometryTargets()}reconcileState(e){let t=this.effectiveSortState,r=this.logicalStructureSignature(this.displayRows,this.lastExpandedKeys),n=this.captureCurrentAnchor();this.configureGeometryMode(),this.configureLayoutMode();let o=On(this.columns),{rows:a,violations:s}=$n(this.rows,this.rowKey);this.violations=[...o,...s],this.emitErrorIfChanged(),this.effectiveColumns=this.columns.filter((m,f,p)=>p.findIndex(S=>S.id===m.id)===f).filter(m=>!m.id.startsWith("__mndw_")),this.effectiveHidden=this.visibilityState.effectiveHidden(this.effectiveColumns,this.hiddenColumns),this.effectiveSortState=Fn(this.effectiveColumns,this.sort,this.effectiveHidden),this.pinState=this.computePinState(),this.applyStickyInactive(this.pinState);let l=!this.sameSortState(t,this.effectiveSortState),c=new Set(this.effectiveColumns.filter(m=>!this.effectiveHidden.has(m.id)).map(m=>m.id));this.optimisticOrder!==null?this.displayRows=this.optimisticOrder:this.sortMode==="client"&&this.effectiveSortState!==null?this.displayRows=Vn(a,this.effectiveColumns,this.effectiveSortState,this.locale()):this.displayRows=a;let d=this.expandedSet();this.selectedKeySet=new Set(this.selected);let h=r!==this.logicalStructureSignature(this.displayRows,d);if(this.isVirtualRenderingActive()){let m=this.getVirtualizer(),f=this.displayRows.map(p=>A(this.rowKey,p));for(let p of this.lastExpandedKeys)d.has(p)||m.clearDetailMeasurement(p);if(m.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),m.setRows(f,d),this.updateVirtualWindow(!1),l){let p=this.viewportElement(),S=this.headerElement();p!==null&&S!==null&&(this.pendingScrollTarget=null,this.writeBodyScrollOffset(p,S,0),this.updateVirtualWindow(!1))}else if(h&&n!==void 0){let p=this.viewportElement(),S=this.headerElement();if(p!==null&&S!==null){let T=m.range(this.bodyScrollOffset(p,S),this.geometryProvider.getViewportClientHeight(p),this.normalizedOverscan()),R=Math.max(0,T.totalHeight-this.geometryProvider.getViewportClientHeight(p)),M=m.restoreAnchor(n,R);this.writeBodyScrollOffset(p,S,M),this.updateVirtualWindow(!1)}}this.lastExpandedKeys=new Set(d)}else this.virtualRange=null,this.windowRows=this.displayRows;this.pendingScrollTarget!==null&&!this.displayRows.some(m=>A(this.rowKey,m)===this.pendingScrollTarget?.key)&&(this.pendingScrollTarget=null),this.reconcileVisibleCells(e,c)}updated(e){if(this.menuLayer?.reposition(),!this.isVirtualRenderingActive()){this.teardownGeometry();return}this.syncGeometryTargets(),this.scheduleGeometryFrame()}render(){let e=this.resolveLabels(),t=this.displayRows.length===0&&this.emptyLabel;return u`
|
|
1583
1613
|
${this.violations.length>0?u`<div part="error" role="alert">${e.invalidData}</div>`:b}
|
|
1584
1614
|
${t?u`<div part="empty">${this.emptyLabel}</div>`:u`
|
|
1585
1615
|
<div class="mndw-table-viewport" part="viewport" tabindex="-1">
|
|
@@ -1703,7 +1733,7 @@ var yt=globalThis,St=yt.ShadowRoot&&(yt.ShadyCSS===void 0||yt.ShadyCSS.nativeSha
|
|
|
1703
1733
|
data-row-key=${e.rowKey??b}
|
|
1704
1734
|
.checked=${e.checked}
|
|
1705
1735
|
.indeterminate=${e.indeterminate}
|
|
1706
|
-
></mndw-checkbox>`}expandedSet(){return new Set(this.expanded)}getVirtualizer(){return this.virtualizer===null&&(this.virtualizer=new Qt({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160})),this.virtualizer}captureCurrentAnchor(){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();return e===null||t===null?void 0:this.virtualizer.captureAnchor(this.bodyScrollOffset(e,t))}logicalStructureSignature(e,t){return[e.map(r=>A(this.rowKey,r)).join("\0"),[...t].join("\0")].join("")}configureGeometryMode(){if(!this.virtual){this.setVirtualInactiveReason(null),this.teardownGeometry();return}if(this.resizeObserver===null&&!this.observerAttempted&&(this.observerAttempted=!0,this.resizeObserver=this.geometryProvider.createResizeObserver(this.handleGeometryResize)),this.resizeObserver===null){this.setVirtualInactiveReason("resize-observer-unavailable");return}if(this.reorderable){this.teardownGeometry(),this.setVirtualInactiveReason("reorderable");return}this.setVirtualInactiveReason(null)}configureLayoutMode(){this.virtual&&this.layout==="auto"?this.setAttribute("data-mndw-layout-inactive","virtual"):this.removeAttribute("data-mndw-layout-inactive")}isVirtualRenderingActive(){return this.virtual&&!this.reorderable&&this.resizeObserver!==null}setVirtualInactiveReason(e){e===null?this.removeAttribute("data-mndw-virtual-inactive"):(this.setAttribute("data-mndw-virtual-inactive",e),this.warnedInactiveReason!==e&&(this.warnedInactiveReason=e,console.warn(`<${mt}> virtualization inactive: ${e}`)))}updateVirtualWindow(e=!0){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let t=this.viewportElement(),r=this.headerElement(),n=t===null||r===null?0:this.bodyScrollOffset(t,r),o=t===null?0:this.geometryProvider.getViewportClientHeight(t);this.virtualRange=this.virtualizer.range(n,o,this.normalizedOverscan());let a=this.displayRows.slice(this.virtualRange.start,this.virtualRange.end);if(t!==null&&this.windowRows!==a){let s=this.windowRows.map(c=>A(this.rowKey,c)).join("\0"),l=a.map(c=>A(this.rowKey,c)).join("\0");s!==l&&this.evacuateFocusBeforeWindowRemoval(t,this.windowRows,a)}this.windowRows=a,e&&this.reconcileVisibleCells(!1)}reconcileVisibleCells(e,t){let r=t??new Set(this.effectiveColumns.filter(o=>!this.effectiveHidden.has(o.id)).map(o=>o.id)),n=[this.windowRows.map(o=>A(this.rowKey,o)).join("\0"),[...r].join("\0"),[...this.expandedSet()].join("\0")].join("");!e&&n===this.lastCellReconcileSignature||(this.cellRegistry?.reconcile(this.windowRows,o=>A(this.rowKey,o),this.effectiveColumns,r,tr,this.expandedSet(),this.expandedRenderer),this.lastCellReconcileSignature=n)}bodyScrollOffset(e,t){return Math.max(0,this.geometryProvider.getViewportScrollTop(e)-this.geometryProvider.measure(t).height)}writeBodyScrollOffset(e,t,r){if(this.virtualizer===null)return;let n=this.geometryProvider.measure(t).height,o=this.geometryProvider.getViewportClientHeight(e),a=this.geometryProvider.getViewportScrollTop(e),s=this.virtualizer.range(this.bodyScrollOffset(e,t),o,this.normalizedOverscan()).totalHeight,l=Math.max(0,n+s-o),c=r<=0&&a<n?a:n+Math.max(0,r),d=Math.min(l,Math.max(0,c));this.expectedProgrammaticScrollTop=d,this.geometryProvider.setViewportScrollTop(e,d)}syncGeometryTargets(){let e=this.resizeObserver,t=this.viewportElement(),r=this.headerElement();if(e===null||t===null||r===null)return;let n=new Map;n.set(t,{kind:"viewport"}),n.set(r,{kind:"header"});for(let o of this.shadowRoot?.querySelectorAll('[part="row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"summary",rowKey:a})}for(let o of this.shadowRoot?.querySelectorAll('[part="detail-row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"detail",rowKey:a})}for(let o of this.observedElements)n.has(o)||(e.unobserve(o),this.observedElements.delete(o));for(let[o,a]of n)Mn(o,a),this.observedElements.has(o)||(e.observe(o),this.observedElements.add(o));this.observedViewport!==t&&(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),t.addEventListener("scroll",this.handleViewportScroll),this.observedViewport=t)}unobserveStaleGeometryTargets(){if(this.resizeObserver===null)return;let e=new Set(this.windowRows.map(r=>A(this.rowKey,r))),t=this.expandedSet();for(let r of this.observedElements){let n=Zt(r);(n?.kind==="summary"&&!e.has(n.rowKey)||n?.kind==="detail"&&(!e.has(n.rowKey)||!t.has(n.rowKey)))&&(this.resizeObserver.unobserve(r),this.observedElements.delete(r))}}scheduleGeometryFrame(){!this.isVirtualRenderingActive()||this.pendingGeometryFrame!==null||(this.pendingGeometryFrame=this.geometryProvider.requestAnimationFrame(this.handleGeometryFrame))}handleGeometryResize=()=>{this.scheduleGeometryFrame()};handleViewportScroll=()=>{let e=this.observedViewport;if(e!==null&&this.expectedProgrammaticScrollTop!==void 0){let t=this.geometryProvider.getViewportScrollTop(e);if(Math.abs(t-this.expectedProgrammaticScrollTop)<=.25){this.expectedProgrammaticScrollTop=void 0,this.scheduleGeometryFrame();return}}this.pendingScrollTarget=null,this.scheduleGeometryFrame()};handleGeometryFrame=()=>{if(this.pendingGeometryFrame=null,!this.isConnected||!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();if(e===null||t===null)return;this.geometryProvider.measure(e);let r=this.geometryProvider.measure(t),n=this.geometryProvider.getViewportContentWidth(e),o=this.bodyScrollOffset(e,t),a=this.virtualizer.captureAnchor(o),s=!1;this.lastViewportContentWidth===void 0?this.lastViewportContentWidth=n:Number.isFinite(n)&&Math.abs(n-this.lastViewportContentWidth)>=i.WIDTH_EPSILON&&(this.lastViewportContentWidth=n,this.virtualizer.resetWidthEpoch(),s=!0);for(let p of this.observedElements){let S=Zt(p);S?.kind==="summary"?s=this.virtualizer.recordSummaryMeasurement(S.rowKey,this.geometryProvider.measure(p).height)||s:S?.kind==="detail"&&(s=this.virtualizer.recordDetailMeasurement(S.rowKey,this.geometryProvider.measure(p).height)||s)}let l=Math.max(0,this.geometryProvider.getViewportScrollTop(e)-r.height),c=this.virtualizer.range(l,this.geometryProvider.getViewportClientHeight(e),this.normalizedOverscan()),d=this.windowRows.map(p=>A(this.rowKey,p)).join("\0"),h=this.displayRows.slice(c.start,c.end),m=h.map(p=>A(this.rowKey,p)).join("\0");d!==m&&this.evacuateFocusBeforeWindowRemoval(e,this.windowRows,h),this.virtualRange=c,this.windowRows=h,this.reconcileVisibleCells(!1);let f=!1;if(this.pendingScrollTarget!==null){let p=this.pendingScrollTarget;if([...this.observedElements].find(T=>{let R=Zt(T);return R?.kind==="summary"&&R.rowKey===p.key})!==void 0){let T=this.virtualizer.offsetForRow(p.key,p.align,this.geometryProvider.getViewportClientHeight(e),l);T!==void 0&&this.writeBodyScrollOffset(e,t,T),this.pendingScrollTarget=null,f=!0}}if(s&&!f&&a!==void 0){let p=Math.max(0,c.totalHeight-this.geometryProvider.getViewportClientHeight(e)),S=this.virtualizer.restoreAnchor(a,p);this.writeBodyScrollOffset(e,t,S)}(s||d!==m)&&this.requestUpdate()};teardownGeometry(){if(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),this.observedViewport=null,this.resizeObserver!==null){for(let e of this.observedElements)this.resizeObserver.unobserve(e);this.resizeObserver.disconnect(),this.resizeObserver=null}this.observedElements.clear(),this.observerAttempted=!1,this.pendingGeometryFrame!==null&&(this.geometryProvider.cancelAnimationFrame(this.pendingGeometryFrame),this.pendingGeometryFrame=null),this.lastViewportContentWidth=void 0,this.expectedProgrammaticScrollTop=void 0}normalizedEstimatedRowHeight(){return Number.isFinite(this.estimatedRowHeight)&&this.estimatedRowHeight>0?this.estimatedRowHeight:49}normalizedOverscan(){return Number.isFinite(this.overscan)&&this.overscan>=0?this.overscan:400}viewportElement(){return this.shadowRoot?.querySelector('[part="viewport"]')??null}headerElement(){return this.shadowRoot?.querySelector('[part="header-row"]')??null}collectFocusChain(){let e=[],t=document.activeElement;for(;t!==null;){e.push({rowKey:this.focusedRowKeyForElement(t)});let r=t.shadowRoot?.activeElement;if(!(r instanceof Element)||r===t)break;t=r}return e}focusedRowKeyForElement(e){let t=this.cellRegistry?.getRowKeyForNode(e);return t!==void 0?t:e.closest('[part="row"], [part="detail-row"]')?.getAttribute("data-row-key")??void 0}evacuateFocusBeforeWindowRemoval(e,t,r){let n=new Set(t.map(s=>A(this.rowKey,s))),o=new Set(r.map(s=>A(this.rowKey,s))),a=En(this.collectFocusChain());a!==void 0&&n.has(a)&&!o.has(a)&&e.focus()}shouldRenderLeadingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="leading"}shouldRenderTrailingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="trailing"}shouldRenderToggleAfter(e){return this.expandable&&this.toggleAfterColumn===e}leadingUtilityKeys(){let e=[];return this.shouldRenderLeadingToggle()&&e.push(i.PIN_KEYS.expandLead),this.selectable&&e.push(i.PIN_KEYS.select),this.reorderable&&this.effectiveSortState===null&&e.push(i.PIN_KEYS.drag),e}computePinState(){let e=this.effectiveColumns.filter(a=>!this.effectiveHidden.has(a.id)),t=[],r=null,n=null;for(let a of e){if(a.sticky!=="start")break;if(a.width===void 0){r="missing-width",n=a.id;break}t.push({...a,width:a.width})}if(r===null){let a=e.slice(t.length).find(s=>s.sticky==="start");a!==void 0&&(r="not-leading",n=a.id)}let o=new Map;if(t.length>0){let a=[...this.leadingUtilityKeys().map(l=>({key:l,width:i.UTILITY_COL_WIDTH})),...t.map(l=>({key:l.id,width:l.width}))],s=[];a.forEach((l,c)=>{let d=s.length===0?"0":s.length===1?s[0]:`calc(${s.join(" + ")})`;o.set(l.key,{insetInlineStart:d,isLast:c===a.length-1}),s.push(l.width)})}return{byKey:o,inactiveReason:r,inactiveColumnId:n}}applyStickyInactive(e){if(e.inactiveReason===null){this.removeAttribute("data-mndw-sticky-inactive"),this.warnedStickyReason=null;return}this.setAttribute("data-mndw-sticky-inactive",e.inactiveReason);let t=`${e.inactiveReason}:${e.inactiveColumnId??""}`;this.warnedStickyReason!==t&&(this.warnedStickyReason=t,console.warn(`<${mt}> sticky column "${e.inactiveColumnId??""}" inactive: ${e.inactiveReason}`))}tableStyle(){return this.minWidth===""?b:`min-width: ${this.minWidth};`}columnStyle(e){let t=this.pinState.byKey.get(e.id),r=[];return e.width!==void 0&&r.push(`width: ${e.width};`),t!==void 0&&e.width!==void 0&&r.push(`min-width: ${e.width};`,`max-width: ${e.width};`,"box-sizing: border-box;",`inset-inline-start: ${t.insetInlineStart};`),r.length===0?b:r.join(" ")}pinClasses(e){let t=this.pinState.byKey.get(e);return t===void 0?[]:t.isLast?["pinned","pinned-last"]:["pinned"]}utilityPinStyle(e){let t=this.pinState.byKey.get(e);if(t===void 0)return b;let r=i.UTILITY_COL_WIDTH;return`width: ${r}; min-width: ${r}; max-width: ${r}; box-sizing: border-box; inset-inline-start: ${t.insetInlineStart};`}columnSpan(){let e=this.effectiveColumns.filter(t=>!this.effectiveHidden.has(t.id)).length;return(this.expandable?1:0)+(this.selectable?1:0)+(this.reorderable&&this.effectiveSortState===null?1:0)+e+(this.columnMenu?1:0)}alignClassList(e){let t=[];return e.align==="end"&&t.push("align-end"),e.align==="center"&&t.push("align-center"),e.nowrap===!0&&t.push("nowrap"),t}toneColor(e){return`var(--mndw-${e==="neutral"?"text-muted":e})`}resolveLabels(){return{...ya(),...this.labels}}rowName(e,t){return this.rowLabel?.(e)??this.resolveLabels().rowFallback(t+1)}sameSortState(e,t){return e?.columnId===t?.columnId&&e?.direction===t?.direction}logicalRowCount(){let e=this.expandedSet(),t=new Set(this.displayRows.map(n=>A(this.rowKey,n))),r=[...e].filter(n=>t.has(n)).length;return 1+this.displayRows.length+r}logicalRowIndex(e,t){let r=2,n=this.expandedSet();for(let o of this.displayRows){let a=A(this.rowKey,o);if(a===e)return t?r+1:r;r+=1,n.has(a)&&(r+=1)}return r}locale(){return document.documentElement.lang||"en"}isAllSelected(){return rr(this.selectedKeySet,this.displayRows.map(e=>A(this.rowKey,e)))==="all"}isIndeterminate(){return rr(this.selectedKeySet,this.displayRows.map(e=>A(this.rowKey,e)))==="indeterminate"}emitErrorIfChanged(){let e=JSON.stringify(this.violations);e!==this.lastViolationSignature&&(this.lastViolationSignature=e,this.violations.length!==0&&this.dispatchEvent(new CustomEvent(ri,{...he,detail:{violations:this.violations}})))}handleCheckboxChange=e=>{let t=e.composedPath()[0]??null;if(t===null)return;if(t.hasAttribute("data-select-all")){let n=this.displayRows.map(a=>A(this.rowKey,a)),o=Un(this.selected,n);this.dispatchEvent(new CustomEvent(Xt,{...he,detail:{selected:o}}));return}let r=t.getAttribute("data-row-key");if(r!==null){let n=zn(this.selected,r);this.dispatchEvent(new CustomEvent(Xt,{...he,detail:{selected:n}}))}};handleClick=e=>{let t=e.composedPath().find(o=>o instanceof HTMLElement)??null,r=t?.closest?.('[part="expand-toggle"]');if(r!=null){this.emitExpand(r.getAttribute("data-expand-key")??"");return}if(this.expandable&&this.expandOn==="row"){let o=e.composedPath();if(!o.some(s=>s instanceof HTMLElement&&(s.tagName==="BUTTON"||s.tagName==="A"||s.tagName==="INPUT"||s.tagName==="MNDW-CHECKBOX"||s.getAttribute("part")==="drag-handle"||s.hasAttribute("data-no-expand")))){let s=o.find(c=>c instanceof HTMLElement&&c.getAttribute("part")==="row"),l=s instanceof HTMLElement?s.getAttribute("data-row-key"):null;l!=null&&l!==""&&this.emitExpand(l)}}let n=t?.closest?.("[data-sort-column]");if(n!=null){this.activateSort(n.getAttribute("data-sort-column")??"");return}t?.closest?.('[part="column-menu-trigger"]')!==null&&t?.closest?.('[part="column-menu-trigger"]')!==void 0&&this.openColumnMenu(t)};emitExpand(e){let t=new Set(this.expanded);t.has(e)?t.delete(e):t.add(e),this.dispatchEvent(new CustomEvent(ii,{...he,detail:{expanded:[...t]}}))}handleKeyDown=e=>{let t=e.composedPath()[0]??null;t?.getAttribute("part")==="drag-handle"&&(e.key==="ArrowUp"||e.key==="ArrowDown")&&(e.preventDefault(),this.keyboardReorder(t.getAttribute("data-row-key")??"",e.key==="ArrowUp"?-1:1))};activateSort(e){if(this.effectiveColumns.find(n=>n.id===e)?.sortable!==!0)return;let r=Hn(this.sort,e);this.dispatchEvent(new CustomEvent(Qr,{...he,detail:{sort:r}}))}keyboardReorder(e,t){let r=this.displayRows.findIndex(s=>A(this.rowKey,s)===e);if(r===-1)return;let n=r+t;if(n<0||n>=this.displayRows.length)return;let o=t===-1?n:n+1,a=o<this.displayRows.length?A(this.rowKey,this.displayRows[o]):null;this.emitReorder(e,a)}emitReorder(e,t){let r=this.resolveLabels(),n=this.displayRows.find(o=>A(this.rowKey,o)===e);this.announceText=n===void 0?"":r.reordered(this.rowName(n,this.displayRows.indexOf(n)),this.displayRows.indexOf(n)+1,this.displayRows.length),this.dispatchEvent(new CustomEvent(ei,{...he,detail:{key:e,beforeKey:t}}))}applyColumnVisibility(e){this.dispatchEvent(new CustomEvent(ti,{...he,detail:{hidden:e}}))}getVisibleColumnIds(){return this.effectiveColumns.filter(e=>!this.effectiveHidden.has(e.id)).map(e=>e.id)}scrollToRow(e,t={}){if(!this.displayRows.some(c=>A(this.rowKey,c)===e))return!1;let n=this.viewportElement(),o=this.headerElement();if(n===null||o===null)return!1;let a=this.getVirtualizer();a.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),a.setRows(this.displayRows.map(c=>A(this.rowKey,c)),this.expandedSet());let s=t.align??"nearest",l=a.offsetForRow(e,s,this.geometryProvider.getViewportClientHeight(n),this.bodyScrollOffset(n,o));return l===void 0?!1:(this.isVirtualRenderingActive()&&(this.pendingScrollTarget={key:e,align:s}),this.writeBodyScrollOffset(n,o,l),this.updateVirtualWindow(),this.isVirtualRenderingActive()&&this.requestUpdate(),!0)}openColumnMenu(e){if(this.menuLayer!==null)return;let t=this.effectiveColumns.filter(o=>o.hideable!==!1).map(o=>({id:o.id,label:o.label})),r=Gt().open({anchor:e,presentation:"popover",className:this.columnMenuPanelClass||void 0,trapFocus:!1,restoreFocus:!1}),n=document.createElement(pt);n.columns=t,n.hiddenColumns=[...this.effectiveHidden],n.addEventListener(Zr,this.onColumnMenuCheck),n.addEventListener("mndwpaneldismiss",this.onColumnMenuDismiss),r.contentElement.appendChild(n),this.menuLayer=r,n.updateComplete.then(()=>{this.menuLayer===r&&(r.reposition(),n.focusFirstOption())}),r.closed.then(()=>{this.forgetColumnMenu()})}closeColumnMenu(){this.menuLayer?.close(),this.forgetColumnMenu()}forgetColumnMenu(){this.menuLayer=null}onColumnMenuCheck=e=>{let t=e.detail.hidden;if(this.hiddenColumns!==void 0){this.applyColumnVisibility(t);return}this.visibilityState.applyInternal(t),this.requestUpdate(),this.applyColumnVisibility(t)};onColumnMenuDismiss=e=>{let t=e.detail.restoreFocus;this.closeColumnMenu(),t&&this.shadowRoot?.querySelector('[part="column-menu-trigger"]')?.focus()}};function Sa(){function i(e){return e}return i}var xa=[[Sr,He],[Mr,Be],[Rr,We],[Ht,Ge],[_r,Ke],[Nr,qe],[Er,ze],[Ye,je],[Gr,et],[Ze,Je],[Ur,Qe],[Te,tt],[Wr,it],[Cr,Ve],[qr,nt],[Tr,Ue],[jr,ot],[Me,at],[G,st],[Yr,lt],[Xr,dt],[Yt,ut],[mt,bt],[pt,ht]];function Pc(i){i?.initialLocale!==void 0&&gr(i.initialLocale),i?.overlay&&dn(Ji(i.overlay)),i?.iconSpriteUrl!==void 0&&Bi(i.iconSpriteUrl);for(let[e,t]of xa)customElements.get(e)||customElements.define(e,t)}export{W as DETAIL_COL_ID,k as LocaleController,Sr as MNDW_BAR_CHART_TAG,Mr as MNDW_BUTTON_TAG,Rr as MNDW_CHECKBOX_TAG,pt as MNDW_COLUMN_MENU_TAG,ti as MNDW_COLUMN_VISIBILITY_CHANGE_EVENT,ri as MNDW_ERROR_EVENT,Ht as MNDW_FIELD_TAG,Cr as MNDW_HEAT_STRIP_TAG,Vi as MNDW_ICON_NAMES,_r as MNDW_ICON_TAG,Nr as MNDW_INPUT_TAG,Yi as MNDW_INPUT_TYPES,Ft as MNDW_LABEL_CHANGE_EVENT,Er as MNDW_LINE_CHART_TAG,Xe as MNDW_OPTION_CHANGE_EVENT,Ye as MNDW_OPTION_TAG,ii as MNDW_ROW_EXPAND_EVENT,ei as MNDW_ROW_REORDER_EVENT,Gr as MNDW_SCROLL_AREA_TAG,Wr as MNDW_SEGMENTED_TAG,rt as MNDW_SEGMENT_CHANGE_EVENT,Te as MNDW_SEGMENT_TAG,Xt as MNDW_SELECTION_CHANGE_EVENT,Ze as MNDW_SELECT_PANEL_TAG,Ur as MNDW_SELECT_TAG,qr as MNDW_SLIDER_TAG,Qr as MNDW_SORT_CHANGE_EVENT,Tr as MNDW_SPARKLINE_TAG,jr as MNDW_SWITCH_TAG,mt as MNDW_TABLE_TAG,Yr as MNDW_TABS_TAG,Me as MNDW_TAB_PANEL_TAG,G as MNDW_TAB_TAG,Xr as MNDW_TEXTAREA_TAG,Yt as MNDW_TOOLTIP_TAG,Lo as MOBILE_OVERLAY_MAX_WIDTH,He as MndwBarChart,Be as MndwButton,We as MndwCheckbox,ht as MndwColumnMenu,Ge as MndwField,Ve as MndwHeatStrip,Ke as MndwIcon,qe as MndwInput,ze as MndwLineChart,je as MndwOption,et as MndwScrollArea,tt as MndwSegment,it as MndwSegmented,Qe as MndwSelect,Je as MndwSelectPanel,nt as MndwSlider,Ue as MndwSparkline,ot as MndwSwitch,st as MndwTab,at as MndwTabPanel,bt as MndwTable,lt as MndwTabs,dt as MndwTextarea,ut as MndwTooltip,ko as POPOVER_ANCHOR_GAP,Ut as POPOVER_FLIP_ORDER,Do as SELECT_ANCHOR_GAP,Po as SELECT_MOBILE_MAX_WIDTH,$r as SELECT_VIEWPORT_PADDING,_o as VIEWPORT_PADDING,Hr as availablePopoverHeight,Io as coercePlacement,Sa as column,Ce as composedContains,Or as computePopoverCoords,Ir as computeTooltipCoords,Bt as createFocusTrap,Y as createGeneratedAttribute,N as createLocalizedProperty,xe as deepActiveElement,Pc as defineMndwUi,le as formatSpeed,ao as getMndwUiLocale,w as getMndwUiText,Oo as isMobileSheet,Vo as resolveSizing,Fr as selectPresentation,gr as setMndwUiLocale,wr as subscribeMndwUiLocale,Vr as tabbableElements};
|
|
1736
|
+
></mndw-checkbox>`}expandedSet(){return new Set(this.expanded)}getVirtualizer(){return this.virtualizer===null&&(this.virtualizer=new Qt({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160})),this.virtualizer}captureCurrentAnchor(){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();return e===null||t===null?void 0:this.virtualizer.captureAnchor(this.bodyScrollOffset(e,t))}logicalStructureSignature(e,t){return[e.map(r=>A(this.rowKey,r)).join("\0"),[...t].join("\0")].join("")}configureGeometryMode(){if(!this.virtual){this.setVirtualInactiveReason(null),this.teardownGeometry();return}if(this.resizeObserver===null&&!this.observerAttempted&&(this.observerAttempted=!0,this.resizeObserver=this.geometryProvider.createResizeObserver(this.handleGeometryResize)),this.resizeObserver===null){this.setVirtualInactiveReason("resize-observer-unavailable");return}if(this.reorderable){this.teardownGeometry(),this.setVirtualInactiveReason("reorderable");return}this.setVirtualInactiveReason(null)}configureLayoutMode(){this.virtual&&this.layout==="auto"?this.setAttribute("data-mndw-layout-inactive","virtual"):this.removeAttribute("data-mndw-layout-inactive")}isVirtualRenderingActive(){return this.virtual&&!this.reorderable&&this.resizeObserver!==null}setVirtualInactiveReason(e){e===null?this.removeAttribute("data-mndw-virtual-inactive"):(this.setAttribute("data-mndw-virtual-inactive",e),this.warnedInactiveReason!==e&&(this.warnedInactiveReason=e,console.warn(`<${mt}> virtualization inactive: ${e}`)))}updateVirtualWindow(e=!0){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let t=this.viewportElement(),r=this.headerElement(),n=t===null||r===null?0:this.bodyScrollOffset(t,r),o=t===null?0:this.geometryProvider.getViewportClientHeight(t);this.virtualRange=this.virtualizer.range(n,o,this.normalizedOverscan());let a=this.displayRows.slice(this.virtualRange.start,this.virtualRange.end);if(t!==null&&this.windowRows!==a){let s=this.windowRows.map(c=>A(this.rowKey,c)).join("\0"),l=a.map(c=>A(this.rowKey,c)).join("\0");s!==l&&this.evacuateFocusBeforeWindowRemoval(t,this.windowRows,a)}this.windowRows=a,e&&this.reconcileVisibleCells(!1)}reconcileVisibleCells(e,t){let r=t??new Set(this.effectiveColumns.filter(o=>!this.effectiveHidden.has(o.id)).map(o=>o.id)),n=[this.windowRows.map(o=>A(this.rowKey,o)).join("\0"),[...r].join("\0"),[...this.expandedSet()].join("\0")].join("");!e&&n===this.lastCellReconcileSignature||(this.cellRegistry?.reconcile(this.windowRows,o=>A(this.rowKey,o),this.effectiveColumns,r,tr,this.expandedSet(),this.expandedRenderer),this.lastCellReconcileSignature=n)}bodyScrollOffset(e,t){return Math.max(0,this.geometryProvider.getViewportScrollTop(e)-this.geometryProvider.measure(t).height)}writeBodyScrollOffset(e,t,r){if(this.virtualizer===null)return;let n=this.geometryProvider.measure(t).height,o=this.geometryProvider.getViewportClientHeight(e),a=this.geometryProvider.getViewportScrollTop(e),s=this.virtualizer.range(this.bodyScrollOffset(e,t),o,this.normalizedOverscan()).totalHeight,l=Math.max(0,n+s-o),c=r<=0&&a<n?a:n+Math.max(0,r),d=Math.min(l,Math.max(0,c));this.expectedProgrammaticScrollTop=d,this.geometryProvider.setViewportScrollTop(e,d)}syncGeometryTargets(){let e=this.resizeObserver,t=this.viewportElement(),r=this.headerElement();if(e===null||t===null||r===null)return;let n=new Map;n.set(t,{kind:"viewport"}),n.set(r,{kind:"header"});for(let o of this.shadowRoot?.querySelectorAll('[part="row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"summary",rowKey:a})}for(let o of this.shadowRoot?.querySelectorAll('[part="detail-row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"detail",rowKey:a})}for(let o of this.observedElements)n.has(o)||(e.unobserve(o),this.observedElements.delete(o));for(let[o,a]of n)Mn(o,a),this.observedElements.has(o)||(e.observe(o),this.observedElements.add(o));this.observedViewport!==t&&(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),t.addEventListener("scroll",this.handleViewportScroll),this.observedViewport=t)}unobserveStaleGeometryTargets(){if(this.resizeObserver===null)return;let e=new Set(this.windowRows.map(r=>A(this.rowKey,r))),t=this.expandedSet();for(let r of this.observedElements){let n=Zt(r);(n?.kind==="summary"&&!e.has(n.rowKey)||n?.kind==="detail"&&(!e.has(n.rowKey)||!t.has(n.rowKey)))&&(this.resizeObserver.unobserve(r),this.observedElements.delete(r))}}scheduleGeometryFrame(){!this.isVirtualRenderingActive()||this.pendingGeometryFrame!==null||(this.pendingGeometryFrame=this.geometryProvider.requestAnimationFrame(this.handleGeometryFrame))}handleGeometryResize=()=>{this.scheduleGeometryFrame()};handleViewportScroll=()=>{let e=this.observedViewport;if(e!==null&&this.expectedProgrammaticScrollTop!==void 0){let t=this.geometryProvider.getViewportScrollTop(e);if(Math.abs(t-this.expectedProgrammaticScrollTop)<=.25){this.expectedProgrammaticScrollTop=void 0,this.scheduleGeometryFrame();return}}this.pendingScrollTarget=null,this.scheduleGeometryFrame()};handleGeometryFrame=()=>{if(this.pendingGeometryFrame=null,!this.isConnected||!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();if(e===null||t===null)return;this.geometryProvider.measure(e);let r=this.geometryProvider.measure(t),n=this.geometryProvider.getViewportContentWidth(e),o=this.bodyScrollOffset(e,t),a=this.virtualizer.captureAnchor(o),s=!1;this.lastViewportContentWidth===void 0?this.lastViewportContentWidth=n:Number.isFinite(n)&&Math.abs(n-this.lastViewportContentWidth)>=i.WIDTH_EPSILON&&(this.lastViewportContentWidth=n,this.virtualizer.resetWidthEpoch(),s=!0);for(let p of this.observedElements){let S=Zt(p);S?.kind==="summary"?s=this.virtualizer.recordSummaryMeasurement(S.rowKey,this.geometryProvider.measure(p).height)||s:S?.kind==="detail"&&(s=this.virtualizer.recordDetailMeasurement(S.rowKey,this.geometryProvider.measure(p).height)||s)}let l=Math.max(0,this.geometryProvider.getViewportScrollTop(e)-r.height),c=this.virtualizer.range(l,this.geometryProvider.getViewportClientHeight(e),this.normalizedOverscan()),d=this.windowRows.map(p=>A(this.rowKey,p)).join("\0"),h=this.displayRows.slice(c.start,c.end),m=h.map(p=>A(this.rowKey,p)).join("\0");d!==m&&this.evacuateFocusBeforeWindowRemoval(e,this.windowRows,h),this.virtualRange=c,this.windowRows=h,this.reconcileVisibleCells(!1);let f=!1;if(this.pendingScrollTarget!==null){let p=this.pendingScrollTarget;if([...this.observedElements].find(T=>{let R=Zt(T);return R?.kind==="summary"&&R.rowKey===p.key})!==void 0){let T=this.virtualizer.offsetForRow(p.key,p.align,this.geometryProvider.getViewportClientHeight(e),l);T!==void 0&&this.writeBodyScrollOffset(e,t,T),this.pendingScrollTarget=null,f=!0}}if(s&&!f&&a!==void 0){let p=Math.max(0,c.totalHeight-this.geometryProvider.getViewportClientHeight(e)),S=this.virtualizer.restoreAnchor(a,p);this.writeBodyScrollOffset(e,t,S)}(s||d!==m)&&this.requestUpdate()};teardownGeometry(){if(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),this.observedViewport=null,this.resizeObserver!==null){for(let e of this.observedElements)this.resizeObserver.unobserve(e);this.resizeObserver.disconnect(),this.resizeObserver=null}this.observedElements.clear(),this.observerAttempted=!1,this.pendingGeometryFrame!==null&&(this.geometryProvider.cancelAnimationFrame(this.pendingGeometryFrame),this.pendingGeometryFrame=null),this.lastViewportContentWidth=void 0,this.expectedProgrammaticScrollTop=void 0}normalizedEstimatedRowHeight(){return Number.isFinite(this.estimatedRowHeight)&&this.estimatedRowHeight>0?this.estimatedRowHeight:49}normalizedOverscan(){return Number.isFinite(this.overscan)&&this.overscan>=0?this.overscan:400}viewportElement(){return this.shadowRoot?.querySelector('[part="viewport"]')??null}headerElement(){return this.shadowRoot?.querySelector('[part="header-row"]')??null}collectFocusChain(){let e=[],t=document.activeElement;for(;t!==null;){e.push({rowKey:this.focusedRowKeyForElement(t)});let r=t.shadowRoot?.activeElement;if(!(r instanceof Element)||r===t)break;t=r}return e}focusedRowKeyForElement(e){let t=this.cellRegistry?.getRowKeyForNode(e);return t!==void 0?t:e.closest('[part="row"], [part="detail-row"]')?.getAttribute("data-row-key")??void 0}evacuateFocusBeforeWindowRemoval(e,t,r){let n=new Set(t.map(s=>A(this.rowKey,s))),o=new Set(r.map(s=>A(this.rowKey,s))),a=En(this.collectFocusChain());a!==void 0&&n.has(a)&&!o.has(a)&&e.focus()}shouldRenderLeadingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="leading"}shouldRenderTrailingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="trailing"}shouldRenderToggleAfter(e){return this.expandable&&this.toggleAfterColumn===e}leadingUtilityKeys(){let e=[];return this.shouldRenderLeadingToggle()&&e.push(i.PIN_KEYS.expandLead),this.selectable&&e.push(i.PIN_KEYS.select),this.reorderable&&this.effectiveSortState===null&&e.push(i.PIN_KEYS.drag),e}computePinState(){let e=this.effectiveColumns.filter(a=>!this.effectiveHidden.has(a.id)),t=[],r=null,n=null;for(let a of e){if(a.sticky!=="start")break;if(a.width===void 0){r="missing-width",n=a.id;break}t.push({...a,width:a.width})}if(r===null){let a=e.slice(t.length).find(s=>s.sticky==="start");a!==void 0&&(r="not-leading",n=a.id)}let o=new Map;if(t.length>0){let a=[...this.leadingUtilityKeys().map(l=>({key:l,width:i.UTILITY_COL_WIDTH})),...t.map(l=>({key:l.id,width:l.width}))],s=[];a.forEach((l,c)=>{let d=s.length===0?"0":s.length===1?s[0]:`calc(${s.join(" + ")})`;o.set(l.key,{insetInlineStart:d,isLast:c===a.length-1}),s.push(l.width)})}return{byKey:o,inactiveReason:r,inactiveColumnId:n}}applyStickyInactive(e){if(e.inactiveReason===null){this.removeAttribute("data-mndw-sticky-inactive"),this.warnedStickyReason=null;return}this.setAttribute("data-mndw-sticky-inactive",e.inactiveReason);let t=`${e.inactiveReason}:${e.inactiveColumnId??""}`;this.warnedStickyReason!==t&&(this.warnedStickyReason=t,console.warn(`<${mt}> sticky column "${e.inactiveColumnId??""}" inactive: ${e.inactiveReason}`))}tableStyle(){return this.minWidth===""?b:`min-width: ${this.minWidth};`}columnStyle(e){let t=this.pinState.byKey.get(e.id),r=[];return e.width!==void 0&&r.push(`width: ${e.width};`),t!==void 0&&e.width!==void 0&&r.push(`min-width: ${e.width};`,`max-width: ${e.width};`,"box-sizing: border-box;",`inset-inline-start: ${t.insetInlineStart};`),r.length===0?b:r.join(" ")}pinClasses(e){let t=this.pinState.byKey.get(e);return t===void 0?[]:t.isLast?["pinned","pinned-last"]:["pinned"]}utilityPinStyle(e){let t=this.pinState.byKey.get(e);if(t===void 0)return b;let r=i.UTILITY_COL_WIDTH;return`width: ${r}; min-width: ${r}; max-width: ${r}; box-sizing: border-box; inset-inline-start: ${t.insetInlineStart};`}columnSpan(){let e=this.effectiveColumns.filter(t=>!this.effectiveHidden.has(t.id)).length;return(this.expandable?1:0)+(this.selectable?1:0)+(this.reorderable&&this.effectiveSortState===null?1:0)+e+(this.columnMenu?1:0)}alignClassList(e){let t=[];return e.align==="end"&&t.push("align-end"),e.align==="center"&&t.push("align-center"),e.nowrap===!0&&t.push("nowrap"),t}toneColor(e){return`var(--mndw-${e==="neutral"?"text-muted":e})`}resolveLabels(){return{...ya(),...this.labels}}rowName(e,t){return this.rowLabel?.(e)??this.resolveLabels().rowFallback(t+1)}sameSortState(e,t){return e?.columnId===t?.columnId&&e?.direction===t?.direction}logicalRowCount(){let e=this.expandedSet(),t=new Set(this.displayRows.map(n=>A(this.rowKey,n))),r=[...e].filter(n=>t.has(n)).length;return 1+this.displayRows.length+r}logicalRowIndex(e,t){let r=2,n=this.expandedSet();for(let o of this.displayRows){let a=A(this.rowKey,o);if(a===e)return t?r+1:r;r+=1,n.has(a)&&(r+=1)}return r}locale(){return document.documentElement.lang||"en"}isAllSelected(){return rr(this.selectedKeySet,this.displayRows.map(e=>A(this.rowKey,e)))==="all"}isIndeterminate(){return rr(this.selectedKeySet,this.displayRows.map(e=>A(this.rowKey,e)))==="indeterminate"}emitErrorIfChanged(){let e=JSON.stringify(this.violations);e!==this.lastViolationSignature&&(this.lastViolationSignature=e,this.violations.length!==0&&this.dispatchEvent(new CustomEvent(ri,{...he,detail:{violations:this.violations}})))}handleCheckboxChange=e=>{let t=e.composedPath()[0]??null;if(t===null)return;if(t.hasAttribute("data-select-all")){let n=this.displayRows.map(a=>A(this.rowKey,a)),o=Un(this.selected,n);this.dispatchEvent(new CustomEvent(Xt,{...he,detail:{selected:o}}));return}let r=t.getAttribute("data-row-key");if(r!==null){let n=zn(this.selected,r);this.dispatchEvent(new CustomEvent(Xt,{...he,detail:{selected:n}}))}};handleClick=e=>{let t=e.composedPath().find(o=>o instanceof HTMLElement)??null,r=t?.closest?.('[part="expand-toggle"]');if(r!=null){this.emitExpand(r.getAttribute("data-expand-key")??"");return}if(this.expandable&&this.expandOn==="row"){let o=e.composedPath();if(!o.some(s=>s instanceof HTMLElement&&(s.tagName==="BUTTON"||s.tagName==="A"||s.tagName==="INPUT"||s.tagName==="MNDW-CHECKBOX"||s.getAttribute("part")==="drag-handle"||s.hasAttribute("data-no-expand")))){let s=o.find(c=>c instanceof HTMLElement&&c.getAttribute("part")==="row"),l=s instanceof HTMLElement?s.getAttribute("data-row-key"):null;l!=null&&l!==""&&this.emitExpand(l)}}let n=t?.closest?.("[data-sort-column]");if(n!=null){this.activateSort(n.getAttribute("data-sort-column")??"");return}t?.closest?.('[part="column-menu-trigger"]')!==null&&t?.closest?.('[part="column-menu-trigger"]')!==void 0&&this.openColumnMenu(t)};emitExpand(e){let t=new Set(this.expanded);t.has(e)?t.delete(e):t.add(e),this.dispatchEvent(new CustomEvent(ii,{...he,detail:{expanded:[...t]}}))}handleKeyDown=e=>{let t=e.composedPath()[0]??null;t?.getAttribute("part")==="drag-handle"&&(e.key==="ArrowUp"||e.key==="ArrowDown")&&(e.preventDefault(),this.keyboardReorder(t.getAttribute("data-row-key")??"",e.key==="ArrowUp"?-1:1))};activateSort(e){if(this.effectiveColumns.find(n=>n.id===e)?.sortable!==!0)return;let r=Hn(this.sort,e);this.dispatchEvent(new CustomEvent(Qr,{...he,detail:{sort:r}}))}keyboardReorder(e,t){let r=this.displayRows.findIndex(s=>A(this.rowKey,s)===e);if(r===-1)return;let n=r+t;if(n<0||n>=this.displayRows.length)return;let o=t===-1?n:n+1,a=o<this.displayRows.length?A(this.rowKey,this.displayRows[o]):null;this.emitReorder(e,a)}emitReorder(e,t){let r=this.resolveLabels(),n=this.displayRows.find(o=>A(this.rowKey,o)===e);this.announceText=n===void 0?"":r.reordered(this.rowName(n,this.displayRows.indexOf(n)),this.displayRows.indexOf(n)+1,this.displayRows.length),this.dispatchEvent(new CustomEvent(ei,{...he,detail:{key:e,beforeKey:t}}))}applyColumnVisibility(e){this.dispatchEvent(new CustomEvent(ti,{...he,detail:{hidden:e}}))}getVisibleColumnIds(){return this.effectiveColumns.filter(e=>!this.effectiveHidden.has(e.id)).map(e=>e.id)}scrollToRow(e,t={}){if(!this.displayRows.some(c=>A(this.rowKey,c)===e))return!1;let n=this.viewportElement(),o=this.headerElement();if(n===null||o===null)return!1;let a=this.getVirtualizer();a.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),a.setRows(this.displayRows.map(c=>A(this.rowKey,c)),this.expandedSet());let s=t.align??"nearest",l=a.offsetForRow(e,s,this.geometryProvider.getViewportClientHeight(n),this.bodyScrollOffset(n,o));return l===void 0?!1:(this.isVirtualRenderingActive()&&(this.pendingScrollTarget={key:e,align:s}),this.writeBodyScrollOffset(n,o,l),this.updateVirtualWindow(),this.isVirtualRenderingActive()&&this.requestUpdate(),!0)}openColumnMenu(e){if(this.menuLayer!==null)return;let t=this.effectiveColumns.filter(o=>o.hideable!==!1).map(o=>({id:o.id,label:o.label})),r=Gt().open({anchor:e,presentation:"popover",className:this.columnMenuPanelClass||void 0,trapFocus:!1,restoreFocus:!1}),n=document.createElement(pt);n.columns=t,n.hiddenColumns=[...this.effectiveHidden],n.addEventListener(Zr,this.onColumnMenuCheck),n.addEventListener("mndwpaneldismiss",this.onColumnMenuDismiss),r.contentElement.appendChild(n),this.menuLayer=r,n.updateComplete.then(()=>{this.menuLayer===r&&(r.reposition(),n.focusFirstOption())}),r.closed.then(()=>{this.forgetColumnMenu()})}closeColumnMenu(){this.menuLayer?.close(),this.forgetColumnMenu()}forgetColumnMenu(){this.menuLayer=null}onColumnMenuCheck=e=>{let t=e.detail.hidden;if(this.hiddenColumns!==void 0){this.applyColumnVisibility(t);return}this.visibilityState.applyInternal(t),this.internalVisibilityNeedsReconcile=!0,this.requestUpdate(),this.applyColumnVisibility(t)};onColumnMenuDismiss=e=>{let t=e.detail.restoreFocus;this.closeColumnMenu(),t&&this.shadowRoot?.querySelector('[part="column-menu-trigger"]')?.focus()}};function Sa(){function i(e){return e}return i}var xa=[[Sr,He],[Mr,Be],[Rr,We],[Ht,Ge],[_r,Ke],[Nr,qe],[Er,ze],[Ye,je],[Gr,et],[Ze,Je],[Ur,Qe],[Te,tt],[Wr,it],[Cr,Ve],[qr,nt],[Tr,Ue],[jr,ot],[Me,at],[G,st],[Yr,lt],[Xr,dt],[Yt,ut],[mt,bt],[pt,ht]];function Pc(i){i?.initialLocale!==void 0&&gr(i.initialLocale),i?.overlay&&dn(Ji(i.overlay)),i?.iconSpriteUrl!==void 0&&Bi(i.iconSpriteUrl);for(let[e,t]of xa)customElements.get(e)||customElements.define(e,t)}export{W as DETAIL_COL_ID,k as LocaleController,Sr as MNDW_BAR_CHART_TAG,Mr as MNDW_BUTTON_TAG,Rr as MNDW_CHECKBOX_TAG,pt as MNDW_COLUMN_MENU_TAG,ti as MNDW_COLUMN_VISIBILITY_CHANGE_EVENT,ri as MNDW_ERROR_EVENT,Ht as MNDW_FIELD_TAG,Cr as MNDW_HEAT_STRIP_TAG,Vi as MNDW_ICON_NAMES,_r as MNDW_ICON_TAG,Nr as MNDW_INPUT_TAG,Yi as MNDW_INPUT_TYPES,Ft as MNDW_LABEL_CHANGE_EVENT,Er as MNDW_LINE_CHART_TAG,Xe as MNDW_OPTION_CHANGE_EVENT,Ye as MNDW_OPTION_TAG,ii as MNDW_ROW_EXPAND_EVENT,ei as MNDW_ROW_REORDER_EVENT,Gr as MNDW_SCROLL_AREA_TAG,Wr as MNDW_SEGMENTED_TAG,rt as MNDW_SEGMENT_CHANGE_EVENT,Te as MNDW_SEGMENT_TAG,Xt as MNDW_SELECTION_CHANGE_EVENT,Ze as MNDW_SELECT_PANEL_TAG,Ur as MNDW_SELECT_TAG,qr as MNDW_SLIDER_TAG,Qr as MNDW_SORT_CHANGE_EVENT,Tr as MNDW_SPARKLINE_TAG,jr as MNDW_SWITCH_TAG,mt as MNDW_TABLE_TAG,Yr as MNDW_TABS_TAG,Me as MNDW_TAB_PANEL_TAG,G as MNDW_TAB_TAG,Xr as MNDW_TEXTAREA_TAG,Yt as MNDW_TOOLTIP_TAG,Lo as MOBILE_OVERLAY_MAX_WIDTH,He as MndwBarChart,Be as MndwButton,We as MndwCheckbox,ht as MndwColumnMenu,Ge as MndwField,Ve as MndwHeatStrip,Ke as MndwIcon,qe as MndwInput,ze as MndwLineChart,je as MndwOption,et as MndwScrollArea,tt as MndwSegment,it as MndwSegmented,Qe as MndwSelect,Je as MndwSelectPanel,nt as MndwSlider,Ue as MndwSparkline,ot as MndwSwitch,st as MndwTab,at as MndwTabPanel,bt as MndwTable,lt as MndwTabs,dt as MndwTextarea,ut as MndwTooltip,ko as POPOVER_ANCHOR_GAP,Ut as POPOVER_FLIP_ORDER,Do as SELECT_ANCHOR_GAP,Po as SELECT_MOBILE_MAX_WIDTH,$r as SELECT_VIEWPORT_PADDING,_o as VIEWPORT_PADDING,Hr as availablePopoverHeight,Io as coercePlacement,Sa as column,Ce as composedContains,Or as computePopoverCoords,Ir as computeTooltipCoords,Bt as createFocusTrap,Y as createGeneratedAttribute,N as createLocalizedProperty,xe as deepActiveElement,Pc as defineMndwUi,le as formatSpeed,ao as getMndwUiLocale,w as getMndwUiText,Oo as isMobileSheet,Vo as resolveSizing,Fr as selectPresentation,gr as setMndwUiLocale,wr as subscribeMndwUiLocale,Vr as tabbableElements};
|
|
1707
1737
|
/*! Bundled license information:
|
|
1708
1738
|
|
|
1709
1739
|
@lit/reactive-element/css-tag.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mndw/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://eralde.github.io/mndw/",
|
|
6
6
|
"repository": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"@types/node": "22.19.15",
|
|
27
27
|
"happy-dom": "20.11.1",
|
|
28
28
|
"vitest": "3.2.7",
|
|
29
|
-
"@mndw/ui": "^0.1.
|
|
30
|
-
"@mndw/ui-
|
|
31
|
-
"@mndw/ui-
|
|
32
|
-
"@mndw/ui-vue": "^0.1.
|
|
29
|
+
"@mndw/ui": "^0.1.4",
|
|
30
|
+
"@mndw/ui-svelte": "^0.1.4",
|
|
31
|
+
"@mndw/ui-angular": "^0.1.4",
|
|
32
|
+
"@mndw/ui-vue": "^0.1.4",
|
|
33
33
|
"@mndw/angular-compiler": "2.0.0",
|
|
34
34
|
"@mndw/sdk-internal": "0.0.0"
|
|
35
35
|
},
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"vite": "^6.4.3",
|
|
62
62
|
"zone.js": "^0.15.1",
|
|
63
63
|
"zod": "^4.4.3",
|
|
64
|
-
"@mndw/palette-core": "^0.1.
|
|
65
|
-
"@mndw/sdk": "^0.1.
|
|
64
|
+
"@mndw/palette-core": "^0.1.4",
|
|
65
|
+
"@mndw/sdk": "^0.1.4"
|
|
66
66
|
},
|
|
67
67
|
"optionalDependencies": {
|
|
68
|
-
"@mndw/mndwd-darwin-arm64": "0.1.
|
|
69
|
-
"@mndw/mndwd-darwin-x64": "0.1.
|
|
70
|
-
"@mndw/mndwd-linux-arm64": "0.1.
|
|
71
|
-
"@mndw/mndwd-
|
|
72
|
-
"@mndw/mndwd-
|
|
68
|
+
"@mndw/mndwd-darwin-arm64": "0.1.4",
|
|
69
|
+
"@mndw/mndwd-darwin-x64": "0.1.4",
|
|
70
|
+
"@mndw/mndwd-linux-arm64": "0.1.4",
|
|
71
|
+
"@mndw/mndwd-linux-x64": "0.1.4",
|
|
72
|
+
"@mndw/mndwd-win32-x64": "0.1.4"
|
|
73
73
|
},
|
|
74
74
|
"description": "Command-line tools to create, validate, develop, and package mndw plugins.",
|
|
75
75
|
"scripts": {
|