qms-angular 1.1.41 → 1.1.42

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.
@@ -31835,25 +31835,27 @@
31835
31835
  this.execWithoutEmitNodeChangeEvent(function () {
31836
31836
  var _b;
31837
31837
  var selectedItems = [];
31838
- var reMapTreeNode = function (item) {
31838
+ var reMapTreeNode = function (item, clearGroupId) {
31839
+ if (clearGroupId === void 0) { clearGroupId = false; }
31839
31840
  var _a;
31840
31841
  var node = _this.treeControl.dataNodes.find(function (x) { return x.id == item.id; });
31841
31842
  var nestedNode = _this.convertToNestedNode(node);
31842
31843
  node.groupId = item.groupId;
31843
31844
  node.isGroup = item.isGroup;
31844
31845
  _this.checkListSelection.select(node);
31845
- return Object.assign(Object.assign({}, nestedNode), { groupId: item.groupId, isGroup: item.isGroup, childCount: (_a = nestedNode.childCount) !== null && _a !== void 0 ? _a : _this.getListChildrenOfNode(node).length, children: [] });
31846
+ return Object.assign(Object.assign({}, nestedNode), { groupId: clearGroupId ? null : item.groupId, isGroup: item.isGroup, childCount: (_a = nestedNode.childCount) !== null && _a !== void 0 ? _a : _this.getListChildrenOfNode(node).length, children: [] });
31846
31847
  };
31847
31848
  treeNodes.forEach(function (item) {
31848
31849
  var node = _this.treeControl.dataNodes.find(function (x) { return x.id == item.id; });
31849
31850
  if (!node)
31850
31851
  return;
31851
31852
  var nestedNode = _this.convertToNestedNode(node);
31852
- selectedItems.push(Object.assign(Object.assign({}, reMapTreeNode(item)), { children: item.children.map(function (x) { return reMapTreeNode(x); }) }));
31853
+ selectedItems.push(Object.assign(Object.assign({}, reMapTreeNode(item, true)), { children: item.children.map(function (x) { return reMapTreeNode(x); }) }));
31853
31854
  });
31854
31855
  (_b = _this.resultSelected).push.apply(_b, __spreadArray([], __read(selectedItems)));
31855
31856
  });
31856
31857
  this.onValueChangeEvent.emit(this.resultSelected);
31858
+ this._onSelectionNodeChangeEvent('added', this.resultSelected);
31857
31859
  this.cdRef.detectChanges();
31858
31860
  };
31859
31861
  SelectDepartmentTreeComponent.prototype._initListSelected = function () {
@@ -33632,6 +33634,9 @@
33632
33634
  configurable: true
33633
33635
  });
33634
33636
  ;
33637
+ QMSSelectAccessDialogComponent.prototype.ngAfterContentChecked = function () {
33638
+ this.cdRef.detectChanges();
33639
+ };
33635
33640
  QMSSelectAccessDialogComponent.prototype.ngAfterContentInit = function () {
33636
33641
  this.cdRef.detectChanges();
33637
33642
  };
@@ -33691,8 +33696,23 @@
33691
33696
  this.resultAccess = ___namespace.cloneDeep(Object.assign(Object.assign({}, this.dialogData.data.selectedData), { departments: [] }));
33692
33697
  // init group selected department
33693
33698
  this._departmentSelected = ___namespace.cloneDeep(this.dialogData.data.selectedData.departments);
33694
- var groups = this._departmentSelected.filter(function (x) { return x.isGroup; }) || [];
33695
- var singleItem = this._departmentSelected.filter(function (x) { return !x.isGroup && !x.groupId; });
33699
+ var groups = [];
33700
+ var singleItem = [];
33701
+ this._departmentSelected.forEach(function (item) {
33702
+ if (item.isGroup) {
33703
+ groups.push(item);
33704
+ return;
33705
+ }
33706
+ if (!item.groupId) {
33707
+ singleItem.push(item);
33708
+ return;
33709
+ }
33710
+ if (!_this._departmentSelected.some(function (x) { return x.id == item.groupId; })) {
33711
+ item.groupId = null;
33712
+ singleItem.push(item);
33713
+ return;
33714
+ }
33715
+ });
33696
33716
  groups.forEach(function (group) {
33697
33717
  var child = _this._departmentSelected.filter(function (item) { return item.groupId == group.id; });
33698
33718
  group.children = child;
@@ -33988,9 +34008,11 @@
33988
34008
  _this.resultAccess.departments.splice(index, 1);
33989
34009
  });
33990
34010
  });
34011
+ this.cdRef.detectChanges();
33991
34012
  }
33992
34013
  this.resultAccess.departments.forEach(function (item) {
33993
- item.children = item.children.filter(function (x, index) { return index === item.children.findIndex(function (_x) { return x.id === _x.id; }); });
34014
+ if (!!item.children)
34015
+ item.children = item.children.filter(function (x, index) { return index === item.children.findIndex(function (_x) { return x.id === _x.id; }); });
33994
34016
  });
33995
34017
  this._departmentSelected = ___namespace.cloneDeep(this.resultAccess.departments);
33996
34018
  this.cdRef.detectChanges();