reneco-hierarchized-picker 0.5.2 → 0.5.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.
@@ -18467,6 +18467,9 @@ function normalizeStr(str) {
18467
18467
  */
18468
18468
  function fillTreeWithObject(tree, myObject, searched, options) {
18469
18469
  const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
18470
+ if (myObject && myObject.children) {
18471
+ myObject = [myObject];
18472
+ }
18470
18473
  if (myObject && myObject.length) {
18471
18474
  myObject.forEach(value => {
18472
18475
  var _a, _b, _c, _d;
@@ -19559,12 +19562,16 @@ const HierarchizedPickerComponent = class {
19559
19562
  this.el.querySelector('.hierarchized-picker-tree').innerHTML = 'No search results ...';
19560
19563
  return;
19561
19564
  }
19565
+ if (!this.loadedTreeJs || forceTreeReset) {
19566
+ const dataManagerData = this.rawDataManager.getData();
19567
+ treeData = fillTreeWithObject([], (this.optionsManager.getOptions().displayRootNode ? dataManagerData : dataManagerData.children), null, this.optionsManager.getOptions());
19568
+ }
19562
19569
  // TODO If statement is a quick fix to allow the loadedTreeJs data to be holded instead of being reinitialized after hiding the modale
19563
19570
  const myTree = new Tree('#tree-area-' + this.componentID, {
19564
19571
  parentApi: this,
19565
19572
  rawDataManager: this.rawDataManager,
19566
19573
  completeCurrentTreeWithTree: completeCurrentTreeWithTree,
19567
- data: (!this.loadedTreeJs || forceTreeReset ? treeData : fillTreeWithObject([], this.rawDataManager.getData().children, null, this.optionsManager.getOptions())),
19574
+ data: treeData,
19568
19575
  onChange: async () => {
19569
19576
  let oldValue;
19570
19577
  try {
@@ -822,12 +822,16 @@ export class HierarchizedPickerComponent {
822
822
  this.el.querySelector('.hierarchized-picker-tree').innerHTML = 'No search results ...';
823
823
  return;
824
824
  }
825
+ if (!this.loadedTreeJs || forceTreeReset) {
826
+ const dataManagerData = this.rawDataManager.getData();
827
+ treeData = fillTreeWithObject([], (this.optionsManager.getOptions().displayRootNode ? dataManagerData : dataManagerData.children), null, this.optionsManager.getOptions());
828
+ }
825
829
  // TODO If statement is a quick fix to allow the loadedTreeJs data to be holded instead of being reinitialized after hiding the modale
826
830
  const myTree = new Tree('#tree-area-' + this.componentID, {
827
831
  parentApi: this,
828
832
  rawDataManager: this.rawDataManager,
829
833
  completeCurrentTreeWithTree: completeCurrentTreeWithTree,
830
- data: (!this.loadedTreeJs || forceTreeReset ? treeData : fillTreeWithObject([], this.rawDataManager.getData().children, null, this.optionsManager.getOptions())),
834
+ data: treeData,
831
835
  onChange: async () => {
832
836
  let oldValue;
833
837
  try {
@@ -147,14 +147,6 @@ Tree.prototype.buildTree = function (nodes, depth) {
147
147
  };
148
148
  Tree.prototype.bindEvent = function (ele) {
149
149
  var _a;
150
- // const that = this;
151
- // let parentOptions:any = {};
152
- // try{
153
- // parentOptions = JSON.parse(this.options.parentApi.theOptions);
154
- // }
155
- // catch {
156
- // parentOptions = this.options.parentApi.theOptions;
157
- // }
158
150
  // @ts-ignore
159
151
  function getLi(target) {
160
152
  return target.classList.contains('treejs-node') ? target : target.closest('.treejs-node');
@@ -52,6 +52,9 @@ function normalizeStr(str) {
52
52
  */
53
53
  export function fillTreeWithObject(tree, myObject, searched, options) {
54
54
  const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
55
+ if (myObject && myObject.children) {
56
+ myObject = [myObject];
57
+ }
55
58
  if (myObject && myObject.length) {
56
59
  myObject.forEach(value => {
57
60
  var _a, _b, _c, _d;
@@ -18464,6 +18464,9 @@ function normalizeStr(str) {
18464
18464
  */
18465
18465
  function fillTreeWithObject(tree, myObject, searched, options) {
18466
18466
  const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
18467
+ if (myObject && myObject.children) {
18468
+ myObject = [myObject];
18469
+ }
18467
18470
  if (myObject && myObject.length) {
18468
18471
  myObject.forEach(value => {
18469
18472
  var _a, _b, _c, _d;
@@ -19557,12 +19560,16 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19557
19560
  this.el.querySelector('.hierarchized-picker-tree').innerHTML = 'No search results ...';
19558
19561
  return;
19559
19562
  }
19563
+ if (!this.loadedTreeJs || forceTreeReset) {
19564
+ const dataManagerData = this.rawDataManager.getData();
19565
+ treeData = fillTreeWithObject([], (this.optionsManager.getOptions().displayRootNode ? dataManagerData : dataManagerData.children), null, this.optionsManager.getOptions());
19566
+ }
19560
19567
  // TODO If statement is a quick fix to allow the loadedTreeJs data to be holded instead of being reinitialized after hiding the modale
19561
19568
  const myTree = new Tree('#tree-area-' + this.componentID, {
19562
19569
  parentApi: this,
19563
19570
  rawDataManager: this.rawDataManager,
19564
19571
  completeCurrentTreeWithTree: completeCurrentTreeWithTree,
19565
- data: (!this.loadedTreeJs || forceTreeReset ? treeData : fillTreeWithObject([], this.rawDataManager.getData().children, null, this.optionsManager.getOptions())),
19572
+ data: treeData,
19566
19573
  onChange: async () => {
19567
19574
  let oldValue;
19568
19575
  try {
@@ -18463,6 +18463,9 @@ function normalizeStr(str) {
18463
18463
  */
18464
18464
  function fillTreeWithObject(tree, myObject, searched, options) {
18465
18465
  const searchResultPresentsUnMatched = options.searchResultPresentsUnMatched;
18466
+ if (myObject && myObject.children) {
18467
+ myObject = [myObject];
18468
+ }
18466
18469
  if (myObject && myObject.length) {
18467
18470
  myObject.forEach(value => {
18468
18471
  var _a, _b, _c, _d;
@@ -19555,12 +19558,16 @@ const HierarchizedPickerComponent = class {
19555
19558
  this.el.querySelector('.hierarchized-picker-tree').innerHTML = 'No search results ...';
19556
19559
  return;
19557
19560
  }
19561
+ if (!this.loadedTreeJs || forceTreeReset) {
19562
+ const dataManagerData = this.rawDataManager.getData();
19563
+ treeData = fillTreeWithObject([], (this.optionsManager.getOptions().displayRootNode ? dataManagerData : dataManagerData.children), null, this.optionsManager.getOptions());
19564
+ }
19558
19565
  // TODO If statement is a quick fix to allow the loadedTreeJs data to be holded instead of being reinitialized after hiding the modale
19559
19566
  const myTree = new Tree('#tree-area-' + this.componentID, {
19560
19567
  parentApi: this,
19561
19568
  rawDataManager: this.rawDataManager,
19562
19569
  completeCurrentTreeWithTree: completeCurrentTreeWithTree,
19563
- data: (!this.loadedTreeJs || forceTreeReset ? treeData : fillTreeWithObject([], this.rawDataManager.getData().children, null, this.optionsManager.getOptions())),
19570
+ data: treeData,
19564
19571
  onChange: async () => {
19565
19572
  let oldValue;
19566
19573
  try {