@qaecy/cue-ui 0.0.36 → 0.0.38
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/112.js +1 -1
- package/376.js +1 -1
- package/382.js +1 -1
- package/419.js +1 -1
- package/493.js +1 -1
- package/5.js +1 -1
- package/675.js +1 -1
- package/package.json +1 -1
package/382.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[382],{2382(
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[382],{2382(E,f,r){r.d(f,{CueDocumentList:()=>A});var h=r(467),a=r(7705),c=r(5802),p=r(2271),C=r(8611),v=r(2065),w=r(4372),b=r(5381),O=r(2245),o=r(5547);function M(i,P){if(1&i&&(o.j41(0,"cue-flexcontainer",0)(1,"cue-typography",2),o.EFF(2),o.k0s()()),2&i){const t=o.XpG();o.R7$(2),o.SpI(" ",t.errorMessage()," ")}}function I(i,P){if(1&i){const t=o.RV6();o.j41(0,"cue-doc-list",3),o.bIt("clickedDocument",function(s){c.eBV(t);const n=o.XpG();return c.Njj(n.clickedDocument.emit(s))})("clickedDownloadDocument",function(s){c.eBV(t);const n=o.XpG();return c.Njj(n.clickedDownloadDocument.emit(s))})("clickedOpenInDir",function(s){c.eBV(t);const n=o.XpG();return c.Njj(n.clickedOpenInDir.emit(s))})("clickedOpen",function(s){c.eBV(t);const n=o.XpG();return c.Njj(n.clickedOpen.emit(s))}),o.k0s()}if(2&i){const t=o.XpG();o.Y8G("documentRefs",t.documentRefs())("documentData",t.documentData())("handlers",t.handlers())("availableContentCategories",t.availableContentCategories())("detailedView",t.detailedView())("simple",t.simple())("pageSize",t.pageSize())("prefetchPages",t.prefetchPages())("showOpenInDocumentViewerAction",t.showOpenInDocumentViewerAction())("showOpenInFileManagerAction",t.showOpenInFileManagerAction())("customOverlayActions",t.customOverlayActions())("variant",t.variant())}}function D(i){return i.split("?")[0].trim()}let A=(()=>{class i{projectId=(0,a.hFB)(void 0);uuids=(0,a.hFB)([]);sdkState=(0,a.hFB)(void 0);detailedView=(0,a.hFB)(!1);simple=(0,a.hFB)(!1);pageSize=(0,a.hFB)(10);prefetchPages=(0,a.hFB)(3);showOpenInDocumentViewerAction=(0,a.hFB)(!1);showOpenInFileManagerAction=(0,a.hFB)(!1);customMenuItems=(0,a.hFB)([]);variant=(0,a.hFB)("none");clickedDocument=(0,a.CGW)();clickedDownloadDocument=(0,a.CGW)();clickedOpenInDir=(0,a.CGW)();clickedOpen=(0,a.CGW)();state=(0,c.vPA)("idle");errorMessage=(0,c.vPA)(null);documentData=(0,c.vPA)({});availableContentCategories=(0,c.vPA)(void 0);documentRefs=(0,p.EW)(()=>{const t=new Set;return(this.uuids()??[]).map(D).filter(e=>!!e).filter(e=>!t.has(e)&&(t.add(e),!0)).map(e=>({id:e}))});customOverlayActions=(0,p.EW)(()=>(this.customMenuItems()||[]).map(e=>({label:e.label,icon:e.icon,action:s=>{e.action(s.rowData,s)}})));handlers=(0,p.EW)(()=>{var t=this;const e=this._docs();if(e)return{requestData:(s=(0,h.A)(function*(n){const m=n.map(D).filter(u=>!!u),d=m.filter(u=>!t.documentData()[u]);if(console.debug("[CueDocumentListWC] requestData",{requestedCount:m.length,missingCount:d.length,missing:d}),d.length)try{const u=e,l=t.simple()&&u.fetchDocumentDataSimple?yield u.fetchDocumentDataSimple(d):yield e.fetchDocumentData(d);console.debug("[CueDocumentListWC] fetchDocumentData resolved",{fetchedCount:Object.keys(l).length,ids:Object.keys(l)});const g={};Object.values(l).forEach(_=>{g[_.id]=function y(i){return{id:i.id,path:i.path,suffix:i.suffix,size:i.size,contentIRI:i.contentIRI,providerId:i.providerId,tags:i.tags??[],summary:i.summary??"",categories:i.categories??[],subject:i.subject,relevance:0}}(_)}),Object.keys(g).length>0&&t.documentData.update(_=>({..._,...g}))}catch(u){console.error("[CueDocumentListWC] Failed to fetch document data:",u),t.errorMessage.set(u instanceof Error?u.message:String(u)),t.state.set("error")}}),function(m){return s.apply(this,arguments)}),requestDownload:function(){var s=(0,h.A)(function*(n){const m=t._cue(),d=t.projectId();if(m&&d)try{const u=yield m.storage.getDownloadUrl(d,n.id,n.suffix,"raw"),l=yield fetch(u);if(!l.ok)throw new Error(`Download failed: ${l.status} ${l.statusText}`);const g=yield l.blob(),_=(0,w.M)(n.path)||`${n.id}${n.suffix||""}`;(0,v.KE)(g,_)}catch(u){console.error("[CueDocumentListWC] Failed to download document:",u)}});return function(m){return s.apply(this,arguments)}}(),requestOpen:(s,n)=>{console.log("[CueDocumentListWC] requestOpen",{documentUUID:s,document:n})},requestOpenInDir:(s,n)=>{console.log("[CueDocumentListWC] requestOpenInDir",{documentUUID:s,document:n})}};var s});_cue=(0,c.vPA)(void 0);_docs=(0,c.vPA)(void 0);_ownedView;_inputWarningTimer;_unsubscribeCategories;_lastSetupSignature;constructor(){this._inputWarningTimer=setTimeout(()=>{this.projectId()||console.warn('[cue-document-list] Required input "projectId" is not set. Pass the Cue project ID to load documents.'),this.sdkState()||console.warn('[cue-document-list] Required input "sdkState" is not set. Pass a { cue, view, or documents } object to enable document loading.')},3e3),(0,c.QZP)(()=>{const t=this.projectId(),e=this.sdkState(),s=e?.language??"en";if(console.debug("[CueDocumentListWC] input state changed",{projectId:t,uuids:this.uuids().length,hasSdkState:!!e,hasCue:!!e?.cue,hasView:!!e?.view,hasDocuments:!!e?.documents}),!t||!e)return this._clearRuntimeState(),void this.state.set("idle");const n={projectId:t,cue:e.cue,view:e.view,documents:e.documents,language:s,simple:this.simple()};if(this._isSameSetupSignature(n))return this.state.set("ready"),void this.errorMessage.set(null);this._setupFromSdkState(t,e),this._lastSetupSignature=n,this.state.set("ready"),this.errorMessage.set(null)}),(0,c.QZP)(()=>{const t=new Set(this.documentRefs().map(e=>e.id));this.documentData.update(e=>Object.fromEntries(Object.entries(e).filter(([n])=>t.has(n))))})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0}_setupFromSdkState(t,e){const s=e.language??"en";if(this.documentData.set({}),this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0,this.availableContentCategories.set(e.availableContentCategories?e.availableContentCategories:void 0),e.documents)return e.documents.setLanguage(s),this._docs.set(e.documents),void this._cue.set(e.cue);if(e.view)return e.view.setLanguage(s),this._docs.set(e.view.documents),this._cue.set(e.cue),void(this.simple()||this._bindCategoriesFromView(e.view));if(e.cue){if(this.simple())return this._docs.set(e.cue.createProjectDocuments(t)),this._cue.set(e.cue),void this.availableContentCategories.set(void 0);const n=e.cue.createProjectView(t,{language:s});return this._ownedView=n,this._docs.set(n.documents),this._cue.set(e.cue),void this._bindCategoriesFromView(n)}this._docs.set(void 0),this._cue.set(void 0),this.errorMessage.set("sdkState must include cue, view, or documents to load data."),this.state.set("error")}_bindCategoriesFromView(t){const e=()=>{this.availableContentCategories.set(t.availableContentCategories.get())};e(),this._unsubscribeCategories=t.availableContentCategories.subscribe(e)}_clearRuntimeState(){this._cleanupOwnedView(),this._unsubscribeCategories?.(),this._unsubscribeCategories=void 0,this._docs.set(void 0),this._cue.set(void 0),this.documentData.set({}),this.availableContentCategories.set(void 0),this.errorMessage.set(null),this._lastSetupSignature=void 0}_cleanupOwnedView(){this._ownedView&&(this._ownedView.destroy(),this._ownedView=void 0)}_isSameSetupSignature(t){const e=this._lastSetupSignature;return!!e&&e.projectId===t.projectId&&e.cue===t.cue&&e.view===t.view&&e.documents===t.documents&&e.language===t.language&&e.simple===t.simple}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=o.VBU({type:i,selectors:[["cue-document-list"]],inputs:{projectId:[1,"projectId"],uuids:[1,"uuids"],sdkState:[1,"sdkState"],detailedView:[1,"detailedView"],simple:[1,"simple"],pageSize:[1,"pageSize"],prefetchPages:[1,"prefetchPages"],showOpenInDocumentViewerAction:[1,"showOpenInDocumentViewerAction"],showOpenInFileManagerAction:[1,"showOpenInFileManagerAction"],customMenuItems:[1,"customMenuItems"],variant:[1,"variant"]},outputs:{clickedDocument:"clickedDocument",clickedDownloadDocument:"clickedDownloadDocument",clickedOpenInDir:"clickedOpenInDir",clickedOpen:"clickedOpen"},decls:2,vars:1,consts:[["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[3,"documentRefs","documentData","handlers","availableContentCategories","detailedView","simple","pageSize","prefetchPages","showOpenInDocumentViewerAction","showOpenInFileManagerAction","customOverlayActions","variant"],[2,"color","#c44","font-size","13px"],[3,"clickedDocument","clickedDownloadDocument","clickedOpenInDir","clickedOpen","documentRefs","documentData","handlers","availableContentCategories","detailedView","simple","pageSize","prefetchPages","showOpenInDocumentViewerAction","showOpenInFileManagerAction","customOverlayActions","variant"]],template:function(e,s){1&e&&o.nVh(0,M,3,1,"cue-flexcontainer",0)(1,I,1,12,"cue-doc-list",1),2&e&&o.vxM("error"===s.state()?0:1)},dependencies:[C.g,b.n,O.Typography],styles:["[_nghost-%COMP%]{display:block;width:100%}"],changeDetection:0})}return i})()}}]);
|