reneco-hierarchized-picker 0.2.2-beta.3 → 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);
@@ -18559,10 +18596,10 @@ const HierarchizedPickerComponent = class {
18559
18596
  .then(displayResults)
18560
18597
  .catch((error) => {
18561
18598
  try {
18562
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
18599
+ this.errorToLog = "getDataFromSource 1 rejected:" + JSON.stringify(error, replacer, 2);
18563
18600
  }
18564
18601
  catch (_a) {
18565
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
18602
+ console.error("getDataFromSource 2 rejected:", JSON.stringify(error, replacer, 2));
18566
18603
  }
18567
18604
  });
18568
18605
  }
@@ -19176,8 +19213,9 @@ const HierarchizedPickerComponent = class {
19176
19213
  }
19177
19214
  // Search a value in the tree and triggers a search when necessary
19178
19215
  search(searched) {
19179
- if (this.theOptions.mode == 'input') {
19180
- document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input').classList.remove('fieldError');
19216
+ let searchinput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
19217
+ if (this.theOptions.mode == 'input' && searchinput) {
19218
+ searchinput.classList.remove('fieldError');
19181
19219
  }
19182
19220
  if (searched.length > 2) {
19183
19221
  this.searchToDisplay += 1;
@@ -19283,10 +19321,10 @@ const HierarchizedPickerComponent = class {
19283
19321
  })
19284
19322
  .catch((error) => {
19285
19323
  try {
19286
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
19324
+ this.errorToLog = "getDataFromSource 3 rejected:" + JSON.stringify(error, replacer, 2);
19287
19325
  }
19288
19326
  catch (_a) {
19289
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
19327
+ console.error("getDataFromSource 4 rejected:", JSON.stringify(error, replacer, 2));
19290
19328
  }
19291
19329
  });
19292
19330
  }
@@ -19345,7 +19383,7 @@ const HierarchizedPickerComponent = class {
19345
19383
  if (typeof dfValue == 'string' && isNumeric(dfValue)) {
19346
19384
  dfValue = parseInt(dfValue);
19347
19385
  }
19348
- if (that.options.origin == 'classification') {
19386
+ if (that.theOptions.origin == 'classification') {
19349
19387
  if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, 'Properties.FullPath') == dfValue) ||
19350
19388
  (typeof dfValue == 'number' && that.getPropertyFromNode(element, 'ID') == dfValue)) {
19351
19389
  element.nodeid = element.id;
@@ -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);
@@ -790,10 +822,10 @@ export class HierarchizedPickerComponent {
790
822
  .then(displayResults)
791
823
  .catch((error) => {
792
824
  try {
793
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
825
+ this.errorToLog = "getDataFromSource 1 rejected:" + JSON.stringify(error, replacer, 2);
794
826
  }
795
827
  catch (_a) {
796
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
828
+ console.error("getDataFromSource 2 rejected:", JSON.stringify(error, replacer, 2));
797
829
  }
798
830
  });
799
831
  }
@@ -1407,8 +1439,9 @@ export class HierarchizedPickerComponent {
1407
1439
  }
1408
1440
  // Search a value in the tree and triggers a search when necessary
1409
1441
  search(searched) {
1410
- if (this.theOptions.mode == 'input') {
1411
- document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input').classList.remove('fieldError');
1442
+ let searchinput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
1443
+ if (this.theOptions.mode == 'input' && searchinput) {
1444
+ searchinput.classList.remove('fieldError');
1412
1445
  }
1413
1446
  if (searched.length > 2) {
1414
1447
  this.searchToDisplay += 1;
@@ -1514,10 +1547,10 @@ export class HierarchizedPickerComponent {
1514
1547
  })
1515
1548
  .catch((error) => {
1516
1549
  try {
1517
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
1550
+ this.errorToLog = "getDataFromSource 3 rejected:" + JSON.stringify(error, replacer, 2);
1518
1551
  }
1519
1552
  catch (_a) {
1520
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
1553
+ console.error("getDataFromSource 4 rejected:", JSON.stringify(error, replacer, 2));
1521
1554
  }
1522
1555
  });
1523
1556
  }
@@ -1576,7 +1609,7 @@ export class HierarchizedPickerComponent {
1576
1609
  if (typeof dfValue == 'string' && isNumeric(dfValue)) {
1577
1610
  dfValue = parseInt(dfValue);
1578
1611
  }
1579
- if (that.options.origin == 'classification') {
1612
+ if (that.theOptions.origin == 'classification') {
1580
1613
  if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, 'Properties.FullPath') == dfValue) ||
1581
1614
  (typeof dfValue == 'number' && that.getPropertyFromNode(element, 'ID') == dfValue)) {
1582
1615
  element.nodeid = element.id;
@@ -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);
@@ -18557,10 +18594,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
18557
18594
  .then(displayResults)
18558
18595
  .catch((error) => {
18559
18596
  try {
18560
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
18597
+ this.errorToLog = "getDataFromSource 1 rejected:" + JSON.stringify(error, replacer, 2);
18561
18598
  }
18562
18599
  catch (_a) {
18563
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
18600
+ console.error("getDataFromSource 2 rejected:", JSON.stringify(error, replacer, 2));
18564
18601
  }
18565
18602
  });
18566
18603
  }
@@ -19174,8 +19211,9 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19174
19211
  }
