reneco-hierarchized-picker 0.2.2-beta.5 → 0.2.2-beta.6

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.
@@ -214,7 +214,9 @@ Tree.prototype.bindEvent = function (ele) {
214
214
  this.onSwitcherClick(target);
215
215
  }
216
216
  //CUSTOM
217
- const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
217
+ const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span.treejs-label')).filter((ele) => {
218
+ return ele.parentNode.parentNode.parentNode === e.target.parentNode;
219
+ });
218
220
  let hasUndefinedchild = [];
219
221
  //This may be a problem the day a node value is "undefined"
220
222
  hasUndefinedchild = childspans.filter(ele => {
@@ -444,7 +446,10 @@ Tree.prototype.walkUp = function (node, changeState) {
444
446
  return;
445
447
  parent.status = pStatus;
446
448
  if (parent.parent) {
447
- parent.parent.children.find(item => item.id === parent.id).status = pStatus;
449
+ let parentparentchild = parent.parent.children.find(item => item.id === parent.id);
450
+ if (parentparentchild) {
451
+ parentparentchild.status = pStatus;
452
+ }
448
453
  }
449
454
  }
450
455
  else {
@@ -18208,6 +18213,38 @@ const HierarchizedPickerComponent = class {
18208
18213
  });
18209
18214
  return source;
18210
18215
  }
18216
+ searchAndMergeDataClassification(source, toadd) {
18217
+ let terminate = false;
18218
+ source.children.forEach((element, index) => {
18219
+ if (terminate) {
18220
+ return source;
18221
+ }
18222
+ if (source.ID == toadd.ID) {
18223
+ let subterminate = false;
18224
+ toadd.children.forEach((taelement, index) => {
18225
+ if (subterminate) {
18226
+ return;
18227
+ }
18228
+ if (element.ID == taelement.ID) {
18229
+ element = this.mergeData(element, taelement);
18230
+ subterminate = true;
18231
+ return;
18232
+ }
18233
+ });
18234
+ }
18235
+ else {
18236
+ if (element.ID == toadd.ID) {
18237
+ element = this.mergeData(element, toadd);
18238
+ terminate = true;
18239
+ return source;
18240
+ }
18241
+ else {
18242
+ this.searchAndMergeDataClassification(element, toadd);
18243
+ }
18244
+ }
18245
+ });
18246
+ return source;
18247
+ }
18211
18248
  getNodeIdFromFullpath(fullpath) {
18212
18249
  return new Promise((resolve, reject) => {
18213
18250
  let token = this.theOptions.token;
@@ -18313,7 +18350,7 @@ const HierarchizedPickerComponent = class {
18313
18350
  if (xhr.status === 200) {
18314
18351
  that.mylog('XHR 200', JSON.parse(xhr.responseText));
18315
18352
  if (that.rawData) {
18316
- that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
18353
+ that.rawData = that.searchAndMergeDataClassification(that.rawData, JSON.parse(xhr.responseText));
18317
18354
  }
18318
18355
  else {
18319
18356
  that.rawData = JSON.parse(xhr.responseText);
@@ -439,6 +439,38 @@ export class HierarchizedPickerComponent {
439
439
  });
440
440
  return source;
441
441
  }
442
+ searchAndMergeDataClassification(source, toadd) {
443
+ let terminate = false;
444
+ source.children.forEach((element, index) => {
445
+ if (terminate) {
446
+ return source;
447
+ }
448
+ if (source.ID == toadd.ID) {
449
+ let subterminate = false;
450
+ toadd.children.forEach((taelement, index) => {
451
+ if (subterminate) {
452
+ return;
453
+ }
454
+ if (element.ID == taelement.ID) {
455
+ element = this.mergeData(element, taelement);
456
+ subterminate = true;
457
+ return;
458
+ }
459
+ });
460
+ }
461
+ else {
462
+ if (element.ID == toadd.ID) {
463
+ element = this.mergeData(element, toadd);
464
+ terminate = true;
465
+ return source;
466
+ }
467
+ else {
468
+ this.searchAndMergeDataClassification(element, toadd);
469
+ }
470
+ }
471
+ });
472
+ return source;
473
+ }
442
474
  getNodeIdFromFullpath(fullpath) {
443
475
  return new Promise((resolve, reject) => {
444
476
  let token = this.theOptions.token;
@@ -544,7 +576,7 @@ export class HierarchizedPickerComponent {
544
576
  if (xhr.status === 200) {
545
577
  that.mylog('XHR 200', JSON.parse(xhr.responseText));
546
578
  if (that.rawData) {
547
- that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
579
+ that.rawData = that.searchAndMergeDataClassification(that.rawData, JSON.parse(xhr.responseText));
548
580
  }
549
581
  else {
550
582
  that.rawData = JSON.parse(xhr.responseText);
@@ -182,7 +182,9 @@ Tree.prototype.bindEvent = function (ele) {
182
182
  this.onSwitcherClick(target);
183
183
  }
184
184
  //CUSTOM
185
- const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
185
+ const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span.treejs-label')).filter((ele) => {
186
+ return ele.parentNode.parentNode.parentNode === e.target.parentNode;
187
+ });
186
188
  let hasUndefinedchild = [];
187
189
  //This may be a problem the day a node value is "undefined"
188
190
  hasUndefinedchild = childspans.filter(ele => {
@@ -412,7 +414,10 @@ Tree.prototype.walkUp = function (node, changeState) {
412
414
  return;
413
415
  parent.status = pStatus;
414
416
  if (parent.parent) {
415
- parent.parent.children.find(item => item.id === parent.id).status = pStatus;
417
+ let parentparentchild = parent.parent.children.find(item => item.id === parent.id);
418
+ if (parentparentchild) {
419
+ parentparentchild.status = pStatus;
420
+ }
416
421
  }
417
422
  }
418
423
  else {
@@ -211,7 +211,9 @@ Tree.prototype.bindEvent = function (ele) {
211
211
  this.onSwitcherClick(target);
212
212
  }
213
213
  //CUSTOM
214
- const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
214
+ const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span.treejs-label')).filter((ele) => {
215
+ return ele.parentNode.parentNode.parentNode === e.target.parentNode;
216
+ });
215
217
  let hasUndefinedchild = [];
216
218
  //This may be a problem the day a node value is "undefined"
217
219
  hasUndefinedchild = childspans.filter(ele => {
@@ -441,7 +443,10 @@ Tree.prototype.walkUp = function (node, changeState) {
441
443
  return;
442
444
  parent.status = pStatus;
443
445
  if (parent.parent) {
444
- parent.parent.children.find(item => item.id === parent.id).status = pStatus;
446
+ let parentparentchild = parent.parent.children.find(item => item.id === parent.id);
447
+ if (parentparentchild) {
448
+ parentparentchild.status = pStatus;
449
+ }
445
450
  }
446
451
  }
447
452
  else {
@@ -18206,6 +18211,38 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18206
18211
  });
18207
18212
  return source;
18208
18213
  }
18214
+ searchAndMergeDataClassification(source, toadd) {
18215
+ let terminate = false;
18216
+ source.children.forEach((element, index) => {
18217
+ if (terminate) {
18218
+ return source;
18219
+ }
18220
+ if (source.ID == toadd.ID) {
18221
+ let subterminate = false;
18222
+ toadd.children.forEach((taelement, index) => {
18223
+ if (subterminate) {
18224
+ return;
18225
+ }
18226
+ if (element.ID == taelement.ID) {
18227
+ element = this.mergeData(element, taelement);
18228
+ subterminate = true;
18229
+ return;
18230
+ }
18231
+ });
18232
+ }
18233
+ else {
18234
+ if (element.ID == toadd.ID) {
18235
+ element = this.mergeData(element, toadd);
18236
+ terminate = true;
18237
+ return source;
18238
+ }
18239
+ else {
18240
+ this.searchAndMergeDataClassification(element, toadd);
18241
+ }
18242
+ }
18243
+ });
18244
+ return source;
18245
+ }
18209
18246
  getNodeIdFromFullpath(fullpath) {
18210
18247
  return new Promise((resolve, reject) => {
18211
18248
  let token = this.theOptions.token;
@@ -18311,7 +18348,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18311
18348
  if (xhr.status === 200) {
18312
18349
  that.mylog('XHR 200', JSON.parse(xhr.responseText));
18313
18350
  if (that.rawData) {
18314
- that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
18351
+ that.rawData = that.searchAndMergeDataClassification(that.rawData, JSON.parse(xhr.responseText));
18315
18352
  }
18316
18353
  else {
18317
18354
  that.rawData = JSON.parse(xhr.responseText);
@@ -210,7 +210,9 @@ Tree.prototype.bindEvent = function (ele) {
210
210
  this.onSwitcherClick(target);
211
211
  }
212
212
  //CUSTOM
213
- const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span'));
213
+ const childspans = Array.prototype.slice.call(e.target.parentNode.querySelectorAll('ul > li > span.treejs-label')).filter((ele) => {
214
+ return ele.parentNode.parentNode.parentNode === e.target.parentNode;
215
+ });
214
216
  let hasUndefinedchild = [];
215
217
  //This may be a problem the day a node value is "undefined"
216
218
  hasUndefinedchild = childspans.filter(ele => {
@@ -440,7 +442,10 @@ Tree.prototype.walkUp = function (node, changeState) {
440
442
  return;
441
443
  parent.status = pStatus;
442
444
  if (parent.parent) {
443
- parent.parent.children.find(item => item.id === parent.id).status = pStatus;
445
+ let parentparentchild = parent.parent.children.find(item => item.id === parent.id);
446
+ if (parentparentchild) {
447
+ parentparentchild.status = pStatus;
448
+ }
444
449
  }
445
450
  }
446
451
  else {
@@ -18204,6 +18209,38 @@ const HierarchizedPickerComponent = class {
18204
18209
  });
18205
18210
  return source;
18206
18211
  }
18212
+ searchAndMergeDataClassification(source, toadd) {
18213
+ let terminate = false;
18214
+ source.children.forEach((element, index) => {
18215
+ if (terminate) {
18216
+ return source;
18217
+ }
18218
+ if (source.ID == toadd.ID) {
18219
+ let subterminate = false;
18220
+ toadd.children.forEach((taelement, index) => {
18221
+ if (subterminate) {
18222
+ return;
18223
+ }
18224
+ if (element.ID == taelement.ID) {
18225
+ element = this.mergeData(element, taelement);
18226
+ subterminate = true;
18227
+ return;
18228
+ }
18229
+ });
18230
+ }
18231
+ else {
18232
+ if (element.ID == toadd.ID) {
18233
+ element = this.mergeData(element, toadd);
18234
+ terminate = true;
18235
+ return source;
18236
+ }
18237
+ else {
18238
+ this.searchAndMergeDataClassification(element, toadd);
18239
+ }
18240
+ }
18241
+ });
18242
+ return source;
18243
+ }
18207
18244
  getNodeIdFromFullpath(fullpath) {
18208
18245
  return new Promise((resolve, reject) => {
18209
18246
  let token = this.theOptions.token;
@@ -18309,7 +18346,7 @@ const HierarchizedPickerComponent = class {
18309
18346
  if (xhr.status === 200) {
18310
18347
  that.mylog('XHR 200', JSON.parse(xhr.responseText));
18311
18348
  if (that.rawData) {
18312
- that.rawData = that.searchAndMergeData(that.rawData, JSON.parse(xhr.responseText));
18349
+ that.rawData = that.searchAndMergeDataClassification(that.rawData, JSON.parse(xhr.responseText));
18313
18350
  }
18314
18351
  else {
18315
18352
  that.rawData = JSON.parse(xhr.responseText);