@evotecit/canopyx 0.3.6 → 0.3.7

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.
Files changed (30) hide show
  1. package/CanopyX.Html/Assets/canopyx-calendar.js +4 -3
  2. package/CanopyX.Html/Assets/canopyx-detail-rows.js +2 -2
  3. package/CanopyX.Html/Assets/canopyx-filter-editor.js +2 -1
  4. package/CanopyX.Html/Assets/canopyx-formatting.js +7 -6
  5. package/CanopyX.Html/Assets/canopyx-grid-module.mjs +62 -40
  6. package/CanopyX.Html/Assets/canopyx-grid.css +22 -0
  7. package/CanopyX.Html/Assets/canopyx-grid.js +62 -40
  8. package/CanopyX.Html/Assets/canopyx-interactive.js +4 -4
  9. package/CanopyX.Html/Assets/canopyx-labels-de.js +3 -1
  10. package/CanopyX.Html/Assets/canopyx-labels-es.js +3 -1
  11. package/CanopyX.Html/Assets/canopyx-labels-fr.js +3 -1
  12. package/CanopyX.Html/Assets/canopyx-labels-it.js +3 -1
  13. package/CanopyX.Html/Assets/canopyx-labels-pl.js +3 -1
  14. package/CanopyX.Html/Assets/canopyx-live.js +4 -3
  15. package/CanopyX.Html/Assets/canopyx-matrix.js +3 -3
  16. package/CanopyX.Html/Assets/canopyx-module.mjs +4 -4
  17. package/CanopyX.Html/Assets/canopyx-reporting-module.mjs +64 -42
  18. package/CanopyX.Html/Assets/canopyx-reporting.css +22 -0
  19. package/CanopyX.Html/Assets/canopyx-reporting.js +64 -42
  20. package/CanopyX.Html/Assets/canopyx-tree-tools.js +7 -6
  21. package/CanopyX.Html/Assets/canopyx.js +4 -4
  22. package/JavaScript/grid.d.ts +6 -0
  23. package/JavaScript/locales/de.mjs +3 -1
  24. package/JavaScript/locales/es.mjs +3 -1
  25. package/JavaScript/locales/fr.mjs +3 -1
  26. package/JavaScript/locales/it.mjs +3 -1
  27. package/JavaScript/locales/pl.mjs +3 -1
  28. package/JavaScript/protocol.d.ts +1 -1
  29. package/README.md +6 -2
  30. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- (function(global){"use strict";const installed=new WeakSet();const part={version:"2f44e057443bc649",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,h,setText,fill,plural,gridButton,gridIcon,gridFreeze,cellText,cellValue,isCellObject,gridQuery,gridQueryRows,gridResultShape,gridPresenterTone,validateGridRows,validateGridPage,validateGridCursorPage,validStructuralCount,checkDocument,numberFormat,HostCellContext,disposeHostSlot,loadPart,PROTOCOL}=context;const CALENDAR_LABELS={calendarToday:"Today",calendarPrevious:"Previous period",calendarNext:"Next period",calendarViews:"Calendar view",calendarMonth:"Month",calendarWeek:"Week",calendarDay:"Day",calendarDays:"{count} days",calendarAgenda:"Agenda",calendarYear:"Year",calendarTimeline:"Timeline",calendarGoTo:"Go to date",calendarAllDay:"All day",calendarMore:"+{count} more",calendarMoreLabel:"Show {count} more events on {date}",calendarDayEvents:"Events on {date}",calendarNoEvents:"No events in this period",calendarEvents:"[one]{count} event[other]{count} events",calendarShowing:"{view}, {range}",calendarRepeats:"Repeats",calendarTruncated:"Showing the first {count} events. Narrow the period or the filters to see the rest.",calendarLoading:"Loading events…",calendarLoadError:"Could not load events: {error}",calendarNow:"Now",calendarZoom:"Zoom",calendarZoomHour:"Hours",calendarZoomDay:"Days",calendarZoomWeek:"Weeks",calendarZoomMonth:"Months",calendarZoomQuarter:"Quarters",calendarResources:"Resources",calendarCapacity:"Concurrent events",calendarCapacityAt:"{count} at once",calendarBusy:"{hours} h busy",calendarOverlaps:"[one]{count} overlap[other]{count} overlaps",calendarUnavailable:"Unavailable",calendarOutsideHours:"Outside working hours",calendarConflict:"Overlaps {title}",calendarNotAllowed:"{resource} cannot take this event",calendarMoved:"{title} moved to {time}",calendarResized:"{title} now ends {time}",calendarSeriesMoved:"Every occurrence of {title} moved",calendarSeriesTime:"Only the time of a whole series can be moved here.",calendarMoveHelp:"Arrow keys move, Shift with arrow keys changes the end, Alt with Up or Down changes the resource, Enter saves, Escape cancels.",calendarEdit:"Move or resize {title}",calendarSaveFailed:"{title} was not saved: {error}",calendarExport:"iCalendar (.ics)",calendarTimeRange:"{start} – {end}",calendarSelected:"Selected {range}",calendarLane:"{resource}, {events}",calendarHighlighted:"[one]{count} event highlighted[other]{count} events highlighted",calendarMini:"Mini month",calendarWeekList:"Week list",calendarDayList:"Day list",calendarMonths:"Months",calendarWeekNumber:"Week {number}",calendarWeekShort:"W{number}",calendarNewEvent:"New event",calendarEventTitle:"Title",calendarCreate:"Add",calendarCancel:"Cancel",calendarCreated:"{title} added on {time}",calendarReceived:"{title} scheduled on {time}",calendarOccurrenceTitle:"Change a repeating event",calendarOccurrenceReadOnly:"This part of the series cannot be saved because some values are read-only.",calendarThisEvent:"This event",calendarThisAndFollowing:"This and following events",calendarAllEvents:"All events",calendarSources:"Calendars",calendarImportFailed:"Could not read {source}: {error}",calendarActions:"Actions for {title}",calendarOpen:"Open",calendarMove:"Move",calendarNewHere:"New event here",calendarOutsideRange:"Outside the dates this calendar shows",calendarClose:"Close",calendarDetailsOf:"Details of {title}"};function calLabelsFor(labels){const out={...CALENDAR_LABELS};for(const name of Object.keys(CALENDAR_LABELS))if(Object.hasOwn(labels,name))out[name]=labels[name];return Object.freeze(out)}
1
+ (function(global){"use strict";const installed=new WeakSet();const part={version:"762f4b4b62ecb4d8",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,h,setText,fill,plural,gridButton,gridIcon,gridFreeze,cellText,cellValue,isCellObject,gridQuery,gridQueryRows,gridResultShape,gridPresenterTone,validateGridRows,validateGridPage,validateGridCursorPage,validStructuralCount,checkDocument,numberFormat,HostCellContext,disposeHostSlot,loadPart,PROTOCOL}=context;const CALENDAR_LABELS={calendarToday:"Today",calendarPrevious:"Previous period",calendarNext:"Next period",calendarViews:"Calendar view",calendarMonth:"Month",calendarWeek:"Week",calendarDay:"Day",calendarDays:"{count} days",calendarAgenda:"Agenda",calendarYear:"Year",calendarTimeline:"Timeline",calendarGoTo:"Go to date",calendarAllDay:"All day",calendarMore:"+{count} more",calendarMoreLabel:"Show {count} more events on {date}",calendarDayEvents:"Events on {date}",calendarNoEvents:"No events in this period",calendarEvents:"[one]{count} event[other]{count} events",calendarShowing:"{view}, {range}",calendarRepeats:"Repeats",calendarTruncated:"Showing the first {count} events. Narrow the period or the filters to see the rest.",calendarLoading:"Loading events…",calendarLoadError:"Could not load events: {error}",calendarNow:"Now",calendarZoom:"Zoom",calendarZoomHour:"Hours",calendarZoomDay:"Days",calendarZoomWeek:"Weeks",calendarZoomMonth:"Months",calendarZoomQuarter:"Quarters",calendarResources:"Resources",calendarCapacity:"Concurrent events",calendarCapacityAt:"{count} at once",calendarBusy:"{hours} h busy",calendarOverlaps:"[one]{count} overlap[other]{count} overlaps",calendarUnavailable:"Unavailable",calendarOutsideHours:"Outside working hours",calendarConflict:"Overlaps {title}",calendarNotAllowed:"{resource} cannot take this event",calendarMoved:"{title} moved to {time}",calendarResized:"{title} now ends {time}",calendarSeriesMoved:"Every occurrence of {title} moved",calendarSeriesTime:"Only the time of a whole series can be moved here.",calendarMoveHelp:"Arrow keys move, Shift with arrow keys changes the end, Alt with Up or Down changes the resource, Enter saves, Escape cancels.",calendarEdit:"Move or resize {title}",calendarSaveFailed:"{title} was not saved: {error}",calendarExport:"iCalendar (.ics)",calendarTimeRange:"{start} – {end}",calendarSelected:"Selected {range}",calendarLane:"{resource}, {events}",calendarHighlighted:"[one]{count} event highlighted[other]{count} events highlighted",calendarMini:"Mini month",calendarWeekList:"Week list",calendarDayList:"Day list",calendarMonths:"Months",calendarWeekNumber:"Week {number}",calendarWeekShort:"W{number}",calendarNewEvent:"New event",calendarEventTitle:"Title",calendarCreate:"Add",calendarCancel:"Cancel",calendarCreated:"{title} added on {time}",calendarReceived:"{title} scheduled on {time}",calendarOccurrenceTitle:"Change a repeating event",calendarOccurrenceReadOnly:"This part of the series cannot be saved because some values are read-only.",calendarThisEvent:"This event",calendarThisAndFollowing:"This and following events",calendarAllEvents:"All events",calendarSources:"Calendars",calendarImportFailed:"Could not read {source}: {error}",calendarActions:"Actions for {title}",calendarOpen:"Open",calendarMove:"Move",calendarNewHere:"New event here",calendarOutsideRange:"Outside the dates this calendar shows",calendarClose:"Close",calendarDetailsOf:"Details of {title}"};function calLabelsFor(labels){const out={...CALENDAR_LABELS};for(const name of Object.keys(CALENDAR_LABELS))if(Object.hasOwn(labels,name))out[name]=labels[name];return Object.freeze(out)}
2
2
  function calCount(grid,template,count,values){return fill(plural(template,count,grid.lang),{...values,count:numberFormat(grid.lang).format(count)})}
3
3
  const CAL_DAY=86400000,CAL_MINUTE=60000,CAL_HOUR=3600000;const calZones=new Map();function calDayNumber(y,m,d){return Math.floor(Date.UTC(y,m-1,d)/ CAL_DAY); }
4
4
  function calDayParts(day){const date=new Date(day*CAL_DAY);return{y:date.getUTCFullYear(),m:date.getUTCMonth()+ 1,d:date.getUTCDate(),dow:date.getUTCDay()}}
@@ -288,8 +288,9 @@ for(const[id,starts]of calOverrideMetadata(this,batch,this.calEdited(support.row
288
288
  return{...answer,rows:withheld.size?rows.filter(row=>!withheld.has(row.id)):rows,overrides,truncated:answer.truncated||withheld.size>0}}});Object.assign(DataGrid.prototype,{calParts(){const input=this.view.calendar||{},ranges=Array.isArray(input.ranges)?input.ranges:[],sources=Array.isArray(input.sources)?input.sources:[];const ics=sources.some(source=>source&&source.ics!==undefined),needs=[];if(input.recurrence!==undefined||ics||ranges.some(range=>range&&range.recurrence!==undefined))needs.push("calendar-recurrence");if(input.editable||input.create||input.drop)needs.push("calendar-edit");if(ics)needs.push("calendar-ics");return Promise.all(needs.map(name=>this.calLoadPart(name)))},calLoadPart(name){return loadPart(DataGrid.prototype.parts[name])},calExportFormat(){const grid=this;const write=this.calIcsFormatWriter=async(capture,context)=>{await grid.calLoadPart("calendar-ics");return grid.calIcsWrite(capture,context)};return{id:"ics",label:this.calLabels.calendarExport,extension:"ics",mime:"text/calendar",write}},calIcsExportColumns(explicit){const mapped=new Set(Object.values(this.cal)),columns=this.columns.filter(column=>mapped.has(column));if(columns.some(column=>column.exportable===false))throw new Error("CanopyX: iCalendar export needs every mapped calendar column to allow export.");const ids=columns.map(column=>column.id);if(explicit!==undefined&&(!Array.isArray(explicit)||ids.some(id=>!explicit.includes(id))))
289
289
  throw new Error("CanopyX: iCalendar export needs all mapped calendar columns; include their ids in the export columns.");return ids},calPrepareIcsExport(options){const columns=this.calIcsExportColumns(options.columns);return this.prepareExport({...options,columns:options.columns===undefined?columns:options.columns,values:"raw"})},async exportCalendar(options={}){await this.calLoadPart("calendar-ics");return this.calIcsExport(options)}});Object.assign(DataGrid.prototype,{startCalendar(){if(this.cal)return;this.cal=calSettings(this);this.calVersion=1;this.calEpoch=0;this.calRuleErrors=new Set();this.calEvents=[];this.calRanges=[];this.calLabels=calLabelsFor(this.labels);this.calZone=calZone(this.cal.zoneName);this.calFmt=calFormats(this.lang,this.calZone);this.calSeriesZone=calZone(this.cal.zoneFixed&&this.cal.zoneName!=="local"?this.cal.zoneName:"utc");this.calMinSegment=Math.max(15,this.cal.slotMinutes*0.75);this.calView=this.cal.view;this.calZoom=this.cal.zoom;this.calDate=this.calClampDay(this.cal.date??this.calZone.day(Date.now()));this.calCollapsed=new Set();this.defaultState.calendar={view:this.cal.view,date:null,zoom:this.cal.zoom};const signal=this.lifetime.signal,host=this.host;host.classList.add("cx-calendar");if(this.cal.toolbar===false)host.classList.add("cx-cal-bare");else if(this.cal.toolbar!==true){for(const item of CAL_TOOLBAR)if(!this.cal.toolbar.has(item))host.classList.add("cx-cal-no-"+item);if(!this.cal.toolbar.has("more")&&this.overflow){this.placeMenus?.(false);this.overflow.details.remove();this.overflow=null}}
290
290
  host.setAttribute("data-cx-event-style",this.cal.eventStyle);const root=this.calRoot=h("div","cx-cal");root.setAttribute("role","region");root.setAttribute("aria-label",this.view.label);this.calNoticeElement=h("div","cx-cal-notice");this.calNoticeElement.hidden=true;this.calNoticeElement.setAttribute("role","status");this.calBody=h("div","cx-cal-body");this.calLive=h("div","cx-live cx-sr-only");this.calLive.setAttribute("aria-live","polite");root.append(...[this.calBuildBar(),this.calBuildLegend(),this.calNoticeElement,this.calBody,this.calLive].filter(Boolean));this.grid.before(root);this.calRtl=getComputedStyle(host).direction==="rtl";host.classList.toggle("cx-cal-rtl",this.calRtl);this.calPhone=host.clientWidth>0&&host.clientWidth<=640;if(this.calPhone&&!this.initialState?.calendar)this.calView=this.cal.phone||(this.cal.views.includes("agenda")?"agenda":this.calView);this.calBody.addEventListener("keydown",event=>this.calKey(event),{signal});this.calBody.addEventListener("click",event=>this.calClick(event),{signal});this.calBody.addEventListener("focusin",event=>this.calFocusIn(event),{signal});this.calBody.addEventListener("pointerover",event=>this.calHoverOver(event),{signal});this.calBody.addEventListener("pointerout",event=>this.calHoverOut(event),{signal});for(const type of["pointerdown","keydown","wheel"])this.calBody.addEventListener(type,()=>this.calHideHover(),{signal,passive:true});this.calMenuStart();host.addEventListener("canopyx:query",()=>{const shape=gridResultShape(this.acceptedQuery||{}),same=this.calQueryShape===shape;this.calQueryShape=shape;this.calCache?.clear();this.calReload(same?{keep:true}:{})},{signal});host.addEventListener("canopyx:rowsChanged",()=>{this.calCache?.clear();this.calVersion++;this.calReload({keep:true})},{signal});host.addEventListener("canopyx:commit",()=>{this.calCache?.clear();this.calVersion++;this.calReload({keep:true})},{signal});host.addEventListener("canopyx:cellValueChanged",()=>{this.calVersion++;this.calReload({keep:true})},{signal});if(this.cal.editable||this.cal.create||this.cal.drop){host.setAttribute("data-cx-calendar-editable","true");this.calEditStart?.();this.calBody.addEventListener("pointerdown",event=>this.calDragStart(event),{signal});this.calBody.addEventListener("pointermove",event=>this.calDragMove(event),{signal});this.calBody.addEventListener("pointerup",event=>this.calDragEnd(event,false),{signal});this.calBody.addEventListener("pointercancel",event=>this.calDragEnd(event,true),{signal});this.calBody.addEventListener("lostpointercapture",event=>{if(this.calDrag?.id===event.pointerId&&!this.calDrag.started)this.calDrag=null},{signal})}
291
- let width=0,height=0;const observer=new ResizeObserver(()=>requestAnimationFrame(()=>{if(this.destroyed||!root.clientWidth)return;this.updateGridPhone();const phone=host.clientWidth<=640,changed=phone!==this.calPhone||Math.abs(root.clientWidth-width)>1||Math.abs(this.calBody.clientHeight-height)>1;width=root.clientWidth;height=this.calBody.clientHeight;const switched=phone!==this.calPhone;if(switched){this.calPhone=phone;host.classList.toggle("cx-cal-phone",phone);this.calSyncBar(false)}
292
- if(!changed||!this.calRange)return;if(switched||this.calView==="month")this.calPaint({keep:true,resize:true});else if(this.calView==="timeline")this.tlPaintLanes?.();else if(this.calScroller?.isConnected)this.calGrid.querySelector(".cx-cal-thead").style.paddingInlineEnd=Math.max(0,this.calScroller.offsetWidth-this.calScroller.clientWidth)+ "px"}));observer.observe(root);host.classList.toggle("cx-cal-phone",this.calPhone);const timer=setInterval(()=>{if(!this.destroyed&&this.cal.now)this.calTick?.()},60000);const print=on=>{if(this.destroyed||!this.calRange)return;this.calPrinting=on;host.classList.toggle("cx-cal-printing",on);this.tlPrint?.(on);if(this.calView!=="timeline")this.calPaint({keep:true,resize:true})};global.addEventListener("beforeprint",()=>print(true),{signal});global.addEventListener("afterprint",()=>print(false),{signal});signal.addEventListener("abort",()=>{observer.disconnect();clearInterval(timer);clearTimeout(this.calAnnounceTimer);this.calPrevLifetime?.abort();this.calCancelGesture?.();this.calDragEnd?.(null,true);this.calStopMoving?.();if(this.calDropDrag)this.calDropClear?.();this.calDisposeEventRenderers();root.remove();host.classList.remove("cx-calendar","cx-cal-phone","cx-cal-bare","cx-cal-rtl",...CAL_TOOLBAR.map(item=>"cx-cal-no-"+item));this.calHideHover();this.calCloseDetails(false);this.calCloseMenu(false);this.calCloseCreate?.(false);this.calCloseAsk?.(null);clearTimeout(this.calPressTimer);host.removeAttribute("data-cx-event-style");host.removeAttribute("data-cx-calendar-ready")},{once:true});calWrapHighlight();const plugin={name:"calendar-export",exportFormats:[this.calExportFormat()]};this.plugins=[...this.plugins,plugin];this.opts={...this.opts,plugins:[...this.opts.plugins||[],plugin]};this.calRange=this.calRangeOf(this.calView,this.calDate);this.calSyncBar(false);if(this.cal.resources||this.calView==="timeline")return this.calLoadTimeline()},calRangeOf(view,date){const cal=this.cal;if(view==="month"||view==="mini"){const month=calMonthStart(date),end=calAddMonths(month,1)- 1,first=calWeekStart(month,cal.firstDay);return{firstDay:first,lastDay:view==="mini"||cal.fixedWeeks?first+41:calWeekStart(end,cal.firstDay)+ 6,month}}
291
+ let width=0,height=0,resizeFrame=0;const resize=()=>{resizeFrame=0;if(this.destroyed||!root.clientWidth)return;if(root.querySelector(":active")){resizeFrame=requestAnimationFrame(resize);return}
292
+ this.updateGridPhone();const phone=host.clientWidth<=640,changed=phone!==this.calPhone||Math.abs(root.clientWidth-width)>1||Math.abs(this.calBody.clientHeight-height)>1;width=root.clientWidth;height=this.calBody.clientHeight;const switched=phone!==this.calPhone;if(switched){this.calPhone=phone;host.classList.toggle("cx-cal-phone",phone);this.calSyncBar(false)}
293
+ if(!changed||!this.calRange)return;if(switched||this.calView==="month")this.calPaint({keep:true,resize:true});else if(this.calView==="timeline")this.tlPaintLanes?.();else if(this.calScroller?.isConnected)this.calGrid.querySelector(".cx-cal-thead").style.paddingInlineEnd=Math.max(0,this.calScroller.offsetWidth-this.calScroller.clientWidth)+ "px"};const observer=new ResizeObserver(()=>{if(!resizeFrame)resizeFrame=requestAnimationFrame(resize)});observer.observe(root);host.classList.toggle("cx-cal-phone",this.calPhone);const timer=setInterval(()=>{if(!this.destroyed&&this.cal.now)this.calTick?.()},60000);const print=on=>{if(this.destroyed||!this.calRange)return;this.calPrinting=on;host.classList.toggle("cx-cal-printing",on);this.tlPrint?.(on);if(this.calView!=="timeline")this.calPaint({keep:true,resize:true})};global.addEventListener("beforeprint",()=>print(true),{signal});global.addEventListener("afterprint",()=>print(false),{signal});signal.addEventListener("abort",()=>{observer.disconnect();cancelAnimationFrame(resizeFrame);clearInterval(timer);clearTimeout(this.calAnnounceTimer);this.calPrevLifetime?.abort();this.calCancelGesture?.();this.calDragEnd?.(null,true);this.calStopMoving?.();if(this.calDropDrag)this.calDropClear?.();this.calDisposeEventRenderers();root.remove();host.classList.remove("cx-calendar","cx-cal-phone","cx-cal-bare","cx-cal-rtl",...CAL_TOOLBAR.map(item=>"cx-cal-no-"+item));this.calHideHover();this.calCloseDetails(false);this.calCloseMenu(false);this.calCloseCreate?.(false);this.calCloseAsk?.(null);clearTimeout(this.calPressTimer);host.removeAttribute("data-cx-event-style");host.removeAttribute("data-cx-calendar-ready")},{once:true});calWrapHighlight();const plugin={name:"calendar-export",exportFormats:[this.calExportFormat()]};this.plugins=[...this.plugins,plugin];this.opts={...this.opts,plugins:[...this.opts.plugins||[],plugin]};this.calRange=this.calRangeOf(this.calView,this.calDate);this.calSyncBar(false);if(this.cal.resources||this.calView==="timeline")return this.calLoadTimeline()},calRangeOf(view,date){const cal=this.cal;if(view==="month"||view==="mini"){const month=calMonthStart(date),end=calAddMonths(month,1)- 1,first=calWeekStart(month,cal.firstDay);return{firstDay:first,lastDay:view==="mini"||cal.fixedWeeks?first+41:calWeekStart(end,cal.firstDay)+ 6,month}}
293
294
  if(view==="months"){const month=calMonthStart(date);return{firstDay:month,lastDay:calAddMonths(month,cal.months)- 1,month}}
294
295
  if(view==="week"||view==="weekList"){const first=calWeekStart(date,cal.firstDay);return{firstDay:first,lastDay:first+6}}
295
296
  if(view==="day"||view==="dayList")return{firstDay:date,lastDay:date};if(view==="days"){let last=date;for(let shown=0;shown<this.calDaysCount();last++)if(!cal.hidden.has(calDow(last)))shown++;return{firstDay:date,lastDay:last-1}}
@@ -1,11 +1,11 @@
1
- (function(global){"use strict";const installed=new WeakSet();const part={version:"6c96974326d65a4c",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,GRID_ROWS,GRID_REPORTING,h,setText,fill,gridButton,gridFreeze,cellText,formatting,labelsFor,requireIdentifier,GridRowOffsets,TreeGrid,createDataGrid,createTreeGrid,disposeRowHostCells,OWN_ARROWS,hostHtml}=context;const ROWS_BASE={};for(const name of["render","renderPass","trimInactiveCache","syncRowOffsets","setFocus","onKey","fillRow","destroy"])
1
+ (function(global){"use strict";const installed=new WeakSet();const part={version:"4908d1d2b7f67aa8",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,GRID_ROWS,GRID_REPORTING,h,setText,fill,gridButton,gridFreeze,cellText,formatting,labelsFor,requireIdentifier,GridRowOffsets,TreeGrid,createDataGrid,createTreeGrid,disposeRowHostCells,OWN_ARROWS,hostHtml}=context;const ROWS_BASE={};for(const name of["render","renderPass","trimInactiveCache","syncRowOffsets","setFocus","onKey","fillRow","destroy"])
2
2
  ROWS_BASE[name]=DataGrid.prototype[name];GRID_ROWS.view=ROWS_BASE;function rowsLowerBound(list,value){let low=0,high=list.length;while(low<high){const middle=(low+high)>>>1;if(list[middle]<value)low=middle+1;else high=middle}
3
3
  return low}
4
4
  function rowsAtOrBefore(list,value,field){let low=0,high=list.length;while(low<high){const middle=(low+high)>>>1;if(list[middle][field]<=value)low=middle+1;else high=middle}
5
5
  return low?list[low-1]:null}
6
6
  function rowsResolve(segment,k){const list=segment.details,first=segment.first;let low=0,high=list.length;while(low<high){const middle=(low+high)>>>1;if(list[middle]- first+middle+1<k)low=middle+1;else high=middle}
7
7
  return low<list.length&&list[low]- first+low+1===k?[list[low],true]:[first+k-low,false]}
8
- Object.assign(DataGrid.prototype,{prepareRowProjection(){this.resolveDetails();const bounds=this.rowBounds(),groups=this.projectionGroups?.()||null;const key=[this.snapshot,groups,bounds.first,bounds.last,this.groupCollapseVersion||0,this.detailVersion||0,this.rowH];if(this.rowProjectionKey?.every((value,index)=>value===key[index]))return;const previous=this.rowProjection,sameResult=previous&&this.rowProjectionKey[0]===this.snapshot,top=this.logicalTop();const anchorIndex=sameResult&&previous.rowCount()?previous.rowAt(top):-1;const anchor=anchorIndex>=0?{item:previous.rowItem(anchorIndex),offset:top-previous.rowTop(anchorIndex)}:null;const details=this.detailOrdinals||[],segments=[],runs=[],headers=new Map();let count=0;const run=(first,last)=>{if(first>last)return;const list=details.slice(rowsLowerBound(details,first),rowsLowerBound(details,last+1));const segment={start:count,length:last-first+1+list.length,first,last,details:list};segments.push(segment);runs.push(segment);count +=segment.length};const walk=(list,level,path)=>{for(const group of list){const first=Math.max(bounds.first,group.offset),last=Math.min(bounds.last,group.offset+group.count-1);if(first>last)continue;headers.set(group.key,count);segments.push({start:count,length:1,header:this.groupHeader(group,level,path)});count++;if(this.collapsedGroups?.has(group.key))continue;if(group.groups?.length)walk(group.groups,level+1,[...path,group]);else run(first,last)}};if(groups)walk(groups,1,[]);else run(bounds.first,bounds.last);const recordIndex=ordinal=>{const segment=rowsAtOrBefore(runs,ordinal,"first");return!segment||ordinal>segment.last?-1:segment.start+ordinal-segment.first+rowsLowerBound(segment.details,ordinal)};const offsets=new GridRowOffsets(count,this.rowH);for(const segment of runs)segment.details.forEach((ordinal,index)=>{const height=this.detailHeights?.get(this.detailKeyAt(ordinal));offsets.set(segment.start+ordinal-segment.first+index+1,height??this.detailEstimate())});if(this.autoRows)for(const[ordinal,height]of this.rowHeights){const index=recordIndex(ordinal);if(index>=0)offsets.set(index,height)}
8
+ Object.assign(DataGrid.prototype,{prepareRowProjection(){this.resolveDetails();const bounds=this.rowBounds(),groups=this.projectionGroups?.()||null;const key=[this.snapshot,groups,bounds.first,bounds.last,this.groupCollapseVersion||0,this.detailVersion||0,this.rowH,this.autoRows];if(this.rowProjectionKey?.every((value,index)=>value===key[index]))return;const previous=this.rowProjection,sameResult=previous&&this.rowProjectionKey[0]===this.snapshot,top=this.logicalTop();const anchorIndex=sameResult&&previous.rowCount()?previous.rowAt(top):-1;const anchor=anchorIndex>=0?{item:previous.rowItem(anchorIndex),offset:top-previous.rowTop(anchorIndex)}:null;const details=this.detailOrdinals||[],segments=[],runs=[],headers=new Map();let count=0;const run=(first,last)=>{if(first>last)return;const list=details.slice(rowsLowerBound(details,first),rowsLowerBound(details,last+1));const segment={start:count,length:last-first+1+list.length,first,last,details:list};segments.push(segment);runs.push(segment);count +=segment.length};const walk=(list,level,path)=>{for(const group of list){const first=Math.max(bounds.first,group.offset),last=Math.min(bounds.last,group.offset+group.count-1);if(first>last)continue;headers.set(group.key,count);segments.push({start:count,length:1,header:this.groupHeader(group,level,path)});count++;if(this.collapsedGroups?.has(group.key))continue;if(group.groups?.length)walk(group.groups,level+1,[...path,group]);else run(first,last)}};if(groups)walk(groups,1,[]);else run(bounds.first,bounds.last);const recordIndex=ordinal=>{const segment=rowsAtOrBefore(runs,ordinal,"first");return!segment||ordinal>segment.last?-1:segment.start+ordinal-segment.first+rowsLowerBound(segment.details,ordinal)};const offsets=new GridRowOffsets(count,this.rowH);for(const segment of runs)segment.details.forEach((ordinal,index)=>{const height=this.detailHeights?.get(this.detailKeyAt(ordinal));offsets.set(segment.start+ordinal-segment.first+index+1,height??this.detailEstimate())});if(this.autoRows)for(const[ordinal,height]of this.rowHeights){const index=recordIndex(ordinal);if(index>=0)offsets.set(index,height)}
9
9
  const projection={rowCount:()=>count,rowAt:top=>offsets.at(top),rowTop:index=>offsets.top(index),recordIndex,rowItem:index=>{const segment=rowsAtOrBefore(segments,index,"start");if(!segment||index>=segment.start+segment.length)return null;if(segment.header)return segment.header;const[ordinal,detail]=rowsResolve(segment,index-segment.start);return detail?this.detailItem(ordinal):this.rowItem(ordinal)},indexOf:row=>{if(!row)return -1;if(row.group)return this.groupHeaders?.get(row.group.key)===row?headers.get(row.group.key)??-1:-1;if(row.status==="detail"){const index=this.detailRecords?.get(row.detailOf)===row&&details.includes(row.ordinal)?recordIndex(row.ordinal):-1;return index<0?-1:index+1}
10
10
  return row._ri<0||this.indexOf(row)<0?-1:recordIndex(row._ri)},recordWindow:(first,last)=>{const ranges=[];for(const segment of runs){const start=Math.max(first,segment.start),end=Math.min(last,segment.start+segment.length-1);if(start<=end)ranges.push({first:rowsResolve(segment,start-segment.start)[0],last:rowsResolve(segment,end-segment.start)[0]})}
11
11
  return{first:ranges[0]?.first??bounds.first,last:ranges.at(-1)?.last??-1,ranges}}};this.rowProjection=projection;this.rowProjectionKey=key;this.rowOffsets=offsets;this.rowOffsetOwner=projection;this.rowOffsetFirst=bounds.first;this.relocateFocus?.(projection);this.total=offsets.top(count);this.grid.setAttribute("aria-rowcount",String(count +(this.summaryControls?.parentElement===this.grid?2:1)+(this.headDepth||0)));const index=anchor?projection.indexOf(anchor.item):-1;this.syncScrollRange(index>=0?projection.rowTop(index)+ anchor.offset:top)},syncRowOffsets(){if(!this.rowProjection)ROWS_BASE.syncRowOffsets.call(this)},render(){if(!this.rowsAttached)return ROWS_BASE.render.call(this);if(!this.destroyed&&this.acceptedQuery){this.acceptRows?.();this.prepareRowProjection()}
@@ -1,4 +1,5 @@
1
- (function(global){"use strict";const installed=new WeakSet();const part={version:"99cafeec3da59ffa",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,h,setText,gridButton,gridInputLabel,gridOption,gridScalar,gridDateInputMoment,gridQuery,gridQueryStart,GRID_FILTER_LABELS,gridResultShape,gridQueryRows,gridOrder,gridColumnProjection,gridCellRenderer,cellValue,cellText,foldText,reachable,gridMatchesGroup,gridDecorateButton,gridIcon,numberFormat,numberText,fill,announceMenu,reportingRangeRows,applyTone,toneOf,badgeElement,isCellObject,RECORD_IMPL}=context;const buildFilters=DataGrid.prototype.buildGridFilters;function gridOverlayTheme(grid,element){element.setAttribute("data-cx-theme",grid.host.getAttribute("data-cx-theme"));const theme=getComputedStyle(grid.host);element.style.colorScheme=theme.colorScheme;for(const name of theme)if(name.startsWith("--cx-"))element.style.setProperty(name,theme.getPropertyValue(name))}
1
+ (function(global){"use strict";const installed=new WeakSet();const part={version:"8a058a87bbba3cbe",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,h,setText,gridButton,gridInputLabel,gridOption,gridScalar,gridDateInputMoment,gridQuery,gridQueryStart,GRID_FILTER_LABELS,gridResultShape,gridQueryRows,gridOrder,gridColumnProjection,gridCellRenderer,cellValue,cellText,foldText,reachable,gridMatchesGroup,gridDecorateButton,gridIcon,numberFormat,numberText,fill,announceMenu,reportingRangeRows,applyTone,toneOf,badgeElement,isCellObject,RECORD_IMPL}=context;const buildFilters=DataGrid.prototype.buildGridFilters;function gridOverlayTheme(grid,element){for(const name of(grid.opts.overlayClass||"").split(/\s+/).filter(Boolean)) element.classList.add(name);
2
+ element.setAttribute("data-cx-theme",grid.host.getAttribute("data-cx-theme"));const theme=getComputedStyle(grid.host);element.style.colorScheme=theme.colorScheme;for(const name of theme)if(name.startsWith("--cx-"))element.style.setProperty(name,theme.getPropertyValue(name))}
2
3
  function gridRestoreFocus(grid,returnFocus,rowId,column){if(grid.destroyed)return;if(returnFocus?.isConnected&&reachable(returnFocus)){returnFocus.focus({preventScroll:true});return}
3
4
  const row=[...grid.rowCache.values()].find(item=>!item.status&&item.key===rowId);const index=grid.visibleColumns().findIndex(item=>item.id===column?.id);if(row&&index>=0)grid.focusCell(row,index,0);else if(row)grid.setFocus(row,true);else grid.grid.focus({preventScroll:true})}
4
5
  const COLUMNS_MENU={moveColumnChoice(column,target,after){column.pin=target.pin;const ids=this.columns.map(item=>item.id).filter(id=>id!==column.id);ids.splice(ids.indexOf(target.id)+ after,0,column.id);this.setColumnOrder(ids)},renderGridColumns(panel){if(!this.columnList){const find=this.columnFind=h("input","cx-grid-column-find"),actions=h("div","cx-grid-column-actions");find.type="search";find.placeholder=this.labels.gridFindColumn;find.setAttribute("aria-label",find.placeholder);find.hidden=this.columns.length<9;find.oninput=()=>this.syncColumnControls();actions.append(gridButton(this.labels.gridShowAllColumns,()=>this.showAllColumns()),gridButton(this.labels.gridResetColumns,()=>this.resetColumns()));panel.replaceChildren(find,this.columnList=h("div"),actions)}
@@ -1,4 +1,4 @@
1
- (function(global){"use strict";const installed=new WeakSet();const part={version:"6f9f3c51b0ad2a0e",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,h,setText,setClass,fill,gridFreeze,gridDateInputMoment,cellValue,cellText,foldText,toneOf,numberFormat,gridButton,gridOption,gridInputLabel,gridIcon,gridDecorateButton,GRID_REPORTING,loadPart,definePart,announceMenu,boundedPattern,wildcardMatch,svgIcon}=context;const FORMAT_OPERATORS={eq:1,ne:1,gt:1,ge:1,lt:1,le:1,contains:1,notContains:1,startsWith:1,endsWith:1,like:1,notLike:1,matches:1,notMatches:1,in:-1,notIn:-1,between:2,betweenExclusive:2,isNull:0,isNotNull:0,olderThan:1,withinLast:1};const FORMAT_TYPES=["text","number","boolean","date"],FORMAT_DAY=86400000;function formatError(message){throw new Error("CanopyX: "+message)}
1
+ (function(global){"use strict";const installed=new WeakSet();const part={version:"1a28068597f435de",install(context){if(installed.has(context.DataGrid.prototype))return;const{DataGrid,h,setText,setClass,fill,gridFreeze,gridDateInputMoment,cellValue,cellText,foldText,toneOf,numberFormat,gridButton,gridOption,gridInputLabel,gridIcon,gridDecorateButton,GRID_REPORTING,loadPart,definePart,announceMenu,boundedPattern,wildcardMatch,svgIcon}=context;const FORMAT_OPERATORS={eq:1,ne:1,gt:1,ge:1,lt:1,le:1,contains:1,notContains:1,startsWith:1,endsWith:1,like:1,notLike:1,matches:1,notMatches:1,in:-1,notIn:-1,between:2,betweenExclusive:2,isNull:0,isNotNull:0,olderThan:1,withinLast:1};const FORMAT_TYPES=["text","number","boolean","date"],FORMAT_DAY=86400000;function formatError(message){throw new Error("CanopyX: "+message)}
2
2
  function formatKeys(value,keys,what){if(!value||typeof value!=="object"||Array.isArray(value)||Object.keys(value).some(key=>!keys.includes(key)))formatError("invalid "+what+".")}
3
3
  const formatCultures=new Map();function formatCulture(culture){let entry=formatCultures.get(culture);if(!entry){let tag;try{tag=Intl.getCanonicalLocales(culture)[0]}catch(_){formatError("unknown culture '"+culture+"'.")}
4
4
  const parts=new Intl.NumberFormat(tag).formatToParts(12345.6),part=type=>(parts.find(item=>item.type===type)||{}).value;entry={tag,group:part("group")||",",decimal:part("decimal")||".",accent:new Intl.Collator(tag,{sensitivity:"accent"}),variant:new Intl.Collator(tag,{sensitivity:"variant"})};if(formatCultures.size<64)formatCultures.set(culture,entry)}
@@ -59,8 +59,9 @@ function formatFinish(target){if(!target)return target;if(target.icon===undefine
59
59
  Object.assign(DataGrid.prototype,{formatResult(data,details=false){const rules=this.formatCompiled;if(!rules||!rules.length)return null;const cache=details?this.formatDetailCache||=new WeakMap():this.formatCache;const stats=formatStats(this),cached=cache.get(data);if(cached&&cached.version===this.formatVersion)return cached.result;let row=null,cells=null;for(const rule of rules){if(!rule.enabled||rule.test&&!rule.test(data))continue;const style=formatResolve(rule,data,stats);if(style&&(!details||rule.details)){if(rule.target==="row")row=formatMerge(row,rule,style);else for(const id of rule.columns)(cells||=new Map()).set(id,formatMerge(cells.get(id),rule,style))}
60
60
  if(rule.stop)break}
61
61
  if(cells)for(const target of cells.values())formatFinish(target);const result=row||cells?{row:formatFinish(row),cells:cells||new Map()}:null;cache.set(data,{version:this.formatVersion,result});return result}});const FORMAT_RANK={danger:5,warning:4,info:3,success:2,neutral:1,muted:1};function formatUndo(fx){for(const node of fx.nodes)node.remove();for(const name of fx.props)fx.element.style.removeProperty(name);for(const name of fx.classes)fx.element.classList.remove(name)}
62
- function formatClear(element){for(const slot of element._cells||[])if(slot&&slot.fx){formatUndo(slot.fx);slot.fx=null}
63
- if(element._fx){formatUndo(element._fx);element._fx=null}}
62
+ function formatClearSlot(slot){if(slot.fx){formatUndo(slot.fx);slot.fx=null}
63
+ for(const child of slot.childSlots||[])formatClearSlot(child)}
64
+ function formatClear(element){for(const slot of element._cells||[])if(slot)formatClearSlot(slot);if(element._fx){formatUndo(element._fx);element._fx=null}}
64
65
  function formatEffects(element){return{element,nodes:[],props:[],classes:[]}}
65
66
  function formatDecorate(element,target,fx,before,emphasis){const add=name=>{if(!element.classList.contains(name)){element.classList.add(name);fx.classes.push(name)}};const prop=(target,name,value)=>{target.style.setProperty(name,value);if(target===element)fx.props.push(name)};const node=(tag,className,text)=>{const item=h(tag,className);if(text)setText(item,text);fx.nodes.push(item);return item};if(target.tone&&emphasis){add("cx-fmt-" +(target.bar||target.scale?"text":target.emphasis||emphasis));prop(element,"--cx-fmt",formatToneVar(target.tone))}
66
67
  if(target.scale){add("cx-fmt-scale");prop(element,"--cx-fmt-scale",target.scale)}
@@ -73,9 +74,9 @@ if(target.cue)element.appendChild(node("span","cx-fmt-cue",target.cue));if(targe
73
74
  const formatCues=target=>({glyph:target.glyph,badge:target.badge,cue:target.cue,tone:target.tone,descriptions:target.descriptions});const FORMAT_PAINT=DataGrid.prototype.paintGridHighlights;DataGrid.prototype.paintGridHighlights=function(element,row){FORMAT_PAINT.call(this,element,row);formatClear(element);const result=!row.status&&this.formatResult&&this.formatResult(row.h);if(!result)return;const slots=element._cells,first=slots[0];if(result.row){const own=result.row;if(own.tone||own.className||own.css){const fx=element._fx=formatEffects(element);setClass(element,element._cls +(own.tone?" cx-fmt-row":"")+(own.className?" "+own.className:""));if(own.tone){element.style.setProperty("--cx-fmt",formatToneVar(own.tone));fx.props.push("--cx-fmt")}
74
75
  if(own.css)for(const name of Object.keys(own.css)){element.style.setProperty(name,own.css[name]);fx.props.push(name)}}
75
76
  if(first){first.fx=formatEffects(first.cell);first.highlighted=true;formatDecorate(first.cell,formatCues(result.row),first.fx,first.textSpan)}}
76
- for(let i=0;i<this.cols.length;i++){const target=result.cells.get(this.cols[i].id),slot=slots[i];if(!target||!slot)continue;if(!slot.fx||slot.fx.element!==slot.cell)slot.fx=formatEffects(slot.cell);slot.highlighted=true;formatDecorate(slot.cell,target,slot.fx,slot.textSpan,"fill")}
77
- if(first&&first.hiddenFields){const details=this.formatResult(row.h,true);if(details)this.formatHiddenFields(first,details)}};const formatFlag=target=>target&&target.details&&(target.tone||target.glyph||target.badge||target.cue);DataGrid.prototype.formatHiddenFields=function(slot,result){const button=slot.hiddenFields,hidden=this.columns.filter(column=>(column.hidden||column.responsiveHidden||column.fitHidden)&&formatFlag(result.cells.get(column.id)));if(!hidden.length)return;let tone=null;for(const column of hidden){const next=result.cells.get(column.id).tone;if(next&&(FORMAT_RANK[next]||3)>(FORMAT_RANK[tone]||0))tone=next}
78
- const fx=slot.fx||(slot.fx=formatEffects(slot.cell)),effects=formatEffects(button),label=button.getAttribute("aria-label");fx.nodes.push({remove(){formatUndo(effects);button.setAttribute("aria-label",label)}});effects.classes.push("cx-fmt-flag");button.classList.add("cx-fmt-flag");button.style.setProperty("--cx-fmt",tone?formatToneVar(tone):"var(--cx-text-2)");effects.props.push("--cx-fmt");const rules=[...new Set(hidden.flatMap(column=>result.cells.get(column.id).descriptions))].join(", ");button.setAttribute("aria-label",label+". "+fill(this.formatLabels.formatHiddenFlagged,{count:hidden.length,rules}))};const FORMAT_MEASURE=DataGrid.prototype.measureGridColumn;DataGrid.prototype.measureGridColumn=function(column){if(column.formatMinW!==undefined){column.minW=column.formatMinW;delete column.formatMinW}
77
+ const columns=this.cols.concat(this.phoneLineColumns()),paintSlots=slots.concat(first?.childSlots||[]);for(let i=0;i<columns.length;i++){const target=result.cells.get(columns[i].id),slot=paintSlots[i];if(!target||!slot)continue;if(!slot.fx||slot.fx.element!==slot.cell)slot.fx=formatEffects(slot.cell);slot.highlighted=true;formatDecorate(slot.cell,target,slot.fx,slot.textSpan,"fill")}
78
+ if(first&&first.hiddenFields){const details=this.formatResult(row.h,true);if(details)this.formatHiddenFields(first,details)}};const formatFlag=target=>target&&target.details&&(target.tone||target.glyph||target.badge||target.cue);DataGrid.prototype.formatHiddenFields=function(slot,result){const button=slot.hiddenFields,hidden=this.phoneRemainingColumns().filter(column=>formatFlag(result.cells.get(column.id)));if(!hidden.length)return;let tone=null;for(const column of hidden){const next=result.cells.get(column.id).tone;if(next&&(FORMAT_RANK[next]||3)>(FORMAT_RANK[tone]||0))tone=next}
79
+ const fx=slot.fx||(slot.fx=formatEffects(slot.cell)),effects=formatEffects(button),label=button.getAttribute("aria-label");let decorated;fx.nodes.push({remove(){formatUndo(effects);if(button.getAttribute("aria-label")===decorated)button.setAttribute("aria-label",label)}});effects.classes.push("cx-fmt-flag");button.classList.add("cx-fmt-flag");button.style.setProperty("--cx-fmt",tone?formatToneVar(tone):"var(--cx-text-2)");effects.props.push("--cx-fmt");const rules=[...new Set(hidden.flatMap(column=>result.cells.get(column.id).descriptions))].join(", ");decorated=label+". "+fill(this.formatLabels.formatHiddenFlagged,{count:hidden.length,rules});button.setAttribute("aria-label",decorated)};const FORMAT_MEASURE=DataGrid.prototype.measureGridColumn;DataGrid.prototype.measureGridColumn=function(column){if(column.formatMinW!==undefined){column.minW=column.formatMinW;delete column.formatMinW}
79
80
  const result=FORMAT_MEASURE.call(this,column);if(!this.formatCompiled||!this.formatCompiled.length||!this.fitContext||!this.fitFont)return result;const context=this.fitContext,[font,small,,pad]=this.fitFont,first=column===this.columns.find(item=>!item.hidden);const measure=(text,face)=>{context.font=face;return context.measureText(String(text).slice(0,512)).width};let need=0,floor=0,sampled=0;for(const row of this.rowCache.values()){if(sampled++===200)break;const formats=this.formatResult(row.h),own=formats&&formats.cells.get(column.id),cues=first&&formats&&formats.row;if(!own&&!cues)continue;let width=measure(cellText(row.h.cells[column.id],column,this.fmt)||"—",font),flag=false;for(const target of[own,cues])if(target){if(target.glyph){width +=20;flag=true}
80
81
  if(target.badge){width +=measure(target.badge,small)+ 20;flag=true}
81
82
  if(target.cue){width +=measure(target.cue,small)+ 6;flag=true}