@stratusjs/angular 0.8.1 → 0.8.3
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/angular.bundle.js +15 -5
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +1 -1
- package/src/editor/editor.component.js +0 -1
- package/src/editor/editor.component.js.map +1 -1
- package/src/editor/editor.component.min.js +1 -1
- package/src/editor/editor.component.ts +2 -1
- package/src/froala/plugins/linkManager.js +12 -4
- package/src/froala/plugins/linkManager.js.map +1 -1
- package/src/froala/plugins/linkManager.min.js +1 -1
- package/src/froala/plugins/linkManager.ts +8 -2
- package/src/tree/tree.component.js +1 -2
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.js +1 -1
- package/src/tree/tree.component.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@angular/core","@angular/cdk/drag-drop","@angular/cdk/tree","@angular/platform-browser","@angular/material/icon","rxjs","@stratusjs/runtime/stratus","lodash","@agentepsilon/decko","../core/root.component","../backend.service","@stratusjs/angularjs/services/registry","@stratusjs/core/events/eventManager","@stratusjs/core/environment","@stratusjs/core/misc","@angular/common"],function(e,t){"use strict";var i,s,r,o,n,a,d,c,l,h,p,u,g,f,m,y,D,v,b,S=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},I=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},M=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};t&&t.id;return{setters:[function(e){i=e},function(e){s=e},function(e){r=e},function(e){o=e},function(e){n=e},function(e){a=e},function(e){d=e},function(e){c=e},function(e){l=e},function(e){h=e},function(e){p=e},function(e){u=e},function(e){g=e},function(e){f=e},function(e){m=e},function(e){y=e}],execute:function(){"@stratusjs/angular","tree",D=f.cookie("env")?"":".min",v=`${d.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"").replace(/\/dist\/$/,"/src/")}`,b=class extends h.RootComponent{constructor(e,t,i,s,o,n){super(),this.iconRegistry=e,this.sanitizer=t,this.backend=i,this.ref=s,this.elementRef=o,this.document=n,this.title="tree_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=c.default,this.Stratus=d.Stratus,this.registry=new u.Registry,this.onChange=new a.Subject,this.unsettled=!1,this.svgIcons={},this.dblClickWait=500,this.dropLists=[],this.dropListIdMap={},this.dropListMap={},this.expandedNodeSet=new Set,this.dragging=!1,this.expandDelay=1e3,this.dropData=null,this.cdkDropListSortingDisabled=!0,this.treeControl=new r.NestedTreeControl(e=>e.children||[]),this.isBorder=!1,this.isDebug=!1}ngOnInit(){this.uid=c.default.uniqueId(`sa_${c.default.snakeCase("tree")}_component_`),d.Stratus.Instances[this.uid]=this,this.hydrate(this.elementRef,this.sanitizer,["title","uid","isInitialized","isDestroyed","isStyled","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","_","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","unsettled","svgIcons","isSingleClick","dblClickWait","dropLists","dropListIdMap","dropListMap","expandedNodeSet","dragging","expandTimeout","expandDelay","dropData","cdkDropListSortingDisabled","tree","treeMap","metaMap","dataSource","treeControl","isBorder","isDebug","iconRegistry","sanitizer","backend","ref","elementRef","document","ngOnInit","ngOnDestroy","refresh","remove","removeNode","nodeIsEqual","fetchData","dataDefer","dataRef","trackDropLists","setExpanded","setExpandedClick","setExpandedDblClick","onDragDrop","onDragMove","showDragData","clearDragData","buildNodePatch","getSvg","addSvgIcon","hydrate","disableRefresh","stagger","reloading"]),d.Stratus.Internals.CssLoader(`${v}/tree/tree.component${D}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),c.default.forEach({tree_check:d.Stratus.BaseUrl+"sitetheorycore/images/icons/check.svg",tree_add:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/add.svg",tree_delete:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/delete.svg",tree_edit:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/edit.svg",tree_visibility:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/visibility.svg"},(e,t)=>this.iconRegistry.addSvgIcon(t,this.sanitizer.bypassSecurityTrustResourceUrl(e)).getNamedSvgIcon(t)),this.fetchData().then(e=>{if(!(e&&e instanceof g.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{!this.unsettled&&e.completed&&(this.dataDefer(this.subscriber),this.refresh())};e.on("change",t),t(),e.on("add",(e,t)=>{let i=!1;const s=()=>{if(!t.completed)return;if(i)return;if(i=!0,!(t.getIdentifier()in this.treeMap))return void t.meta.set("postPersist",!0);const e=this.treeMap[t.getIdentifier()];e.meta.component&&"openDialog"in e.meta.component?e.meta.component.openDialog():t.meta.set("postPersist",!0)};t.on("change",s),s()})}),this.dataSub=new a.Observable(e=>this.dataDefer(e)),this.dropListIdMap[this.uid+"_parent_drop_list"]=!0,this.trackDropLists();const e=f.cookie("tree-node-border");e&&m.isJSON(e)&&(this.isBorder=JSON.parse(e));const t=f.cookie("tree-debug");t&&m.isJSON(t)&&(this.isDebug=JSON.parse(t)),this.isInitialized=!0,this.refresh()}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):(c.default.forEach(this.metaMap,e=>{e.component&&"refresh"in e.component&&e.component.refresh()}),super.refresh())}remove(e){}removeNode(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}nodeIsEqual(e,t){return e&&t?e.id===t.id:e===t}async fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(d.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.collection||!this.collection.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef(!0);t&&t.length?e.next(t):setTimeout(()=>this.dataDefer(e),200)}dataRef(e=!1){if(!this.collection)return[];if(!e&&this.tree&&this.tree.length>0)return this.tree;let t=this.collection.models;return t&&c.default.isArray(t)&&t.length?(t=c.default.sortBy(t,["data.priority"]),this.metaMap=this.metaMap||{},this.treeMap={},this.tree=[],c.default.forEach(t,e=>{const t=c.default.get(e,"data.id"),i=c.default.get(e,"data.nestParent.id");this.dropListIdMap[`${this.uid}_node_${t}_drop_list`]=!0,c.default.has(this.metaMap,t)||(this.metaMap[t]={id:t,expanded:!0}),c.default.has(this.treeMap,t)||(this.treeMap[t]={id:t,model:e,children:[],meta:this.metaMap[t]}),this.treeMap[t].model=e,this.treeMap[t].meta=this.metaMap[t],i?(c.default.has(this.treeMap,i)||(this.treeMap[i]={id:i,model:null,children:[],meta:null}),this.treeMap[i].children.push(this.treeMap[t])):this.tree.push(this.treeMap[t])}),this.trackDropLists(),this.tree):[]}trackDropLists(){this.dropLists=[],c.default.forEach(this.dropListIdMap,(e,t)=>{if(!e)return;const i=t in this.dropListMap,s=i?this.dropListMap[t]:document.getElementById(t);s&&(this.dropLists.push(t),i||(this.dropListMap[t]=s))})}setExpanded(e){this.metaMap&&c.default.size(this.metaMap)&&(c.default.forEach(this.metaMap,t=>{t.expanded=e}),this.refresh())}setExpandedClick(e){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.setExpanded(e)},this.dblClickWait)}setExpandedDblClick(e){this.isSingleClick=!1,this.setExpanded(e)}async onDragDrop(e){if(!e.isPointerOverContainer)return;const t=e.item.data;if(!t)return;let i=e.container.data;const r=e.previousContainer.data,o=i?i.children:this.dataRef();if(!o)return;this.unsettled=!0;const n=this.dropData.targetId&&this.dropData.targetId in this.treeMap?this.treeMap[c.default.toNumber(this.dropData.targetId)]:null;if(f.cookie("env")&&this.isDebug&&(console.group("onDragDrop()"),c.default.forEach(["model drop: "+t.model.get("name"),`list shift: ${e.container.element.nativeElement.id} -> ${e.previousContainer.element.nativeElement.id}`,`index change (event): ${e.previousIndex} -> ${e.currentIndex}`,"current priority: "+t.model.get("priority"),"target drop action: "+this.dropData.action],e=>console.log(e))),n&&!this.nodeIsEqual(i,n)){if(f.cookie("env")&&this.isDebug&&(console.log(`target drop node differs: ${n.id} -> ${n.model.get("name")}`),console.log("target drop node is the same as target node:",t.id===n.id)),t.id!==n.id)switch(this.dropData.action){case"before":case"after":const e=n.model.get("nestParent.id");i=e&&e in this.treeMap?this.treeMap[e]:null;break;case"inside":i=n}f.cookie("env")&&this.isDebug&&console.log("target drop node selected:",i?`${i.id} -> ${i.model.get("name")}`:"none")}if(!this.nodeIsEqual(i,r)){if(i){switch(this.dropData.action){case"before":case"after":let e=i.children.findIndex(e=>e.id===t.id);"after"===this.dropData.action&&e++,i.children.splice(e,0,t);break;case"inside":i.children.push(t)}i.meta.expanded=!0}r&&this.removeNode(r.children,t),t.model.set("nestParent",this.buildNodePatch(i)),f.cookie("env")&&this.isDebug&&console.log("new parent: "+(t.model.get("nestParent.name")||null))}const a=i?i.children:o;let d=e.currentIndex;if(this.cdkDropListSortingDisabled)switch(d=null,this.dropData.action){case"before":case"after":d=a.findIndex(e=>e.id===n.id),"after"===this.dropData.action&&d++,f.cookie("env")&&this.isDebug&&console.log("index change (drop node):",`${e.previousIndex} -> ${d}`)}if(c.default.isNumber(d)){s.moveItemInArray(a,e.previousIndex,d);let i=0;c.default.forEach(a,e=>{e.model&&e.model.set&&e.model.set("priority",i++)}),f.cookie("env")&&this.isDebug&&console.log("new priority:",t.model.get("priority"))}f.cookie("env")&&this.isDebug&&console.groupEnd(),await t.model.save(),this.unsettled=!1,this.subscriber.next(this.dataRef()),this.ref.detectChanges()}onDragMove(e){const t=this.document.elementFromPoint(e.pointerPosition.x,e.pointerPosition.y);if(!t)return void this.clearDragData();const i=t.classList.contains("tree-node-content")?t:t.closest(".tree-node-content");if(!i)return void this.clearDragData();this.dropData={targetId:i.getAttribute("data-id")};const s=i.getBoundingClientRect(),r=s.height/3;e.pointerPosition.y-s.top<r?this.dropData.action="before":e.pointerPosition.y-s.top>2*r?this.dropData.action="after":this.dropData.action="inside",this.showDragData()}showDragData(){this.clearDragData(),this.dropData&&this.document.getElementById("node-"+this.dropData.targetId).classList.add("drop-"+this.dropData.action)}clearDragData(e=!1){e&&(this.dropData=null),this.document.querySelectorAll(".drop-before").forEach(e=>e.classList.remove("drop-before")),this.document.querySelectorAll(".drop-after").forEach(e=>e.classList.remove("drop-after")),this.document.querySelectorAll(".drop-inside").forEach(e=>e.classList.remove("drop-inside"))}buildNodePatch(e=null){if(!e||!e.model)return null;const t={};return c.default.forEach(["id","name"],i=>{const s=e.model.get(i);s&&c.default.set(t,i,s)}),t}getSvg(e,t){const i=this.addSvgIcon(e,t);return new a.Observable(t=>{this.iconRegistry.getNamedSvgIcon(i).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(i)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const i=this.svgIcons[e]=c.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(i,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),i}},S([i.Input(),I("design:type",String)],b.prototype,"target",void 0),S([i.Input(),I("design:type",String)],b.prototype,"targetSuffix",void 0),S([i.Input(),I("design:type",Number)],b.prototype,"id",void 0),S([i.Input(),I("design:type",Boolean)],b.prototype,"manifest",void 0),S([i.Input(),I("design:type",Boolean)],b.prototype,"decouple",void 0),S([i.Input(),I("design:type",Boolean)],b.prototype,"direct",void 0),S([i.Input(),I("design:type",Object)],b.prototype,"api",void 0),S([i.Input(),I("design:type",String)],b.prototype,"urlRoot",void 0),S([i.Input(),I("design:type",String)],b.prototype,"type",void 0),S([i.Input(),I("design:type",String)],b.prototype,"property",void 0),S([l.debounce(50),I("design:type",Function),I("design:paramtypes",[Object]),I("design:returntype",void 0)],b.prototype,"onDragMove",null),b=S([i.Component({selector:"sa-tree",templateUrl:`${v}/tree/tree.component${D}.html`}),M(5,i.Inject(y.DOCUMENT)),I("design:paramtypes",[n.MatIconRegistry,o.DomSanitizer,p.BackendService,i.ChangeDetectorRef,i.ElementRef,Document])],b),e("TreeComponent",b)}}});
|
|
1
|
+
System.register(["@angular/core","@angular/cdk/drag-drop","@angular/cdk/tree","@angular/platform-browser","@angular/material/icon","rxjs","@stratusjs/runtime/stratus","lodash","@agentepsilon/decko","../core/root.component","../backend.service","@stratusjs/angularjs/services/registry","@stratusjs/core/events/eventManager","@stratusjs/core/environment","@stratusjs/core/misc","@angular/common"],function(e,t){"use strict";var i,s,r,o,n,a,d,c,l,h,p,u,g,f,m,y,D,v,b,S=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},I=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},M=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};t&&t.id;return{setters:[function(e){i=e},function(e){s=e},function(e){r=e},function(e){o=e},function(e){n=e},function(e){a=e},function(e){d=e},function(e){c=e},function(e){l=e},function(e){h=e},function(e){p=e},function(e){u=e},function(e){g=e},function(e){f=e},function(e){m=e},function(e){y=e}],execute:function(){"@stratusjs/angular","tree",D=f.cookie("env")?"":".min",v=`${d.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"").replace(/\/dist\/$/,"/src/")}`,b=class extends h.RootComponent{constructor(e,t,i,s,o,n){super(),this.iconRegistry=e,this.sanitizer=t,this.backend=i,this.ref=s,this.elementRef=o,this.document=n,this.title="tree_component",this.isInitialized=!1,this.isDestroyed=!1,this.isStyled=!1,this._=c.default,this.Stratus=d.Stratus,this.registry=new u.Registry,this.onChange=new a.Subject,this.unsettled=!1,this.svgIcons={},this.dblClickWait=500,this.dropLists=[],this.dropListIdMap={},this.dropListMap={},this.expandedNodeSet=new Set,this.dragging=!1,this.expandDelay=1e3,this.dropData=null,this.cdkDropListSortingDisabled=!0,this.treeControl=new r.NestedTreeControl(e=>e.children||[]),this.isBorder=!1,this.isDebug=!1}ngOnInit(){this.uid=c.default.uniqueId(`sa_${c.default.snakeCase("tree")}_component_`),d.Stratus.Instances[this.uid]=this,this.hydrate(this.elementRef,this.sanitizer,["title","uid","isInitialized","isDestroyed","isStyled","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","_","Stratus","registry","fetched","data","collection","model","dataSub","onChange","subscriber","unsettled","svgIcons","isSingleClick","dblClickWait","dropLists","dropListIdMap","dropListMap","expandedNodeSet","dragging","expandTimeout","expandDelay","dropData","cdkDropListSortingDisabled","tree","treeMap","metaMap","dataSource","treeControl","isBorder","isDebug","iconRegistry","sanitizer","backend","ref","elementRef","document","ngOnInit","ngOnDestroy","refresh","remove","removeNode","nodeIsEqual","fetchData","dataDefer","dataRef","trackDropLists","setExpanded","setExpandedClick","setExpandedDblClick","onDragDrop","onDragMove","showDragData","clearDragData","buildNodePatch","getSvg","addSvgIcon","hydrate","disableRefresh","stagger","reloading"]),d.Stratus.Internals.CssLoader(`${v}/tree/tree.component${D}.css`).then(()=>{this.isStyled=!0,this.refresh()}).catch(e=>{console.warn("Issue detected in CSS Loader for Component:",this),console.error(e),this.isStyled=!0,this.refresh()}),c.default.forEach({tree_check:d.Stratus.BaseUrl+"sitetheorycore/images/icons/check.svg",tree_add:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/add.svg",tree_delete:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/delete.svg",tree_edit:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/edit.svg",tree_visibility:d.Stratus.BaseUrl+"sitetheorycore/images/icons/actionButtons/visibility.svg"},(e,t)=>this.iconRegistry.addSvgIcon(t,this.sanitizer.bypassSecurityTrustResourceUrl(e)).getNamedSvgIcon(t)),this.fetchData().then(e=>{if(!(e&&e instanceof g.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{!this.unsettled&&e.completed&&(this.dataDefer(this.subscriber),this.refresh())};e.on("change",t),t(),e.on("add",(e,t)=>{let i=!1;const s=()=>{if(!t.completed)return;if(i)return;if(i=!0,!(t.getIdentifier()in this.treeMap))return void t.meta.set("postPersist",!0);const e=this.treeMap[t.getIdentifier()];e.meta.component&&"openDialog"in e.meta.component?e.meta.component.openDialog():t.meta.set("postPersist",!0)};t.on("change",s),s()})}),this.dataSub=new a.Observable(e=>this.dataDefer(e)),this.dropListIdMap[this.uid+"_parent_drop_list"]=!0,this.trackDropLists();const e=f.cookie("tree-node-border");e&&m.isJSON(e)&&(this.isBorder=JSON.parse(e));const t=f.cookie("tree-debug");t&&m.isJSON(t)&&(this.isDebug=JSON.parse(t)),this.isInitialized=!0,this.refresh()}ngOnDestroy(){this.isDestroyed=!0}refresh(){return this.isDestroyed?new Promise(e=>e()):(c.default.forEach(this.metaMap,e=>{e.component&&"refresh"in e.component&&e.component.refresh()}),super.refresh())}remove(e){}removeNode(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}nodeIsEqual(e,t){return e&&t?e.id===t.id:e===t}async fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(d.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber||!this.collection||!this.collection.completed)return void setTimeout(()=>{this.dataDefer(e)},500);const t=this.dataRef(!0);t&&t.length?e.next(t):setTimeout(()=>this.dataDefer(e),200)}dataRef(e=!1){if(!this.collection)return[];if(!e&&this.tree&&this.tree.length>0)return this.tree;let t=this.collection.models;return t&&c.default.isArray(t)&&t.length?(t=c.default.sortBy(t,["data.priority"]),this.metaMap=this.metaMap||{},this.treeMap={},this.tree=[],c.default.forEach(t,e=>{const t=c.default.get(e,"data.id"),i=c.default.get(e,"data.nestParent.id");this.dropListIdMap[`${this.uid}_node_${t}_drop_list`]=!0,c.default.has(this.metaMap,t)||(this.metaMap[t]={id:t,expanded:!0}),c.default.has(this.treeMap,t)||(this.treeMap[t]={id:t,model:e,children:[],meta:this.metaMap[t]}),this.treeMap[t].model=e,this.treeMap[t].meta=this.metaMap[t],i?(c.default.has(this.treeMap,i)||(this.treeMap[i]={id:i,model:null,children:[],meta:null}),this.treeMap[i].children.push(this.treeMap[t])):this.tree.push(this.treeMap[t])}),this.trackDropLists(),this.tree):[]}trackDropLists(){this.dropLists=[],c.default.forEach(this.dropListIdMap,(e,t)=>{if(!e)return;const i=t in this.dropListMap,s=i?this.dropListMap[t]:document.getElementById(t);s&&(this.dropLists.push(t),i||(this.dropListMap[t]=s))})}setExpanded(e){this.metaMap&&c.default.size(this.metaMap)&&(c.default.forEach(this.metaMap,t=>{t.expanded=e}),this.refresh())}setExpandedClick(e){this.isSingleClick=!0,setTimeout(()=>{this.isSingleClick&&this.setExpanded(e)},this.dblClickWait)}setExpandedDblClick(e){this.isSingleClick=!1,this.setExpanded(e)}async onDragDrop(e){if(!e.isPointerOverContainer)return;const t=e.item.data;if(!t)return;let i=e.container.data;const r=e.previousContainer.data,o=i?i.children:this.dataRef();if(!o)return;this.unsettled=!0;const n=this.dropData.targetId&&this.dropData.targetId in this.treeMap?this.treeMap[c.default.toNumber(this.dropData.targetId)]:null;if(f.cookie("env")&&this.isDebug&&(console.group("onDragDrop()"),c.default.forEach(["model drop: "+t.model.get("name"),`list shift: ${e.container.element.nativeElement.id} -> ${e.previousContainer.element.nativeElement.id}`,`index change (event): ${e.previousIndex} -> ${e.currentIndex}`,"current priority: "+t.model.get("priority"),"target drop action: "+this.dropData.action],e=>console.log(e))),n&&!this.nodeIsEqual(i,n)){if(f.cookie("env")&&this.isDebug&&(console.log(`target drop node differs: ${n.id} -> ${n.model.get("name")}`),console.log("target drop node is the same as target node:",t.id===n.id)),t.id!==n.id)switch(this.dropData.action){case"before":case"after":const e=n.model.get("nestParent.id");i=e&&e in this.treeMap?this.treeMap[e]:null;break;case"inside":i=n}f.cookie("env")&&this.isDebug&&console.log("target drop node selected:",i?`${i.id} -> ${i.model.get("name")}`:"none")}if(!this.nodeIsEqual(i,r)){if(i){switch(this.dropData.action){case"before":case"after":let e=i.children.findIndex(e=>e.id===t.id);"after"===this.dropData.action&&e++,i.children.splice(e,0,t);break;case"inside":i.children.push(t)}i.meta.expanded=!0}r&&this.removeNode(r.children,t),t.model.set("nestParent",this.buildNodePatch(i)),f.cookie("env")&&this.isDebug&&console.log("new parent: "+(t.model.get("nestParent.name")||null))}const a=i?i.children:o;let d=e.currentIndex;if(this.cdkDropListSortingDisabled)switch(d=null,this.dropData.action){case"before":case"after":d=a.findIndex(e=>e.id===n.id),"after"===this.dropData.action&&d++,f.cookie("env")&&this.isDebug&&console.log("index change (drop node):",`${e.previousIndex} -> ${d}`)}if(c.default.isNumber(d)){s.moveItemInArray(a,e.previousIndex,d);let i=0;c.default.forEach(a,e=>{e.model&&e.model.set&&e.model.set("priority",i++)}),f.cookie("env")&&this.isDebug&&console.log("new priority:",t.model.get("priority"))}f.cookie("env")&&this.isDebug&&console.groupEnd(),await t.model.save(),this.unsettled=!1,this.collection.throttleTrigger("change")}onDragMove(e){const t=this.document.elementFromPoint(e.pointerPosition.x,e.pointerPosition.y);if(!t)return void this.clearDragData();const i=t.classList.contains("tree-node-content")?t:t.closest(".tree-node-content");if(!i)return void this.clearDragData();this.dropData={targetId:i.getAttribute("data-id")};const s=i.getBoundingClientRect(),r=s.height/3;e.pointerPosition.y-s.top<r?this.dropData.action="before":e.pointerPosition.y-s.top>2*r?this.dropData.action="after":this.dropData.action="inside",this.showDragData()}showDragData(){this.clearDragData(),this.dropData&&this.document.getElementById("node-"+this.dropData.targetId).classList.add("drop-"+this.dropData.action)}clearDragData(e=!1){e&&(this.dropData=null),this.document.querySelectorAll(".drop-before").forEach(e=>e.classList.remove("drop-before")),this.document.querySelectorAll(".drop-after").forEach(e=>e.classList.remove("drop-after")),this.document.querySelectorAll(".drop-inside").forEach(e=>e.classList.remove("drop-inside"))}buildNodePatch(e=null){if(!e||!e.model)return null;const t={};return c.default.forEach(["id","name"],i=>{const s=e.model.get(i);s&&c.default.set(t,i,s)}),t}getSvg(e,t){const i=this.addSvgIcon(e,t);return new a.Observable(t=>{this.iconRegistry.getNamedSvgIcon(i).subscribe({error(t){console.error(`getSvg(${e}): ${t}`)},complete(){t.next(i)}})})}addSvgIcon(e,t){if(e in this.svgIcons)return this.svgIcons[e];t||(t={});const i=this.svgIcons[e]=c.default.uniqueId("selector_svg");return this.iconRegistry.addSvgIcon(i,this.sanitizer.bypassSecurityTrustResourceUrl(e),t),i}},S([i.Input(),I("design:type",String)],b.prototype,"target",void 0),S([i.Input(),I("design:type",String)],b.prototype,"targetSuffix",void 0),S([i.Input(),I("design:type",Number)],b.prototype,"id",void 0),S([i.Input(),I("design:type",Boolean)],b.prototype,"manifest",void 0),S([i.Input(),I("design:type",Boolean)],b.prototype,"decouple",void 0),S([i.Input(),I("design:type",Boolean)],b.prototype,"direct",void 0),S([i.Input(),I("design:type",Object)],b.prototype,"api",void 0),S([i.Input(),I("design:type",String)],b.prototype,"urlRoot",void 0),S([i.Input(),I("design:type",String)],b.prototype,"type",void 0),S([i.Input(),I("design:type",String)],b.prototype,"property",void 0),S([l.debounce(50),I("design:type",Function),I("design:paramtypes",[Object]),I("design:returntype",void 0)],b.prototype,"onDragMove",null),b=S([i.Component({selector:"sa-tree",templateUrl:`${v}/tree/tree.component${D}.html`}),M(5,i.Inject(y.DOCUMENT)),I("design:paramtypes",[n.MatIconRegistry,o.DomSanitizer,p.BackendService,i.ChangeDetectorRef,i.ElementRef,Document])],b),e("TreeComponent",b)}}});
|
|
@@ -738,11 +738,11 @@ export class TreeComponent extends RootComponent implements OnInit, OnDestroy {
|
|
|
738
738
|
// await this.refresh()
|
|
739
739
|
|
|
740
740
|
// update pipe
|
|
741
|
-
this.subscriber.next(this.dataRef())
|
|
742
|
-
this.ref.detectChanges()
|
|
741
|
+
// this.subscriber.next(this.dataRef())
|
|
742
|
+
// this.ref.detectChanges()
|
|
743
743
|
|
|
744
744
|
// propagate change
|
|
745
|
-
|
|
745
|
+
this.collection.throttleTrigger('change')
|
|
746
746
|
}
|
|
747
747
|
|
|
748
748
|
// private canBeDropped(event: CdkDragDrop<any, any>): boolean {
|