@stratusjs/angular 0.8.0 → 0.8.1
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 +109 -97
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +2 -2
- package/src/tree/tree-node.component.html +6 -7
- package/src/tree/tree-node.component.min.html +1 -1
- package/src/tree/tree.component.css +16 -3
- package/src/tree/tree.component.css.map +1 -1
- package/src/tree/tree.component.js +29 -16
- package/src/tree/tree.component.js.map +1 -1
- package/src/tree/tree.component.min.css +1 -1
- package/src/tree/tree.component.min.js +1 -1
- package/src/tree/tree.component.scss +37 -20
- package/src/tree/tree.component.ts +30 -14
package/dist/angular.bundle.js
CHANGED
|
@@ -123781,13 +123781,14 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
|
|
|
123781
123781
|
this.expandDelay = 1000;
|
|
123782
123782
|
this.dropData = null;
|
|
123783
123783
|
this.cdkDropListSortingDisabled = true;
|
|
123784
|
-
this.dropDebug = false;
|
|
123785
123784
|
this.treeControl = new NestedTreeControl((node) => node.children || []);
|
|
123785
|
+
this.isBorder = false;
|
|
123786
|
+
this.isDebug = false;
|
|
123786
123787
|
}
|
|
123787
123788
|
ngOnInit() {
|
|
123788
123789
|
this.uid = _.uniqueId(`sa_${_.snakeCase(moduleName$3)}_component_`);
|
|
123789
123790
|
Stratus.Instances[this.uid] = this;
|
|
123790
|
-
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", "
|
|
123791
|
+
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"]);
|
|
123791
123792
|
Stratus.Internals.CssLoader(`${localDir$7}/${moduleName$3}/${moduleName$3}.component${min$6}.css`)
|
|
123792
123793
|
.then(() => {
|
|
123793
123794
|
this.isStyled = true;
|
|
@@ -123849,6 +123850,14 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
|
|
|
123849
123850
|
this.dataSub = new Observable((subscriber) => this.dataDefer(subscriber));
|
|
123850
123851
|
this.dropListIdMap[`${this.uid}_parent_drop_list`] = true;
|
|
123851
123852
|
this.trackDropLists();
|
|
123853
|
+
const isBorder = cookie('tree-node-border');
|
|
123854
|
+
if (isBorder && isJSON(isBorder)) {
|
|
123855
|
+
this.isBorder = JSON.parse(isBorder);
|
|
123856
|
+
}
|
|
123857
|
+
const isDebug = cookie('tree-debug');
|
|
123858
|
+
if (isDebug && isJSON(isDebug)) {
|
|
123859
|
+
this.isDebug = JSON.parse(isDebug);
|
|
123860
|
+
}
|
|
123852
123861
|
this.isInitialized = true;
|
|
123853
123862
|
this.refresh();
|
|
123854
123863
|
}
|
|
@@ -124000,115 +124009,118 @@ System.register(['@stratusjs/runtime/stratus', 'lodash', '@stratusjs/core/enviro
|
|
|
124000
124009
|
this.setExpanded(expanded);
|
|
124001
124010
|
}
|
|
124002
124011
|
onDragDrop(event) {
|
|
124003
|
-
|
|
124004
|
-
|
|
124005
|
-
|
|
124006
|
-
|
|
124007
|
-
|
|
124008
|
-
|
|
124009
|
-
|
|
124010
|
-
|
|
124011
|
-
|
|
124012
|
-
|
|
124013
|
-
|
|
124014
|
-
|
|
124015
|
-
|
|
124016
|
-
|
|
124017
|
-
|
|
124018
|
-
this.
|
|
124019
|
-
|
|
124020
|
-
|
|
124021
|
-
|
|
124022
|
-
|
|
124023
|
-
|
|
124024
|
-
|
|
124025
|
-
|
|
124026
|
-
|
|
124027
|
-
|
|
124028
|
-
|
|
124029
|
-
|
|
124030
|
-
if (
|
|
124031
|
-
|
|
124032
|
-
|
|
124033
|
-
|
|
124034
|
-
|
|
124035
|
-
|
|
124036
|
-
|
|
124037
|
-
|
|
124038
|
-
|
|
124039
|
-
|
|
124040
|
-
|
|
124041
|
-
|
|
124042
|
-
|
|
124043
|
-
|
|
124044
|
-
|
|
124012
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
124013
|
+
if (!event.isPointerOverContainer) {
|
|
124014
|
+
return;
|
|
124015
|
+
}
|
|
124016
|
+
const targetNode = event.item.data;
|
|
124017
|
+
if (!targetNode) {
|
|
124018
|
+
return;
|
|
124019
|
+
}
|
|
124020
|
+
let parentNode = event.container.data;
|
|
124021
|
+
const pastParentNode = event.previousContainer.data;
|
|
124022
|
+
const tree = parentNode ? parentNode.children : this.dataRef();
|
|
124023
|
+
if (!tree) {
|
|
124024
|
+
return;
|
|
124025
|
+
}
|
|
124026
|
+
this.unsettled = true;
|
|
124027
|
+
const targetDropNode = (this.dropData.targetId && this.dropData.targetId in this.treeMap) ?
|
|
124028
|
+
this.treeMap[_.toNumber(this.dropData.targetId)] : null;
|
|
124029
|
+
if (cookie('env') && this.isDebug) {
|
|
124030
|
+
console.group('onDragDrop()');
|
|
124031
|
+
_.forEach([
|
|
124032
|
+
`model drop: ${targetNode.model.get('name')}`,
|
|
124033
|
+
`list shift: ${event.container.element.nativeElement.id} -> ${event.previousContainer.element.nativeElement.id}`,
|
|
124034
|
+
`index change (event): ${event.previousIndex} -> ${event.currentIndex}`,
|
|
124035
|
+
`current priority: ${targetNode.model.get('priority')}`,
|
|
124036
|
+
`target drop action: ${this.dropData.action}`,
|
|
124037
|
+
], (message) => console.log(message));
|
|
124038
|
+
}
|
|
124039
|
+
if (targetDropNode && !this.nodeIsEqual(parentNode, targetDropNode)) {
|
|
124040
|
+
if (cookie('env') && this.isDebug) {
|
|
124041
|
+
console.log(`target drop node differs: ${targetDropNode.id} -> ${targetDropNode.model.get('name')}`);
|
|
124042
|
+
console.log('target drop node is the same as target node:', targetNode.id === targetDropNode.id);
|
|
124043
|
+
}
|
|
124044
|
+
if (targetNode.id !== targetDropNode.id) {
|
|
124045
|
+
switch (this.dropData.action) {
|
|
124046
|
+
case 'before':
|
|
124047
|
+
case 'after':
|
|
124048
|
+
const nestParentId = targetDropNode.model.get('nestParent.id');
|
|
124049
|
+
const nestParent = (nestParentId && nestParentId in this.treeMap) ? this.treeMap[nestParentId] : null;
|
|
124050
|
+
parentNode = nestParent;
|
|
124051
|
+
break;
|
|
124052
|
+
case 'inside':
|
|
124053
|
+
parentNode = targetDropNode;
|
|
124054
|
+
break;
|
|
124055
|
+
}
|
|
124056
|
+
}
|
|
124057
|
+
if (cookie('env') && this.isDebug) {
|
|
124058
|
+
console.log('target drop node selected:', parentNode ? `${parentNode.id} -> ${parentNode.model.get('name')}` : 'none');
|
|
124045
124059
|
}
|
|
124046
124060
|
}
|
|
124047
|
-
if (
|
|
124048
|
-
|
|
124061
|
+
if (!this.nodeIsEqual(parentNode, pastParentNode)) {
|
|
124062
|
+
if (parentNode) {
|
|
124063
|
+
switch (this.dropData.action) {
|
|
124064
|
+
case 'before':
|
|
124065
|
+
case 'after':
|
|
124066
|
+
let targetIndex = parentNode.children.findIndex((n) => n.id === targetNode.id);
|
|
124067
|
+
if (this.dropData.action === 'after') {
|
|
124068
|
+
targetIndex++;
|
|
124069
|
+
}
|
|
124070
|
+
parentNode.children.splice(targetIndex, 0, targetNode);
|
|
124071
|
+
break;
|
|
124072
|
+
case 'inside':
|
|
124073
|
+
parentNode.children.push(targetNode);
|
|
124074
|
+
break;
|
|
124075
|
+
}
|
|
124076
|
+
parentNode.meta.expanded = true;
|
|
124077
|
+
}
|
|
124078
|
+
if (pastParentNode) {
|
|
124079
|
+
this.removeNode(pastParentNode.children, targetNode);
|
|
124080
|
+
}
|
|
124081
|
+
targetNode.model.set('nestParent', this.buildNodePatch(parentNode));
|
|
124082
|
+
if (cookie('env') && this.isDebug) {
|
|
124083
|
+
console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
|
|
124084
|
+
}
|
|
124049
124085
|
}
|
|
124050
|
-
|
|
124051
|
-
|
|
124052
|
-
if (
|
|
124086
|
+
const branch = parentNode ? parentNode.children : tree;
|
|
124087
|
+
let targetDropIndex = event.currentIndex;
|
|
124088
|
+
if (this.cdkDropListSortingDisabled) {
|
|
124089
|
+
targetDropIndex = null;
|
|
124053
124090
|
switch (this.dropData.action) {
|
|
124054
124091
|
case 'before':
|
|
124055
124092
|
case 'after':
|
|
124056
|
-
|
|
124093
|
+
targetDropIndex = branch.findIndex((n) => n.id === targetDropNode.id);
|
|
124057
124094
|
if (this.dropData.action === 'after') {
|
|
124058
|
-
|
|
124095
|
+
targetDropIndex++;
|
|
124096
|
+
}
|
|
124097
|
+
if (cookie('env') && this.isDebug) {
|
|
124098
|
+
console.log('index change (drop node):', `${event.previousIndex} -> ${targetDropIndex}`);
|
|
124059
124099
|
}
|
|
124060
|
-
parentNode.children.splice(targetIndex, 0, targetNode);
|
|
124061
|
-
break;
|
|
124062
|
-
case 'inside':
|
|
124063
|
-
parentNode.children.push(targetNode);
|
|
124064
124100
|
break;
|
|
124065
124101
|
}
|
|
124066
|
-
parentNode.meta.expanded = true;
|
|
124067
|
-
}
|
|
124068
|
-
if (pastParentNode) {
|
|
124069
|
-
this.removeNode(pastParentNode.children, targetNode);
|
|
124070
|
-
}
|
|
124071
|
-
targetNode.model.set('nestParent', this.buildNodePatch(parentNode));
|
|
124072
|
-
if (cookie('env') && this.dropDebug) {
|
|
124073
|
-
console.log(`new parent: ${targetNode.model.get('nestParent.name') || null}`);
|
|
124074
124102
|
}
|
|
124075
|
-
|
|
124076
|
-
|
|
124077
|
-
|
|
124078
|
-
|
|
124079
|
-
|
|
124080
|
-
|
|
124081
|
-
case 'before':
|
|
124082
|
-
case 'after':
|
|
124083
|
-
targetDropIndex = branch.findIndex((n) => n.id === targetDropNode.id);
|
|
124084
|
-
if (this.dropData.action === 'after') {
|
|
124085
|
-
targetDropIndex++;
|
|
124086
|
-
}
|
|
124087
|
-
if (cookie('env') && this.dropDebug) {
|
|
124088
|
-
console.log('index change (drop node):', `${event.previousIndex} -> ${targetDropIndex}`);
|
|
124103
|
+
if (_.isNumber(targetDropIndex)) {
|
|
124104
|
+
moveItemInArray(branch, event.previousIndex, targetDropIndex);
|
|
124105
|
+
let priority = 0;
|
|
124106
|
+
_.forEach(branch, (node) => {
|
|
124107
|
+
if (!node.model || !node.model.set) {
|
|
124108
|
+
return;
|
|
124089
124109
|
}
|
|
124090
|
-
|
|
124091
|
-
|
|
124092
|
-
|
|
124093
|
-
|
|
124094
|
-
moveItemInArray(branch, event.previousIndex, targetDropIndex);
|
|
124095
|
-
let priority = 0;
|
|
124096
|
-
_.forEach(branch, (node) => {
|
|
124097
|
-
if (!node.model || !node.model.set) {
|
|
124098
|
-
return;
|
|
124110
|
+
node.model.set('priority', priority++);
|
|
124111
|
+
});
|
|
124112
|
+
if (cookie('env') && this.isDebug) {
|
|
124113
|
+
console.log('new priority:', targetNode.model.get('priority'));
|
|
124099
124114
|
}
|
|
124100
|
-
node.model.set('priority', priority++);
|
|
124101
|
-
});
|
|
124102
|
-
if (cookie('env') && this.dropDebug) {
|
|
124103
|
-
console.log('new priority:', targetNode.model.get('priority'));
|
|
124104
124115
|
}
|
|
124105
|
-
|
|
124106
|
-
|
|
124107
|
-
|
|
124108
|
-
|
|
124109
|
-
|
|
124110
|
-
|
|
124111
|
-
|
|
124116
|
+
if (cookie('env') && this.isDebug) {
|
|
124117
|
+
console.groupEnd();
|
|
124118
|
+
}
|
|
124119
|
+
yield targetNode.model.save();
|
|
124120
|
+
this.unsettled = false;
|
|
124121
|
+
this.subscriber.next(this.dataRef());
|
|
124122
|
+
this.ref.detectChanges();
|
|
124123
|
+
});
|
|
124112
124124
|
}
|
|
124113
124125
|
onDragMove(event) {
|
|
124114
124126
|
const e = this.document.elementFromPoint(event.pointerPosition.x, event.pointerPosition.y);
|