19175
19212
  // Search a value in the tree and triggers a search when necessary
19176
19213
  search(searched) {
19177
- if (this.theOptions.mode == 'input') {
19178
- document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input').classList.remove('fieldError');
19214
+ let searchinput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
19215
+ if (this.theOptions.mode == 'input' && searchinput) {
19216
+ searchinput.classList.remove('fieldError');
19179
19217
  }
19180
19218
  if (searched.length > 2) {
19181
19219
  this.searchToDisplay += 1;
@@ -19281,10 +19319,10 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19281
19319
  })
19282
19320
  .catch((error) => {
19283
19321
  try {
19284
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
19322
+ this.errorToLog = "getDataFromSource 3 rejected:" + JSON.stringify(error, replacer, 2);
19285
19323
  }
19286
19324
  catch (_a) {
19287
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
19325
+ console.error("getDataFromSource 4 rejected:", JSON.stringify(error, replacer, 2));
19288
19326
  }
19289
19327
  });
19290
19328
  }
@@ -19343,7 +19381,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19343
19381
  if (typeof dfValue == 'string' && isNumeric(dfValue)) {
19344
19382
  dfValue = parseInt(dfValue);
19345
19383
  }
19346
- if (that.options.origin == 'classification') {
19384
+ if (that.theOptions.origin == 'classification') {
19347
19385
  if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, 'Properties.FullPath') == dfValue) ||
19348
19386
  (typeof dfValue == 'number' && that.getPropertyFromNode(element, 'ID') == dfValue)) {
19349
19387
  element.nodeid = element.id;
@@ -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);
@@ -18555,10 +18592,10 @@ const HierarchizedPickerComponent = class {
18555
18592
  .then(displayResults)
18556
18593
  .catch((error) => {
18557
18594
  try {
18558
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
18595
+ this.errorToLog = "getDataFromSource 1 rejected:" + JSON.stringify(error, replacer, 2);
18559
18596
  }
18560
18597
  catch (_a) {
18561
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
18598
+ console.error("getDataFromSource 2 rejected:", JSON.stringify(error, replacer, 2));
18562
18599
  }
18563
18600
  });
18564
18601
  }
@@ -19172,8 +19209,9 @@ const HierarchizedPickerComponent = class {
19172
19209
  }
19173
19210
  // Search a value in the tree and triggers a search when necessary
19174
19211
  search(searched) {
19175
- if (this.theOptions.mode == 'input') {
19176
- document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input').classList.remove('fieldError');
19212
+ let searchinput = document.querySelector('#hierarchized-picker-' + this.componentID + ' .hierarchized-picker-search input');
19213
+ if (this.theOptions.mode == 'input' && searchinput) {
19214
+ searchinput.classList.remove('fieldError');
19177
19215
  }
19178
19216
  if (searched.length > 2) {
19179
19217
  this.searchToDisplay += 1;
@@ -19279,10 +19317,10 @@ const HierarchizedPickerComponent = class {
19279
19317
  })
19280
19318
  .catch((error) => {
19281
19319
  try {
19282
- this.errorToLog = "getDataFromSource rejected:" + JSON.stringify(error, replacer, 2);
19320
+ this.errorToLog = "getDataFromSource 3 rejected:" + JSON.stringify(error, replacer, 2);
19283
19321
  }
19284
19322
  catch (_a) {
19285
- console.error("getDataFromSource rejected:", JSON.stringify(error, replacer, 2));
19323
+ console.error("getDataFromSource 4 rejected:", JSON.stringify(error, replacer, 2));
19286
19324
  }
19287
19325
  });
19288
19326
  }
@@ -19341,7 +19379,7 @@ const HierarchizedPickerComponent = class {
19341
19379
  if (typeof dfValue == 'string' && isNumeric(dfValue)) {
19342
19380
  dfValue = parseInt(dfValue);
19343
19381
  }
19344
- if (that.options.origin == 'classification') {
19382
+ if (that.theOptions.origin == 'classification') {
19345
19383
  if ((typeof dfValue == 'string' && that.getPropertyFromNode(element, 'Properties.FullPath') == dfValue) ||
19346
19384
  (typeof dfValue == 'number' && that.getPropertyFromNode(element, 'ID') == dfValue)) {
19347
19385
  element.nodeid = element.id;