reneco-hierarchized-picker 0.4.2-beta.8 → 0.4.2-beta.9

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.
@@ -281,16 +281,17 @@ Tree.prototype.buildTree = function (nodes, depth) {
281
281
  };
282
282
  Tree.prototype.bindEvent = function (ele) {
283
283
  var _a;
284
- const that = this;
285
284
  if (!this.options.parentApi.isDisabled) {
286
285
  const contextMenu = this.options.parentApi.theOptions.contextMenu;
287
286
  if ((_a = contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.items) === null || _a === void 0 ? void 0 : _a.length) {
288
287
  new VanillaContextMenu(Object.assign(Object.assign({}, contextMenu), { scope: ele, menuItems: contextMenu.items.map(item => {
289
288
  return typeof item === 'string'
290
289
  ? item
291
- : Object.assign(Object.assign({}, item), { callback: e => {
292
- let targetOutput = Object.assign(Object.assign({}, that.nodesById[e.target.nodeId]), { hasChildren: that.nodesById[e.target.nodeId] && that.nodesById[e.target.nodeId].children &&
293
- that.nodesById[e.target.nodeId].children.length && that.nodesById[e.target.nodeId].children.length > 0 });
290
+ : Object.assign(Object.assign({}, item), { callback: async (e) => {
291
+ const pickerValue = await this.options.parentApi.getValue();
292
+ const treeJsNodeInfo = Object.assign({}, this.options.parentApi.loadedTreeJs.nodesById[pickerValue.nodeid]);
293
+ console.log("---- HELLO ", pickerValue, treeJsNodeInfo);
294
+ let targetOutput = Object.assign(Object.assign({}, treeJsNodeInfo), { hasChildren: treeJsNodeInfo.children.length > 0 });
294
295
  delete targetOutput.children;
295
296
  this.options.parentApi.onItemContextMenuItemClick(Object.assign(Object.assign({}, e), { target: targetOutput, contextMenuItem: item }));
296
297
  } });
@@ -19275,7 +19276,7 @@ const HierarchizedPickerComponent = class {
19275
19276
  onItemContextMenuItemClick(e) {
19276
19277
  this.itemContextMenuItemClick.emit(e);
19277
19278
  }
19278
- async setNodeAsSelected(id, treeToUpdate, userClick) {
19279
+ setNodeAsSelected(id, treeToUpdate, userClick) {
19279
19280
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
19280
19281
  if (((this.isDisabled && this.optionsManager.getOptions().mode != "tree") && this.shownTree && this.setValueOnClick) ||
19281
19282
  (this.loadedTreeJs.liElementsById[id] && this.loadedTreeJs.liElementsById[id].classList.value && this.loadedTreeJs.liElementsById[id].classList.value.indexOf('readonly_node') != -1)) {
@@ -617,7 +617,7 @@ export class HierarchizedPickerComponent {
617
617
  onItemContextMenuItemClick(e) {
618
618
  this.itemContextMenuItemClick.emit(e);
619
619
  }
620
- async setNodeAsSelected(id, treeToUpdate, userClick) {
620
+ setNodeAsSelected(id, treeToUpdate, userClick) {
621
621
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
622
622
  if (((this.isDisabled && this.optionsManager.getOptions().mode != "tree") && this.shownTree && this.setValueOnClick) ||
623
623
  (this.loadedTreeJs.liElementsById[id] && this.loadedTreeJs.liElementsById[id].classList.value && this.loadedTreeJs.liElementsById[id].classList.value.indexOf('readonly_node') != -1)) {
@@ -147,7 +147,7 @@ Tree.prototype.buildTree = function (nodes, depth) {
147
147
  };
148
148
  Tree.prototype.bindEvent = function (ele) {
149
149
  var _a;
150
- const that = this;
150
+ // const that = this;
151
151
  // let parentOptions:any = {};
152
152
  // try{
153
153
  // parentOptions = JSON.parse(this.options.parentApi.theOptions);
@@ -165,9 +165,11 @@ Tree.prototype.bindEvent = function (ele) {
165
165
  new VanillaContextMenu(Object.assign(Object.assign({}, contextMenu), { scope: ele, menuItems: contextMenu.items.map(item => {
166
166
  return typeof item === 'string'
167
167
  ? item
168
- : Object.assign(Object.assign({}, item), { callback: e => {
169
- let targetOutput = Object.assign(Object.assign({}, that.nodesById[e.target.nodeId]), { hasChildren: that.nodesById[e.target.nodeId] && that.nodesById[e.target.nodeId].children &&
170
- that.nodesById[e.target.nodeId].children.length && that.nodesById[e.target.nodeId].children.length > 0 });
168
+ : Object.assign(Object.assign({}, item), { callback: async (e) => {
169
+ const pickerValue = await this.options.parentApi.getValue();
170
+ const treeJsNodeInfo = Object.assign({}, this.options.parentApi.loadedTreeJs.nodesById[pickerValue.nodeid]);
171
+ console.log("---- HELLO ", pickerValue, treeJsNodeInfo);
172
+ let targetOutput = Object.assign(Object.assign({}, treeJsNodeInfo), { hasChildren: treeJsNodeInfo.children.length > 0 });
171
173
  delete targetOutput.children;
172
174
  this.options.parentApi.onItemContextMenuItemClick(Object.assign(Object.assign({}, e), { target: targetOutput, contextMenuItem: item }));
173
175
  } });
@@ -278,16 +278,17 @@ Tree.prototype.buildTree = function (nodes, depth) {
278
278
  };
279
279
  Tree.prototype.bindEvent = function (ele) {
280
280
  var _a;
281
- const that = this;
282
281
  if (!this.options.parentApi.isDisabled) {
283
282
  const contextMenu = this.options.parentApi.theOptions.contextMenu;
284
283
  if ((_a = contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.items) === null || _a === void 0 ? void 0 : _a.length) {
285
284
  new VanillaContextMenu(Object.assign(Object.assign({}, contextMenu), { scope: ele, menuItems: contextMenu.items.map(item => {
286
285
  return typeof item === 'string'
287
286
  ? item
288
- : Object.assign(Object.assign({}, item), { callback: e => {
289
- let targetOutput = Object.assign(Object.assign({}, that.nodesById[e.target.nodeId]), { hasChildren: that.nodesById[e.target.nodeId] && that.nodesById[e.target.nodeId].children &&
290
- that.nodesById[e.target.nodeId].children.length && that.nodesById[e.target.nodeId].children.length > 0 });
287
+ : Object.assign(Object.assign({}, item), { callback: async (e) => {
288
+ const pickerValue = await this.options.parentApi.getValue();
289
+ const treeJsNodeInfo = Object.assign({}, this.options.parentApi.loadedTreeJs.nodesById[pickerValue.nodeid]);
290
+ console.log("---- HELLO ", pickerValue, treeJsNodeInfo);
291
+ let targetOutput = Object.assign(Object.assign({}, treeJsNodeInfo), { hasChildren: treeJsNodeInfo.children.length > 0 });
291
292
  delete targetOutput.children;
292
293
  this.options.parentApi.onItemContextMenuItemClick(Object.assign(Object.assign({}, e), { target: targetOutput, contextMenuItem: item }));
293
294
  } });
@@ -19273,7 +19274,7 @@ const HierarchizedPickerComponent = class extends HTMLElement {
19273
19274
  onItemContextMenuItemClick(e) {
19274
19275
  this.itemContextMenuItemClick.emit(e);
19275
19276
  }
19276
- async setNodeAsSelected(id, treeToUpdate, userClick) {
19277
+ setNodeAsSelected(id, treeToUpdate, userClick) {
19277
19278
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
19278
19279
  if (((this.isDisabled && this.optionsManager.getOptions().mode != "tree") && this.shownTree && this.setValueOnClick) ||
19279
19280
  (this.loadedTreeJs.liElementsById[id] && this.loadedTreeJs.liElementsById[id].classList.value && this.loadedTreeJs.liElementsById[id].classList.value.indexOf('readonly_node') != -1)) {
@@ -277,16 +277,17 @@ Tree.prototype.buildTree = function (nodes, depth) {
277
277
  };
278
278
  Tree.prototype.bindEvent = function (ele) {
279
279
  var _a;
280
- const that = this;
281
280
  if (!this.options.parentApi.isDisabled) {
282
281
  const contextMenu = this.options.parentApi.theOptions.contextMenu;
283
282
  if ((_a = contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.items) === null || _a === void 0 ? void 0 : _a.length) {
284
283
  new VanillaContextMenu(Object.assign(Object.assign({}, contextMenu), { scope: ele, menuItems: contextMenu.items.map(item => {
285
284
  return typeof item === 'string'
286
285
  ? item
287
- : Object.assign(Object.assign({}, item), { callback: e => {
288
- let targetOutput = Object.assign(Object.assign({}, that.nodesById[e.target.nodeId]), { hasChildren: that.nodesById[e.target.nodeId] && that.nodesById[e.target.nodeId].children &&
289
- that.nodesById[e.target.nodeId].children.length && that.nodesById[e.target.nodeId].children.length > 0 });
286
+ : Object.assign(Object.assign({}, item), { callback: async (e) => {
287
+ const pickerValue = await this.options.parentApi.getValue();
288
+ const treeJsNodeInfo = Object.assign({}, this.options.parentApi.loadedTreeJs.nodesById[pickerValue.nodeid]);
289
+ console.log("---- HELLO ", pickerValue, treeJsNodeInfo);
290
+ let targetOutput = Object.assign(Object.assign({}, treeJsNodeInfo), { hasChildren: treeJsNodeInfo.children.length > 0 });
290
291
  delete targetOutput.children;
291
292
  this.options.parentApi.onItemContextMenuItemClick(Object.assign(Object.assign({}, e), { target: targetOutput, contextMenuItem: item }));
292
293
  } });
@@ -19271,7 +19272,7 @@ const HierarchizedPickerComponent = class {
19271
19272
  onItemContextMenuItemClick(e) {
19272
19273
  this.itemContextMenuItemClick.emit(e);
19273
19274
  }
19274
- async setNodeAsSelected(id, treeToUpdate, userClick) {
19275
+ setNodeAsSelected(id, treeToUpdate, userClick) {
19275
19276
  // TODO Temporarily ignores disabled mode for selecting nodes if mode is tree
19276
19277
  if (((this.isDisabled && this.optionsManager.getOptions().mode != "tree") && this.shownTree && this.setValueOnClick) ||
19277
19278
  (this.loadedTreeJs.liElementsById[id] && this.loadedTreeJs.liElementsById[id].classList.value && this.loadedTreeJs.liElementsById[id].classList.value.indexOf('readonly_node') != -1)) {