view x/static/js/8546.0a89cbee.chunk.js @ 133:cec274db51c0 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 7d28252954cae9f8db5f8a85d8f29cb2865b504b-dirty
author fubar
date Fri, 18 Oct 2024 11:57:55 +0000
parents 49f3d3878413
children
line wrap: on
line source

"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[8546],{78546:(e,t,n)=>{n.r(t),n.d(t,{default:()=>me});var o=n(7552),l=n(67314),r=n(75785),a=n(68446),s=n(49823),c=n(48171),i=n(22679),m=n(83867),d=n(56089),u=n(33371),p=n(33248),g=n(32808),b=n(5401),h=n(36422),E=n(99546),f=n(1343);const w=(0,r.n9)()({textField:{width:"2rem",verticalAlign:"baseline"}}),v=(0,a.observer)((function({model:e,disabled:t,modelPropName:n,modelSetterName:l}){const[r,a]=(0,o.useState)(e[n]),{classes:s}=w();return(0,o.useEffect)((()=>{const t=Number.parseInt(r,10);Number.isNaN(t)||(t>0?e[l](t):a(1))}),[e,l,r]),o.createElement(f.A,{value:r,disabled:t,type:"number",onChange:e=>{a(e.target.value)},className:s.textField})})),N=(0,r.n9)()({container:{margin:"0 auto",maxWidth:"25em",padding:20}}),C=(0,a.observer)((({model:e})=>{const t=(0,E.getSession)(e),{classes:n}=N(),{assemblyNames:l,assemblyManager:r}=t,{fileType:a,canCancel:f,fileSource:w,isReadyToOpen:C,fileTypes:y,hasColumnNameLine:A,error:M}=e,[k,S]=(0,o.useState)(l[0]),P=r.get(k)?.error||M,x="CSV"===a||"TSV"===a,F=(0,h.getRoot)(e);return o.createElement("div",{className:n.container},P?o.createElement(s.ErrorMessage,{error:P}):null,o.createElement("div",null,o.createElement(c.A,{component:"fieldset"},o.createElement(i.A,{component:"legend"},"Tabular file"),o.createElement(m.A,null,o.createElement(s.FileSelector,{location:w,setLocation:t=>{e.setFileSource(t)},rootModel:F})))),o.createElement("div",null,o.createElement(c.A,{component:"fieldset"},o.createElement(i.A,{component:"legend"},"File Type"),o.createElement(d.A,{row:!0,"aria-label":"file type",name:"type",value:a},y.map((t=>o.createElement(u.A,{key:t,checked:a===t,value:t,onClick:()=>{e.setFileType(t)},control:o.createElement(p.A,null),label:t})))))),x?o.createElement("div",null,o.createElement(c.A,{component:"fieldset"},o.createElement(i.A,{component:"legend"},"Column Names"),o.createElement(u.A,{disabled:!x,label:"has column names on line",labelPlacement:"end",control:o.createElement(g.A,{checked:A,onClick:()=>{e.toggleHasColumnNameLine()}})}),o.createElement(v,{model:e,disabled:!A,modelPropName:"columnNameLineNumber",modelSetterName:"setColumnNameLineNumber"}))):null,o.createElement("div",null,o.createElement(s.AssemblySelector,{session:t,selected:k,onChange:e=>{S(e)}})),o.createElement("div",null,f?o.createElement(b.A,{variant:"contained",color:"secondary",onClick:()=>{e.cancelButton()},disabled:!f},"Cancel"):null," ",o.createElement(b.A,{disabled:!C||!!P,variant:"contained","data-testid":"open_spreadsheet",color:"primary",onClick:()=>{e.import(k)}},"Open")))})),y=(0,a.observer)((function({viewModel:e,spreadsheetModel:t}){const n=t.rowMenuPosition,{setRowMenuPosition:l}=t,r=()=>{l(null)},a=t.rowMenuPosition?.rowNumber;if(void 0===a)return null;const c=t.rowSet.rows[+a-1],i=e.rowMenuItems.map((n=>{if("function"==typeof n.disabled){const o=n.disabled(e,t,+a,c);return{...n,disabled:o}}return n}));return o.createElement(s.Menu,{anchorEl:n?.anchorEl,open:Boolean(n),onMenuItemClick:function(n,o){o(e,t,a,c),r()},onClose:r,menuItems:i,anchorOrigin:{vertical:"bottom",horizontal:"right"}})}));var A=n(61723),M=n(86743),k=n(32813);const S=(0,a.observer)((function({cell:e,spreadsheetModel:t,columnNumber:n}){const l=t.columns[n];return l&&"dataType"in l&&l.dataType.DataCellReactComponent?o.createElement(l.dataType.DataCellReactComponent,{cell:e,dataType:l.dataType,columnNumber:n,spreadsheet:t}):e.text})),P=(0,r.n9)()((e=>({rowNumCell:{textAlign:"left",border:`1px solid ${e.palette.action.disabledBackground}`,position:"relative",padding:"0 2px 0 0",whiteSpace:"nowrap",userSelect:"none"},rowNumber:{fontWeight:"normal",display:"inline-block",flex:"none",paddingRight:"20px",margin:0,whiteSpace:"nowrap"},rowMenuButton:{padding:0,margin:0,position:"absolute",right:0,display:"inline-block",whiteSpace:"nowrap",flex:"none"},rowMenuButtonIcon:{},rowSelector:{position:"relative",top:"-2px",margin:0,padding:"0 0.2rem"},dataRowSelected:{background:M.A[100],"& th":{background:M.A[100]}}}))),x=(0,a.observer)((function({rowModel:e,rowNumber:t,spreadsheetModel:n}){const{classes:l}=P(),{hideRowSelection:r,columnDisplayOrder:a}=n;let s="";function c(t){e.toggleSelect(),t.stopPropagation(),t.preventDefault()}return e.isSelected&&(s+=l.dataRowSelected),o.createElement("tr",{className:s},o.createElement("td",{className:l.rowNumCell,onClick:c},r?o.createElement(u.A,{className:l.rowNumber,control:o.createElement(g.A,{className:l.rowSelector,checked:e.isSelected,onClick:c}),label:e.id}):null,o.createElement(A.A,{className:l.rowMenuButton,onClick:e=>{n.setRowMenuPosition({anchorEl:e.currentTarget,rowNumber:t}),e.preventDefault(),e.stopPropagation()}},o.createElement(k.A,{className:l.rowMenuButtonIcon}))),a.map((t=>o.createElement("td",{key:t},o.createElement(S,{cell:e.cellsWithDerived[t],spreadsheetModel:n,columnNumber:t})))))}));var F=n(89003),T=n(52521),I=n(79529),R=n(47103),B=n(35099),z=n(91049);const L=(0,a.observer)((function({viewModel:e,spreadsheetModel:t,currentColumnMenu:n,setColumnMenu:l}){const r=()=>{l(void 0)},a=n?.colNumber||0,c=e=>{t.setSortColumns([{columnNumber:a,descending:e}])},{dataTypeChoices:i}=t,m=new Map;i.forEach((e=>{const{displayName:t,categoryName:n}=e;if(n){let t=m.get(n);t||(t={isCategory:!0,subMenuItems:[]},m.set(n,t)),t.subMenuItems.push(e)}else m.set(t,e)}));const{columns:d,sortColumns:u}=t,p=n&&d[a].dataType,g=p?.type||"",b=n&&d[a].dataType.displayName||"",h=!!n&&u.some((e=>e.columnNumber===n.colNumber&&!e.descending)),f=!!n&&u.some((e=>e.columnNumber===n.colNumber&&e.descending)),w=[{label:"Sort ascending",icon:z.A,type:"radio",checked:h,onClick:()=>{c(!1)}},{label:"Sort descending",icon:z.A,type:"radio",checked:f,onClick:()=>{c(!0)}},{label:"No sort",icon:z.A,type:"radio",checked:!f&&!h,onClick:()=>{t.setSortColumns([])}},{label:`Type: ${b}`,icon:B.A,subMenu:(0,E.iterMap)(m.entries(),(([e,n])=>{if("typeName"in n&&n.typeName){const{typeName:o}=n;return{label:e||o,icon:g===o?I.A:void 0,onClick:()=>{t.setColumnType(a,o)}}}if("subMenuItems"in n&&n.subMenuItems){const{subMenuItems:o}=n;return{label:e,icon:o.some((e=>e.typeName===g))?I.A:void 0,subMenu:o.map((({typeName:e,displayName:n})=>({label:n,icon:e===g?I.A:void 0,onClick:()=>{t.setColumnType(a,e)}})))}}return null})).filter(Boolean)}];return p?.hasFilter&&w.push({label:"Create filter",icon:R.A,onClick:()=>{e.filterControls.addBlankColumnFilter(a)}}),o.createElement(s.Menu,{anchorEl:n?.anchorEl,open:Boolean(n),onMenuItemClick:(e,t)=>{t(),r()},onClose:r,menuItems:w,anchorOrigin:{vertical:"bottom",horizontal:"right"}})}));var $=n(21430),D=n(66195);const O=(0,r.n9)()({sortIndicator:{position:"relative",top:"0.2rem",fontSize:"1rem"}});function H({model:e,columnNumber:t}){const{classes:n}=O(),l=e.sortColumns.find((e=>e.columnNumber===t));if(l){const{descending:e}=l;return e?o.createElement($.A,{className:n.sortIndicator}):o.createElement(D.A,{className:n.sortIndicator})}return null}function W(e){return String.fromCharCode(e+65)}const _=(0,r.n9)()((e=>({columnHead:{fontWeight:"normal",background:"dark"===e.palette.mode?"#333":"#eee",position:"sticky",top:0,zIndex:2,whiteSpace:"nowrap"},columnButtonContainer:{display:"none",position:"absolute",right:0,top:0,background:e.palette.background.paper,height:"100%"},topLeftCorner:{background:"dark"===e.palette.mode?"#333":"#eee",zIndex:2,position:"sticky",top:0,minWidth:e.spacing(2),textAlign:"left"}}))),j=(0,a.observer)((function({model:e}){const{classes:t}=_(),{columnDisplayOrder:n,columns:l,hasColumnNames:r,rowSet:a}=e,[s,c]=(0,o.useState)(),[i,m]=(0,o.useState)();return o.createElement(o.Fragment,null,o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",{className:t.topLeftCorner},o.createElement(F.A,{title:"Unselect all",placement:"right"},o.createElement("span",null,o.createElement(A.A,{onClick:()=>{e.unselectAll()},disabled:!a.selectedCount},o.createElement(T.A,null))))),n.map((n=>o.createElement("th",{className:t.columnHead,key:n,onMouseOver:()=>{m(n)},onMouseOut:()=>{m(void 0)}},o.createElement(H,{model:e,columnNumber:n}),r&&l[n].name||function(e){if(e>=0){if(e<26)return W(e);if(e<702)return W(Math.floor(e/26-1))+W(e%26)}throw new RangeError("column number out of range")}(n),o.createElement("div",{className:t.columnButtonContainer,style:{display:i===n||s?.colNumber===n?"block":"none"}},o.createElement(A.A,{onClick:e=>{c({colNumber:n,anchorEl:e.currentTarget})}},o.createElement(k.A,null)))))))),o.createElement(L,{viewModel:(0,h.getParent)(e),spreadsheetModel:e,currentColumnMenu:s,setColumnMenu:c}))})),V=(0,r.n9)()((e=>({dataTable:{borderCollapse:"collapse","& td":{border:`1px solid ${e.palette.action.disabledBackground}`,padding:"0.2rem",maxWidth:"50em",overflow:"hidden",textOverflow:"ellipsis"}},emptyMessage:{captionSide:"bottom"}}))),G=(0,a.observer)((function({rows:e,spreadsheetModel:t,page:n,rowsPerPage:l}){return o.createElement("tbody",null,e.slice(l*n,l*(n+1)).map((e=>o.createElement(x,{key:e.id,rowNumber:e.id,spreadsheetModel:t,rowModel:e}))))})),U=(0,a.observer)((function({model:e,page:t,rowsPerPage:n}){const{rowSet:l}=e,{classes:r}=V(),a=l.sortedFilteredRows;return o.createElement(o.Fragment,null,o.createElement(y,{viewModel:(0,h.getParent)(e),spreadsheetModel:e}),o.createElement("table",{className:r.dataTable},o.createElement(j,{model:e}),o.createElement(G,{rows:a,spreadsheetModel:e,page:t,rowsPerPage:n}),a.length?null:o.createElement("caption",{className:r.emptyMessage},l.count?"no rows match criteria":"no rows present")))})),q=(0,r.n9)()((e=>({root:{position:"relative",marginBottom:e.spacing(1),background:e.palette.background.paper,overflow:"auto"}}))),J=(0,a.observer)((function({model:e,height:t,page:n,rowsPerPage:l}){const{classes:r}=q();return o.createElement("div",{className:r.root,style:{height:t}},e.rowSet.isLoaded&&e.initialized?o.createElement(U,{model:e,page:n,rowsPerPage:l}):o.createElement(s.LoadingEllipses,{variant:"h6"}))}));var K=n(93117),Q=n(31892);const X=(0,r.n9)()({textFilterControlEndAdornment:{marginRight:"-18px"}}),Y=(0,a.observer)((function({textFilter:e}){const{classes:t}=X(),[n,l]=(0,o.useState)(e.stringToFind),r=(0,E.useDebounce)(n,500);return(0,o.useEffect)((()=>{e.setString(r)}),[r,e]),o.createElement("div",null,o.createElement(f.A,{label:"text filter",value:n,onChange:e=>{l(e.target.value)},variant:"outlined",InputProps:{startAdornment:o.createElement(K.A,{position:"start"},o.createElement(R.A,null)),endAdornment:o.createElement(K.A,{className:t.textFilterControlEndAdornment,position:"end"},o.createElement(A.A,{"aria-label":"clear filter",onClick:()=>{l("")}},o.createElement(Q.A,null)))}}))})),Z=(0,a.observer)((({model:e})=>{const t=e.filterControls.rowFullText;return o.createElement(Y,{textFilter:t})}));var ee=n(36715),te=n(30157);const ne=(0,r.n9)()((e=>({columnName:{verticalAlign:"middle",paddingRight:"0.3em"},columnFilter:{overflow:"hidden",whiteSpace:"nowrap",boxSizing:"border-box",width:"100%",position:"relative"},filterIcon:{position:"relative",top:"12px"},filterIconBg:{background:e.palette.tertiary.main,color:"white",padding:e.spacing(1.5)}})));function oe({filterModel:e}){return e?o.createElement(e.ReactComponent,{filterModel:e}):null}const le=(0,a.observer)((function({viewModel:e,filterModel:t,columnNumber:n,height:r}){const{classes:a}=ne(),s=e.spreadsheet.columns[n];if(!s)throw new Error("no column definition! filters are probably out of date");return o.createElement(l.Ay,{container:!0,direction:"row",className:a.columnFilter,style:{height:r}},o.createElement(l.Ay,{item:!0,className:a.filterIconBg},o.createElement(R.A,{className:a.filterIcon})),o.createElement(l.Ay,{item:!0},o.createElement(A.A,{onClick:()=>(0,h.getParent)(t,2).removeColumnFilter(t),title:"remove filter"},o.createElement(te.A,null)),o.createElement(ee.A,{className:a.columnName,component:"span"},s.name)," ",o.createElement(oe,{filterModel:t})))}));var re=n(8565);const ae=(0,a.observer)((function({spreadsheet:e}){if(e.rowSet.isLoaded){const{passingFiltersCount:t,count:n,selectedCount:l,selectedAndPassingFiltersCount:r}=e.rowSet;let a;if(t!==n){if(a=`${e.rowSet.passingFiltersCount} rows of ${e.rowSet.count} total`,l){a+=`, ${r} selected`;const e=l-r;e&&(a+=` (${e} selected rows do not pass filters)`)}}else a=`${e.rowSet.count} rows`,l&&(a+=`, ${l} selected`);return o.createElement(o.Fragment,null,a)}return null})),se=(0,r.n9)()((e=>({statusBar:{height:40,boxSizing:"border-box",borderTop:"1px outset #b1b1b1",paddingLeft:e.spacing(1)},verticallyCenter:{display:"flex",justifyContent:"center",flexDirection:"column"},spacer:{flexGrow:1}}))),ce=(0,a.observer)((function({page:e,rowsPerPage:t,setPage:n,setRowsPerPage:l,spreadsheet:r,mode:a}){const{classes:s}=se();return o.createElement("div",{className:s.statusBar,style:{display:"display"===a?void 0:"none"}},o.createElement(m.A,{row:!0},o.createElement("div",{className:s.verticallyCenter},o.createElement(ae,{spreadsheet:r})),o.createElement("div",{className:s.spacer}),o.createElement(re.A,{rowsPerPageOptions:[10,25,100,1e3],count:r.rowSet.count,component:"div",rowsPerPage:t,page:e,onPageChange:(e,t)=>{n(t)},onRowsPerPageChange:e=>{l(+e.target.value),n(0)}}),o.createElement("div",{className:s.spacer})))})),ie=(0,r.n9)()((e=>({header:{overflow:"hidden",whiteSpace:"nowrap",boxSizing:"border-box",height:52,paddingLeft:e.spacing(1)},contentArea:{overflow:"auto"},resizeHandle:{height:3,position:"absolute",bottom:0,left:0,background:e.palette.action.disabled,boxSizing:"border-box",borderTop:"1px solid #fafafa"}}))),me=(0,a.observer)((function({model:e}){const{classes:t}=ie(),{spreadsheet:n,filterControls:r,hideFilterControls:a,hideVerticalResizeHandle:c,mode:i,height:m}=e,[d,u]=(0,o.useState)(0),[p,g]=(0,o.useState)(100);return o.createElement("div",null,"display"!==i||a?null:o.createElement(o.Fragment,null,o.createElement(l.Ay,{container:!0,direction:"row",className:t.header},o.createElement(l.Ay,{item:!0},o.createElement(Z,{model:e}))),r.columnFilters.map(((t,n)=>o.createElement(le,{key:`${t.columnNumber}-${n}`,viewModel:e,filterModel:t,columnNumber:t.columnNumber,height:46})))),"import"===i?o.createElement(C,{model:e.importWizard}):o.createElement("div",{className:t.contentArea},o.createElement("div",{style:{position:"relative",display:"display"===i?void 0:"none"}},n?o.createElement(J,{page:d,rowsPerPage:p,model:n,height:m-52-46*r.columnFilters.length-40}):null)),n?o.createElement(ce,{page:d,setPage:u,rowsPerPage:p,setRowsPerPage:g,mode:i,spreadsheet:n}):null,c?null:o.createElement(s.ResizeHandle,{onDrag:e.resizeHeight,className:t.resizeHandle}))}))}}]);
//# sourceMappingURL=8546.0a89cbee.chunk.js.map